當前位置: 首頁>>代碼示例>>C#>>正文


C# ByteStream.SetPosition方法代碼示例

本文整理匯總了C#中MyUtils.ByteStream.SetPosition方法的典型用法代碼示例。如果您正苦於以下問題:C# ByteStream.SetPosition方法的具體用法?C# ByteStream.SetPosition怎麽用?C# ByteStream.SetPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MyUtils.ByteStream的用法示例。


在下文中一共展示了ByteStream.SetPosition方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: GetMerchantData

        public override MerchantManager GetMerchantData(NPCSpawnList NPCSL)
        {
            List<EQApplicationPacket> PacketList = Packets.PacketList;

            UInt32 OP_ShopRequest = OpManager.OpCodeNameToNumber("OP_ShopRequest");

            UInt32 OP_ShopEnd = OpManager.OpCodeNameToNumber("OP_ShopEnd");

            UInt32 OP_ItemPacket = OpManager.OpCodeNameToNumber("OP_ItemPacket");

            MerchantManager mm = new MerchantManager();

            for (int i = 0; i < PacketList.Count; ++i)
            {
                EQApplicationPacket p = PacketList[i];

                if ((p.Direction == PacketDirection.ServerToClient) && (p.OpCode == OP_ShopRequest))
                {
                    ByteStream Buffer = new ByteStream(p.Buffer);

                    UInt32 MerchantSpawnID = Buffer.ReadUInt32();

                    NPCSpawn npc = NPCSL.GetNPC(MerchantSpawnID);

                    UInt32 NPCTypeID;

                    if (npc != null)
                        NPCTypeID = npc.NPCTypeID;
                    else
                        NPCTypeID = 0;

                    mm.AddMerchant(MerchantSpawnID);

                    for (int j = i + 1; j < PacketList.Count; ++j)
                    {
                        p = PacketList[j];

                        if (p.OpCode == OP_ShopEnd)
                            break;

                        if (p.OpCode == OP_ItemPacket)
                        {
                            Buffer = new ByteStream(p.Buffer);

                            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); // Point to item name

                            string ItemName = Buffer.ReadString(true);

                            string Lore = Buffer.ReadString(true);

                            string IDFile = Buffer.ReadString(true);

                            UInt32 ItemID = Buffer.ReadUInt32();

                            //if (Quantity == -1)
                            mm.AddMerchantItem(MerchantSpawnID, ItemID, ItemName, MerchantSlot, Quantity);
                        }
                    }
                }
            }

            return mm;
        }
開發者ID:Vaion,項目名稱:Server,代碼行數:75,代碼來源:PatchSoD.cs

示例5: ExplorePlayerProfile


//.........這裏部分代碼省略.........
            OutputStream.WriteLine("{0, -5}: Item HP Total? {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Endurance Total? {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Mana Total? {1}", Buffer.GetPosition(), Buffer.ReadUInt32());

            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadUInt32());

            OutputStream.WriteLine("{0, -5}: Expansion Count {1}", Buffer.GetPosition(), Buffer.ReadUInt32());

            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());

            UInt32 NameLength = Buffer.ReadUInt32();
            OutputStream.WriteLine("{0, -5}: Name Length: {1}", Buffer.GetPosition() - 4, NameLength);

            int CurrentPosition = Buffer.GetPosition();
            OutputStream.WriteLine("{0, -5}: Name: {1}", Buffer.GetPosition(), Buffer.ReadString(false));

            Buffer.SetPosition(CurrentPosition + (int)NameLength);

            UInt32 LastNameLength = Buffer.ReadUInt32();
            OutputStream.WriteLine("{0, -5}: LastName Length: {1}", Buffer.GetPosition() - 4, LastNameLength);

            CurrentPosition = Buffer.GetPosition();
            OutputStream.WriteLine("{0, -5}: Last Name: {1}", Buffer.GetPosition(), Buffer.ReadString(false));

            Buffer.SetPosition(CurrentPosition + (int)LastNameLength);

            OutputStream.WriteLine("{0, -5}: Birthday {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Account Start Date {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Last Login Date {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Time Played Minutes {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Time Entitled On Account {1}", Buffer.GetPosition(), Buffer.ReadUInt32());
            OutputStream.WriteLine("{0, -5}: Expansions {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32());

            UInt32 LanguageCount = Buffer.ReadUInt32();

            OutputStream.WriteLine("{0, -5}: Language Count = {1}", Buffer.GetPosition() - 4, LanguageCount);

            for (int i = 0; i < LanguageCount; ++i)
            {
                Buffer.SkipBytes(1);
            }

            OutputStream.WriteLine("{0, -5}: Zone ID {1}", Buffer.GetPosition(), Buffer.ReadUInt16());
            OutputStream.WriteLine("{0, -5}: Zone Instance {1}", Buffer.GetPosition(), Buffer.ReadUInt16());
            OutputStream.WriteLine("{0, -5}: Y,X,Z {1},{2},{3} Heading: {4}",
                Buffer.GetPosition(), Buffer.ReadSingle(), Buffer.ReadSingle(), Buffer.ReadSingle(), Buffer.ReadSingle());

            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadByte());
            OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadByte());
開發者ID:Codex-NG,項目名稱:Server,代碼行數:67,代碼來源:PatchFebruary11-2013.cs

示例6: GetZoneNumber


//.........這裏部分代碼省略.........
            SomethingCount = Buffer.ReadUInt32();

            for (int i = 0; i < SomethingCount; ++i)
            {
                Buffer.SkipBytes(4);
            }

            SomethingCount = Buffer.ReadUInt32();

            for (int i = 0; i < SomethingCount; ++i)
            {
                Buffer.SkipBytes(4);
            }

            UInt32 SpellBookSlots = Buffer.ReadUInt32();

            for (int i = 0; i < SpellBookSlots; ++i)
            {
                Buffer.SkipBytes(4);
            }

            UInt32 SpellMemSlots = Buffer.ReadUInt32();

            for (int i = 0; i < SpellMemSlots; ++i)
            {
                Buffer.SkipBytes(4);
            }

            SomethingCount = Buffer.ReadUInt32();

            for (int i = 0; i < SomethingCount; ++i)
            {
                Buffer.SkipBytes(4);
            }

            Buffer.SkipBytes(1);

            UInt32 BuffCount = Buffer.ReadUInt32();

            for (int i = 0; i < BuffCount; ++i)
            {
                Buffer.SkipBytes(80);
            }

            UInt32 Plat = Buffer.ReadUInt32();
            UInt32 Gold = Buffer.ReadUInt32();
            UInt32 Silver = Buffer.ReadUInt32();
            UInt32 Copper = Buffer.ReadUInt32();

            Buffer.SkipBytes(16); // Money on cursor

            Buffer.SkipBytes(20);

            UInt32 AASpent = Buffer.ReadUInt32();

            Buffer.SkipBytes(30);

            UInt32 BandolierCount = Buffer.ReadUInt32();

            for (int i = 0; i < BandolierCount; ++i)
            {
                Buffer.ReadString(false);

                Buffer.ReadString(false);
                Buffer.SkipBytes(8);

                Buffer.ReadString(false);
                Buffer.SkipBytes(8);

                Buffer.ReadString(false);
                Buffer.SkipBytes(8);

                Buffer.ReadString(false);
                Buffer.SkipBytes(8);
            }

            UInt32 PotionCount = Buffer.ReadUInt32();

            for (int i = 0; i < PotionCount; ++i)
            {
                Buffer.ReadString(false);
                Buffer.SkipBytes(8);
            }

            Buffer.SkipBytes(100);

            int CurrentPosition = Buffer.GetPosition();

            String PlayerName = Buffer.ReadString(false);

            Buffer.SetPosition(CurrentPosition + 64);

            Buffer.SkipBytes(96);

            // This is what I am after ...

            UInt16 ZoneID = Buffer.ReadUInt16();

            return ZoneID;
        }
開發者ID:josheb,項目名稱:emu_dc,代碼行數:101,代碼來源:PatchDecember10-2012.cs

示例7: ExplorePlayerProfile

        public void ExplorePlayerProfile(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            Buffer.SetPosition(12);

            UInt32 PlayerClass = Buffer.ReadUInt32();

            Buffer.SetPosition(56);

            byte PlayerLevel = Buffer.ReadByte();

            Buffer.SetPosition(18100);

            OutputStream.WriteLine("Name: {0} Class: {1} Level: {2}\r\n", Buffer.ReadString(false), PlayerClass, PlayerLevel);
        }
開發者ID:Vaion,項目名稱:Server,代碼行數:14,代碼來源:PatchMay12-2010.cs

示例8: ExploreNewZonePacket

        public void ExploreNewZonePacket(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            Buffer.SetPosition(704);

            OutputStream.WriteLine("Zone name is {0}\r\n", Buffer.ReadString(false));
        }
開發者ID:Vaion,項目名稱:Server,代碼行數:6,代碼來源:PatchMay12-2010.cs


注:本文中的MyUtils.ByteStream.SetPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。