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


C# MyUtils.ByteStream类代码示例

本文整理汇总了C#中MyUtils.ByteStream的典型用法代码示例。如果您正苦于以下问题:C# ByteStream类的具体用法?C# ByteStream怎么用?C# ByteStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ByteStream类属于MyUtils命名空间,在下文中一共展示了ByteStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Decode_OP_MobUpdate

        override public PositionUpdate Decode_OP_MobUpdate(byte[] MobUpdatePacket)
        {
            PositionUpdate PosUpdate = new PositionUpdate();

            ByteStream Buffer = new ByteStream(MobUpdatePacket);

            PosUpdate.SpawnID = Buffer.ReadUInt16();

            Buffer.SkipBytes(2);

            UInt32 Word1 = Buffer.ReadUInt32();

            UInt32 Word2 = Buffer.ReadUInt32();

            UInt16 Word3 = Buffer.ReadUInt16();

            PosUpdate.p.y = Utils.EQ19ToFloat((Int32)(Word1 & 0x7FFFF));

            // Z is in the top 13 bits of Word1 and the bottom 6 of Word2

            UInt32 ZPart1 = Word1 >> 19;    // ZPart1 now has low order bits of Z in bottom 13 bits
            UInt32 ZPart2 = Word2 & 0x3F;   // ZPart2 now has high order bits of Z in bottom 6 bits

            ZPart2 = ZPart2 << 13;

            PosUpdate.p.z = Utils.EQ19ToFloat((Int32)(ZPart1 | ZPart2));

            PosUpdate.p.x = Utils.EQ19ToFloat((Int32)(Word2 >> 6) & 0x7FFFF);

            PosUpdate.p.heading = Utils.EQ19ToFloat((Int32)(Word3 & 0xFFF));

            PosUpdate.HighRes = false;

            return PosUpdate;
        }
开发者ID:Xackery,项目名称:eqemuserver,代码行数:35,代码来源:PatchMay12-2011.cs

示例2: ExploreItemPacket

        public void ExploreItemPacket(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            Buffer.SkipBytes(4);    // Skip type field.

            ExploreSubItem(OutputStream, ref Buffer);

            OutputStream.WriteLine("");
        }
开发者ID:regneq,项目名称:projecteqemu,代码行数:8,代码来源:PatchTestSep1-2010.cs

示例3: ExploreNPCMoveUpdate

        public void ExploreNPCMoveUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            PositionUpdate PosUpdate;

            PosUpdate = Decode_OP_NPCMoveUpdate(Buffer.Buffer);

            OutputStream.WriteLine("SpawnID: {0}, X = {1}, Y = {2}, Z = {3}, Heading = {4}", PosUpdate.SpawnID, PosUpdate.p.x, PosUpdate.p.y, PosUpdate.p.z, PosUpdate.p.heading);
        }
开发者ID:Vaion,项目名称:Server,代码行数:8,代码来源:PatchJanuary16-2013.cs

示例4: ExploreCastSpell

        public void ExploreCastSpell(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            UInt32 Slot = Buffer.ReadUInt32();
            UInt32 SpellID = Buffer.ReadUInt32();

            OutputStream.WriteLine("Casting spell {0} from slot {1}", SpellID, Slot);

            OutputStream.WriteLine("");
        }
开发者ID:Codex-NG,项目名称:Server,代码行数:9,代码来源:PatchJuly13-2010.cs

示例5: GetDoors

        override public List<Door> GetDoors()
        {
            List<Door> DoorList = new List<Door>();

            List<byte[]> SpawnDoorPacket = GetPacketsOfType("OP_SpawnDoor", PacketDirection.ServerToClient);

            if ((SpawnDoorPacket.Count == 0) || (SpawnDoorPacket[0].Length == 0))
                return DoorList;

            int DoorCount = SpawnDoorPacket[0].Length / 100;

            ByteStream Buffer = new ByteStream(SpawnDoorPacket[0]);

            for (int d = 0; d < DoorCount; ++d)
            {
                string DoorName = Buffer.ReadFixedLengthString(32, false);

                float YPos = Buffer.ReadSingle();

                float XPos = Buffer.ReadSingle();

                float ZPos = Buffer.ReadSingle();

                float Heading = Buffer.ReadSingle();

                UInt32 Incline = Buffer.ReadUInt32();

                Int32 Size = Buffer.ReadInt32();

                Buffer.SkipBytes(4); // Skip Unknown

                Byte DoorID = Buffer.ReadByte();

                Byte OpenType = Buffer.ReadByte();

                Byte StateAtSpawn = Buffer.ReadByte();

                Byte InvertState = Buffer.ReadByte();

                Int32 DoorParam = Buffer.ReadInt32();

                // Skip past the trailing unknowns in the door struct, moving to the next door in the packet.

                Buffer.SkipBytes(32);

                string DestZone = "NONE";

                Door NewDoor = new Door(DoorName, YPos, XPos, ZPos, Heading, Incline, Size, DoorID, OpenType, StateAtSpawn, InvertState,
                                        DoorParam, DestZone, 0, 0, 0, 0);

                DoorList.Add(NewDoor);

            }
            return DoorList;
        }
开发者ID:Codex-NG,项目名称:Server,代码行数:55,代码来源:PatchMarch13-2013.cs

示例6: ExploreItemPacket

        public void ExploreItemPacket(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            UInt32 StackSize = Buffer.ReadUInt32();
            Buffer.SkipBytes(4);
            UInt32 Slot = Buffer.ReadUInt32();
            UInt32 MerchantSlot = Buffer.ReadUInt32();
            UInt32 Price = Buffer.ReadUInt32();
            Int32 Quantity = Buffer.ReadInt32();
            Buffer.SetPosition(68);
            string Name = Buffer.ReadString(true);

            OutputStream.WriteLine("Item: {0} at Slot: {1}", Name, Slot);
        }
开发者ID:Vaion,项目名称:Server,代码行数:13,代码来源:PatchJuly13-2010.cs

示例7: ExploreCharInventoryPacket

        public void ExploreCharInventoryPacket(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            UInt32 ItemCount = Buffer.ReadUInt32();

            OutputStream.WriteLine("There are {0} items in the inventory.\r\n", ItemCount );

            for (int i = 0; i < ItemCount; ++i)
            {
                ExploreSubItem(OutputStream, ref Buffer);
            }

            OutputStream.WriteLine("");
        }
开发者ID:regneq,项目名称:projecteqemu,代码行数:13,代码来源:PatchTestSep1-2010.cs

示例8: ExploreClientUpdate

        public void ExploreClientUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            UInt16 SpawnID = Buffer.ReadUInt16();
            Buffer.SkipBytes(6);
            float x = Buffer.ReadSingle();
            float y = Buffer.ReadSingle();
            Buffer.SkipBytes(12);
            float z = Buffer.ReadSingle();

            Buffer.SkipBytes(4);
            UInt32 Temp = Buffer.ReadUInt32();
            Temp = Temp & 0x3FFFFF;
            Temp = Temp >> 10;
            float heading = Utils.EQ19ToFloat((Int32)(Temp));

            OutputStream.WriteLine("Loc: {0}, {1}, {2}  Heading: {3}", x, y, z, heading);

            OutputStream.WriteLine("");
        }
开发者ID:Vaion,项目名称:Server,代码行数:19,代码来源:PatchDec7-2010.cs

示例9: DecodeItemPacket

        public override Item DecodeItemPacket(byte[] PacketBuffer)
        {
            ByteStream Buffer = new ByteStream(PacketBuffer);

            Item NewItem = new Item();

            Buffer.SetPosition(30);
            NewItem.MerchantSlot = Buffer.ReadByte();            // 13
            NewItem.Price = Buffer.ReadUInt32();                 // 14
            Buffer.SkipBytes(5);
            NewItem.Quantity = Buffer.ReadInt32();               // 23
            Buffer.SetPosition(97);
            NewItem.Name = Buffer.ReadString(true);
            NewItem.Lore = Buffer.ReadString(true);
            NewItem.IDFile = Buffer.ReadString(true);
            Buffer.SkipBytes(1);
            NewItem.ID = Buffer.ReadUInt32();

            return NewItem;
        }
开发者ID:Vaion,项目名称:Server,代码行数:20,代码来源:PatchFeb8-2011.cs

示例10: DecodeItemPacket

        public override Item DecodeItemPacket(byte[] PacketBuffer)
        {
            ByteStream Buffer = new ByteStream(PacketBuffer);

            Item NewItem = new Item();

            NewItem.StackSize = Buffer.ReadUInt32();
            Buffer.SkipBytes(4);
            NewItem.Slot = Buffer.ReadUInt32();
            NewItem.MerchantSlot = Buffer.ReadUInt32();
            NewItem.Price = Buffer.ReadUInt32();
            NewItem.Quantity = Buffer.ReadInt32();
            Buffer.SetPosition(68);
            NewItem.Name = Buffer.ReadString(true);
            NewItem.Lore = Buffer.ReadString(true);
            NewItem.IDFile = Buffer.ReadString(true);
            NewItem.ID = Buffer.ReadUInt32();

            return NewItem;
        }
开发者ID:Vaion,项目名称:Server,代码行数:20,代码来源:PatchMay12-2010.cs

示例11: ExploreInventory

        public void ExploreInventory(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            if (Buffer.Length() < 4)
                return;

            UInt32 Count = Buffer.ReadUInt32();

            for (int i = 0; i < Count; ++i)
            {
                try
                {
                    DecodeItemPacket(OutputStream, Buffer, Direction);
                }
                catch
                {
                    return;
                }
            }
        }
开发者ID:Codex-NG,项目名称:Server,代码行数:19,代码来源:PatchFebruary11-2013.cs

示例12: ExploreZoneEntry

        public void ExploreZoneEntry(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            if (Direction != PacketDirection.ServerToClient)
                return;

            string FirstName = Buffer.ReadString(false);

            OutputStream.WriteLine("Name = {0}", FirstName);

            UInt32 SpawnID = Buffer.ReadUInt32();

            OutputStream.WriteLine("SpawnID = {0}", SpawnID);

            byte Level = Buffer.ReadByte();

            OutputStream.WriteLine("Level = {0}", Level);

            Buffer.SkipBytes(4);

            byte IsNPC = Buffer.ReadByte();

            OutputStream.WriteLine("IsNPC = {0}", IsNPC);

            UInt32 Bitfield = Buffer.ReadUInt32();
            OutputStream.WriteLine("Name: {0}, Bitfield: {1}", FirstName, Convert.ToString(Bitfield, 2));

            byte OtherData = Buffer.ReadByte();

            OutputStream.WriteLine("OtherData = {0}", OtherData);

            Buffer.SkipBytes(8);

            if ((OtherData & 1) > 0)
            {
                OutputStream.WriteLine("OD:     {0}", Buffer.ReadString(false));
                OutputStream.WriteLine("OD:     {0}", Buffer.ReadString(false));
                OutputStream.WriteLine("OD:     {0}", Buffer.ReadString(false));
                Buffer.SkipBytes(53);
            }

            if ((OtherData & 4) > 0)
            {
                OutputStream.WriteLine("Aura:     {0}", Buffer.ReadString(false));
                OutputStream.WriteLine("Aura:     {0}", Buffer.ReadString(false));
                Buffer.SkipBytes(54);
            }

            byte Properties = Buffer.ReadByte();
            OutputStream.WriteLine("Properties = {0}, Offset now {1}", Properties, Buffer.GetPosition());

            UInt32 BodyType = 0;

            if(Properties > 0)
                BodyType = Buffer.ReadUInt32();

            OutputStream.WriteLine("Bodytype = {0}",  BodyType);

            if (Properties != 1)
                OutputStream.WriteLine("XXXX Properties is {0}", Properties);

            for (int i = 1; i < Properties; ++i)
                OutputStream.WriteLine("   Prop: {0}", Buffer.ReadUInt32());

            OutputStream.WriteLine("Position is now {0}", Buffer.GetPosition());

            byte HP = Buffer.ReadByte();
            byte HairColor = Buffer.ReadByte();
            byte BeardColor = Buffer.ReadByte();
            byte Eye1 = Buffer.ReadByte();
            byte Eye2 = Buffer.ReadByte();
            byte HairStyle = Buffer.ReadByte();
            byte BeardStyle = Buffer.ReadByte();
            OutputStream.WriteLine("Beardstyle is {0}", BeardStyle);

            Buffer.SkipBytes(12);   // Drakkin stuff
            byte EquipChest2 = Buffer.ReadByte();
            Buffer.SkipBytes(2);
            byte Helm = Buffer.ReadByte();

            float Size = Buffer.ReadSingle();

            byte Face = Buffer.ReadByte();

            float WalkSpeed = Buffer.ReadSingle();

            float RunSpeed = Buffer.ReadSingle();

            UInt32 Race = Buffer.ReadUInt32();

            OutputStream.WriteLine("Size: {0}, Face: {1}, Walkspeed: {2}, RunSpeed: {3}, Race: {4}", Size, Face, WalkSpeed, RunSpeed, Race);

            //Buffer.SkipBytes(18);
            Buffer.SkipBytes(5);
            UInt32 GuildID = Buffer.ReadUInt32();
            UInt32 GuildRank = Buffer.ReadUInt32();
            Buffer.SkipBytes(5);
            OutputStream.WriteLine("GuildID: {0}, Guild Rank: {1}", GuildID, GuildRank);

            Buffer.ReadString(false);

//.........这里部分代码省略.........
开发者ID:josheb,项目名称:emu_dc,代码行数:101,代码来源:PatchDecember10-2012.cs

示例13: ExploreTaskDescription

        public void ExploreTaskDescription(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            UInt32 Seq = Buffer.ReadUInt32();
            UInt32 TaskID = Buffer.ReadUInt32();
            UInt32 Unk1 = Buffer.ReadUInt32();
            UInt32 Unk2 = Buffer.ReadUInt32();
            byte Unk3 = Buffer.ReadByte();

            OutputStream.WriteLine("Seq: {0}, TaskID: {1}, Unk1: {2:X}, Unk2: {3:X}, Unk3: {4:X}", Seq, TaskID, Unk1, Unk2, Unk3);

            String Title = Buffer.ReadString(false);
            OutputStream.WriteLine("Title: {0}", Title);

            UInt32 Duration = Buffer.ReadUInt32();
            UInt32 Unk4 = Buffer.ReadUInt32();
            UInt32 StartTime = Buffer.ReadUInt32();

            String Desc = Buffer.ReadString(false);

            OutputStream.WriteLine("Duration: {0}, Unk4: {1:X}, StartTime: {2:X}", Duration, Unk4, StartTime);

            OutputStream.WriteLine("Desc: {0}", Desc);

            UInt32 RewardCount = Buffer.ReadUInt32();
            UInt32 Unk5 = Buffer.ReadUInt32();
            UInt32 Unk6 = Buffer.ReadUInt32();
            UInt16 Unk7 = Buffer.ReadUInt16();

            OutputStream.WriteLine("RewardCount: {0}, Unk5: {1:X}, Unk6: {2:X}, Unk7: {3:X}", Duration, Unk5, Unk6, Unk7);

            string MyString = "";

            byte b;

            while ((b = Buffer.ReadByte()) != 0)
            {
                if (b == 0x12)
                    continue;

                MyString += Convert.ToChar(b);
            }

            OutputStream.WriteLine("RewardString: {0}", MyString);

            UInt32 Unk8 = Buffer.ReadUInt32();
            byte Unk9 = Buffer.ReadByte();

            OutputStream.WriteLine("Unk8: {0:X}, Unk9: {1:X}", Unk8, Unk9);
        }
开发者ID:josheb,项目名称:emu_dc,代码行数:49,代码来源:PatchDecember10-2012.cs

示例14: ExploreRequestClientZoneChange

 public void ExploreRequestClientZoneChange(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
 {
     UInt32 ZoneID = Buffer.ReadUInt32();
     UInt32 Unknown = Buffer.ReadUInt32();
     float y = Buffer.ReadSingle();
     float x = Buffer.ReadSingle();
     float z = Buffer.ReadSingle();
     float heading = Buffer.ReadSingle();
     Buffer.SkipBytes(148);
     float uf = Buffer.ReadSingle();
     OutputStream.WriteLine("UF = {0}", uf);
 }
开发者ID:josheb,项目名称:emu_dc,代码行数:12,代码来源:PatchDecember10-2012.cs

示例15: GetZoneData

        public override NewZoneStruct GetZoneData()
        {
            NewZoneStruct NewZone = new NewZoneStruct();

            List<byte[]> ZonePackets = GetPacketsOfType("OP_NewZone", PacketDirection.ServerToClient);

            if (ZonePackets.Count < 1)
                return NewZone;

            // Assume there is only 1 packet and process the first one.

            ByteStream Buffer = new ByteStream(ZonePackets[0]);

            string CharName = Buffer.ReadFixedLengthString(64, false);

            NewZone.ShortName = Buffer.ReadFixedLengthString(32, false);

            Buffer.SkipBytes(96);   // Skip Unknown

            NewZone.LongName = Buffer.ReadFixedLengthString(278, true);

            NewZone.Type = Buffer.ReadByte();

            NewZone.FogRed = Buffer.ReadBytes(4);

            NewZone.FogGreen = Buffer.ReadBytes(4);

            NewZone.FogBlue = Buffer.ReadBytes(4);

            Buffer.SkipBytes(1);   // Unknown

            for (int i = 0; i < 4; ++i)
                NewZone.FogMinClip[i] = Buffer.ReadSingle();

            for (int i = 0; i < 4; ++i)
                NewZone.FogMaxClip[i] = Buffer.ReadSingle();

            NewZone.Gravity = Buffer.ReadSingle();

            NewZone.TimeType = Buffer.ReadByte();

            Buffer.SkipBytes(49);   // Unknown

            NewZone.Sky = Buffer.ReadByte();

            Buffer.SkipBytes(13);   // Unknown

            NewZone.ZEM = Buffer.ReadSingle();

            NewZone.SafeY = Buffer.ReadSingle();

            NewZone.SafeX = Buffer.ReadSingle();

            NewZone.SafeZ = Buffer.ReadSingle();

            NewZone.MinZ = Buffer.ReadSingle();

            NewZone.MaxZ = Buffer.ReadSingle();

            NewZone.UnderWorld = Buffer.ReadSingle();

            NewZone.MinClip = Buffer.ReadSingle();

            NewZone.MaxClip = Buffer.ReadSingle();

            Buffer.SkipBytes(84);   // Unknown

            NewZone.ShortName2 = Buffer.ReadFixedLengthString(96, false);

            Buffer.SkipBytes(52);   // Unknown

            NewZone.ZoneID = Buffer.ReadUInt16();

            NewZone.InstanceID = Buffer.ReadUInt16();

            Buffer.SkipBytes(38);   // Unknown

            NewZone.FallDamage = Buffer.ReadByte();

            Buffer.SkipBytes(21);   // Unknown

            NewZone.FogDensity = Buffer.ReadSingle();

            // Everything else after this point in the packet is unknown.

            return NewZone;
        }
开发者ID:Vaion,项目名称:Server,代码行数:87,代码来源:PatchSoD.cs


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