本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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());
示例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;
}
示例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);
}
示例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));
}