当前位置: 首页>>代码示例>>C#>>正文


C# StreamHandler.WriteInt32方法代码示例

本文整理汇总了C#中StreamHandler.WriteInt32方法的典型用法代码示例。如果您正苦于以下问题:C# StreamHandler.WriteInt32方法的具体用法?C# StreamHandler.WriteInt32怎么用?C# StreamHandler.WriteInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StreamHandler的用法示例。


在下文中一共展示了StreamHandler.WriteInt32方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        public override void Save(StreamHandler writer)
        {
            writer.WriteInt32(Items.Length);

            foreach (var item in Items)
                writer.WriteStruct(item);

            writer.WriteUInt32(TotalItemCount);
            writer.WriteUInt32(NextSearchDelayMs);
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:10,代码来源:AuctionListResult.cs

示例2: Save

 public override void Save(StreamHandler writer)
 {
     writer.WritePackedGuid(this.Unit);
     writer.WriteInt32(ThreatList.Length);
     for (int i = 0; i < ThreatList.Length; ++i)
     {
         writer.WritePackedGuid(ThreatList[i].Unit);
         writer.WriteUInt32(ThreatList[i].Threat);
     }
 }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:10,代码来源:ThreatUpdate.cs

示例3: ElementWrite

 protected override void ElementWrite(StreamHandler writer, int index)
 {
     if (index == -5)
     {
         writer.WriteUInt32(this.Unk);
     }
     else
     {
         index = -index - 1;
         writer.WriteInt32(this.Data[index].Length);
         writer.WriteBytes(this.Data[index]);
     }
 }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:13,代码来源:SetPhaseShift.cs

示例4: InternalWriteMetaData

        protected unsafe override void InternalWriteMetaData()
        {
            m_stream.DoAt(m_streamOriginalPosition, () =>
            {
                var bytes = new byte[MainHeader.Size];

                byte[] extraData;
                using (var writer = new StreamHandler())
                {
                    var flags = this.ExtraInfoFlags;
                    if (flags.HasFlag(ExtraDataFlags.HasClientIPv4) ||
                        flags.HasFlag(ExtraDataFlags.HasClientIPv6))
                        writer.WriteBytes(this.ClientAddress.GetAddressBytes());
                    if (flags.HasFlag(ExtraDataFlags.HasServerIPv4) ||
                        flags.HasFlag(ExtraDataFlags.HasServerIPv6))
                        writer.WriteBytes(this.ServerAddress.GetAddressBytes());
                    if (flags.HasFlag(ExtraDataFlags.HasClientPort))
                        writer.WriteInt32(this.ClientPort);
                    if (flags.HasFlag(ExtraDataFlags.HasServerPort))
                        writer.WriteInt32(this.ServerPort);

                    if (flags.HasFlag(ExtraDataFlags.HasSnifferIdString))
                    {
                        byte[] arr = Encoding.UTF8.GetBytes(this.SnifferDesc ?? string.Empty);
                        writer.WriteInt32(arr.Length);

                        using (MemoryStream oStream = new MemoryStream())
                        {
                            // BUG http://blogs.msdn.com/b/bclteam/archive/2006/05/10/592551.aspx
                            using (var ds = new DeflateStream(oStream, CompressionMode.Compress, true))
                                ds.Write(arr, 0, arr.Length);

                            arr = oStream.ToArray();
                        }

                        writer.WriteInt32(arr.Length);
                        writer.WriteBytes(arr);
                    }

                    extraData = writer.ToByteArray();
                }

                fixed (byte* bytesPtr = bytes)
                {
                    var header = (MainHeader*)bytesPtr;
                    header->PacketCount = this.Count;
                    Marshal.Copy(SignatureBytes, 0, new IntPtr(header->Signature), SignatureBytes.Length);
                    header->StartedOnTicks = this.StartTicks;
                    header->StartedOnUnix = this.StartTime.ToUnixTime();
                    header->ExtraDataLength = extraData.Length;
                    header->ExtraInfoFlags = this.ExtraInfoFlags;
                }

                m_stream.WriteBytes(bytes);
                m_stream.WriteBytes(extraData);
            });
        }
开发者ID:LordJZ,项目名称:Kamilla,代码行数:57,代码来源:Krpd2NetworkLog.cs

示例5: Save

        public override void Save(StreamHandler Writer)
        {
            Writer.WriteUInt16((ushort)this.Map);

            EnsureRead();

            long nUpdatesPos = Writer.BaseStream.Position;
            uint nUpdates = 0;
            Writer.WriteUInt32(nUpdates);

            if (this.DestroyedObjects.Count > 0)
            {
                ++nUpdates;
                Writer.WriteByte((byte)UpdateTypes.DestroyObjects);

                Writer.WriteInt32(this.DestroyedObjects.Count);
                foreach (WowGuid guid in this.DestroyedObjects)
                    Writer.WritePackedGuid(guid);
            }

            foreach (var pair in this.ValuesUpdates)
            {
                ++nUpdates;
                Writer.WriteByte((byte)UpdateTypes.UpdateValues);

                Writer.WritePackedGuid(pair.Key);
                WriteValues(Writer, pair.Value, WowObject.GetTypeId(pair.Key.Type));
            }

            foreach (var pair in this.CreatedObjects)
            {
                ++nUpdates;
                var type = UpdateTypes.CreateObjects;

                var obj = pair.Value;

                if (obj.MovementData.HavePosition)
                {
                    if (obj.TypeId == ObjectTypeId.DynamicObject
                        || obj.TypeId == ObjectTypeId.Corpse
                        || obj.TypeId == ObjectTypeId.Player)
                    {
                        type = UpdateTypes.CreateObjects2;
                    }

                    if (obj.TypeId == ObjectTypeId.GameObject && obj is WowGameObject)
                    {
                        switch ((obj as WowGameObject).GameObjectType)
                        {
                            case GameObjectTypes.Trap:
                            case GameObjectTypes.DuelArbiter:
                            case GameObjectTypes.FlagStand:
                            case GameObjectTypes.FlagDrop:
                                type = UpdateTypes.CreateObjects2;
                                break;
                        }
                    }
                }

                var guid = obj.Guid;

                Writer.WriteByte((byte)type);
                Writer.WritePackedGuid(guid);
                Writer.WriteByte((byte)obj.TypeId);
                obj.MovementData.Save(Writer);
                WriteValues(Writer, obj.GetValues(), obj.TypeId);
            }

            long pos = Writer.BaseStream.Position;
            Writer.BaseStream.Position = nUpdatesPos;
            Writer.WriteUInt32(nUpdates);
            Writer.BaseStream.Position = pos;
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:73,代码来源:UpdateData.cs

示例6: Save

        public void Save(StreamHandler writer)
        {
            writer
                .WriteByte(this.Slot)
                .WriteUInt32(this.Spell);

            if (this.Spell != 0)
            {
                writer
                    .WriteUInt16((ushort)this.Flags)
                    .WriteByte(this.Level)
                    .WriteByte(this.Charges);

                if ((Flags & AuraFlags.NotCaster) == 0)
                    writer.WritePackedGuid(this.Caster);

                if ((Flags & AuraFlags.Duration) != 0)
                {
                    writer.WriteUInt32(this.MaxDuration);
                    writer.WriteUInt32(this.LeftDuration);
                }

                if ((Flags & AuraFlags.BasePoints) != 0)
                {
                    for (int i = 0; i < MaxEffects; ++i)
                    {
                        if ((Flags & (AuraFlags)(1 << i)) != 0)
                            writer.WriteInt32(BasePoints[i]);
                    }
                }
            }
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:32,代码来源:Aura.cs


注:本文中的StreamHandler.WriteInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。