本文整理汇总了C#中MyUtils.ByteStream.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# ByteStream.ReadUInt32方法的具体用法?C# ByteStream.ReadUInt32怎么用?C# ByteStream.ReadUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyUtils.ByteStream
的用法示例。
在下文中一共展示了ByteStream.ReadUInt32方法的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;
}
示例2: 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("");
}
示例3: 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);
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例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("");
}
示例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("");
}
示例9: 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);
}
示例10: ExploreOpenNewTasksWindow
public void ExploreOpenNewTasksWindow(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
{
UInt32 NumTasks = Buffer.ReadUInt32();
UInt32 Unknown = Buffer.ReadUInt32();
UInt32 TaskGiver = Buffer.ReadUInt32();
OutputStream.WriteLine("Number of Tasks: {0}, Given by: {1}", NumTasks, TaskGiver);
for (int i = 0; i < NumTasks; ++i)
{
UInt32 TaskID = Buffer.ReadUInt32();
float Unk1 = Buffer.ReadSingle();
UInt32 TimeLimit = Buffer.ReadUInt32();
UInt32 Unk2 = Buffer.ReadUInt32();
string Title = Buffer.ReadString(false);
string Description = Buffer.ReadString(false);
string UnkString = Buffer.ReadString(false);
OutputStream.WriteLine("TaskID: {0}, Title: {1}", TaskID, Title);
UInt32 ActivityCount = Buffer.ReadUInt32();
OutputStream.WriteLine("Unknown: {0}", ActivityCount);
OutputStream.WriteLine("");
for (int j = 0; j < ActivityCount; ++j)
{
OutputStream.WriteLine("Activity {0}", i);
OutputStream.WriteLine("");
OutputStream.WriteLine(" Unknown: {0}", Buffer.ReadUInt32());
OutputStream.WriteLine(" Unknown: {0}", Buffer.ReadUInt32());
OutputStream.WriteLine(" Unknown: {0}", Buffer.ReadUInt32());
OutputStream.WriteLine(" String: {0}", Buffer.ReadString(false));
UInt32 StringLength = Buffer.ReadUInt32();
OutputStream.WriteLine(" StringLength: {0}", StringLength);
string MyString = "";
for (int k = 0; k < StringLength; ++k)
MyString += Convert.ToChar(Buffer.ReadByte());
OutputStream.WriteLine(" Weird String: {0}", MyString);
OutputStream.WriteLine(" Unknown: {0}", Buffer.ReadUInt32());
OutputStream.WriteLine(" Unknown: {0}", Buffer.ReadUInt32());
OutputStream.WriteLine(" String: {0}", Buffer.ReadString(false));
OutputStream.WriteLine(" Unknown 2 bytes: {0}", Buffer.ReadUInt16());
//if (i == 3)
//{
// OutputStream.WriteLine("Offset is now: {0}", Buffer.GetPosition());
// return;
//}
OutputStream.WriteLine(" String: {0}", Buffer.ReadString(false));
OutputStream.WriteLine(" String: {0}", Buffer.ReadString(false));
OutputStream.WriteLine(" String: {0}", Buffer.ReadString(false));
}
OutputStream.WriteLine("");
//OutputStream.WriteLine("Offset is now: {0}", Buffer.GetPosition());
}
}
示例11: GetSpawns
public override List<ZoneEntryStruct> GetSpawns()
{
List<ZoneEntryStruct> ZoneSpawns = new List<ZoneEntryStruct>();
List<byte[]> SpawnPackets = GetPacketsOfType("OP_ZoneEntry", PacketDirection.ServerToClient);
foreach (byte[] SpawnPacket in SpawnPackets)
{
ZoneEntryStruct NewSpawn = new ZoneEntryStruct();
ByteStream Buffer = new ByteStream(SpawnPacket);
NewSpawn.SpawnName = Buffer.ReadString(true);
NewSpawn.SpawnName = Utils.MakeCleanName(NewSpawn.SpawnName);
NewSpawn.SpawnID = Buffer.ReadUInt32();
NewSpawn.Level = Buffer.ReadByte();
float UnkSize = Buffer.ReadSingle();
NewSpawn.IsNPC = Buffer.ReadByte();
UInt32 Bitfield = Buffer.ReadUInt32();
NewSpawn.Showname = (Bitfield >> 28) & 1;
NewSpawn.TargetableWithHotkey = (Bitfield >> 27) & 1;
NewSpawn.Targetable = (Bitfield >> 26) & 1;
NewSpawn.ShowHelm = (Bitfield >> 24) & 1;
NewSpawn.Gender = (Bitfield >> 20) & 3;
Byte OtherData = Buffer.ReadByte();
Buffer.SkipBytes(8); // Skip 8 unknown bytes
NewSpawn.DestructableString1 = "";
NewSpawn.DestructableString2 = "";
NewSpawn.DestructableString3 = "";
if ((OtherData & 1) > 0)
{
//SQLOut(String.Format("-- OBJECT FOUND SpawnID {0}", SpawnID.ToString("x")));
//Console.WriteLine("Otherdata is {0} Skipping Stuff.", OtherData.ToString("x"));
NewSpawn.DestructableString1 = Buffer.ReadString(false);
NewSpawn.DestructableString2 = Buffer.ReadString(false);
NewSpawn.DestructableString3 = Buffer.ReadString(false);
NewSpawn.DestructableUnk1 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk2 = Buffer.ReadUInt32();
NewSpawn.DestructableID1 = Buffer.ReadUInt32();
NewSpawn.DestructableID2 = Buffer.ReadUInt32();
NewSpawn.DestructableID3 = Buffer.ReadUInt32();
NewSpawn.DestructableID4 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk3 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk4 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk5 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk6 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk7 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk8 = Buffer.ReadUInt32();
NewSpawn.DestructableUnk9 = Buffer.ReadUInt32();
NewSpawn.DestructableByte = Buffer.ReadByte();
//SQLOut(String.Format("-- DES: {0,8:x} {1,8:x} {2,8:d} {3,8:d} {4,8:d} {5,8:d} {6,8:x} {7,8:x} {8,8:x} {9,8:x} {10,8:x} {11,8:x} {12,8:x} {13,2:x} {14} {15} {16}",
// DestructableUnk1, DestructableUnk2, DestructableID1, DestructableID2, DestructableID3, DestructableID4,
// DestructableUnk3, DestructableUnk4, DestructableUnk5, DestructableUnk6, DestructableUnk7, DestructableUnk8,
// DestructableUnk9, DestructableByte, DestructableString1, DestructableString2, DestructableString3));
}
NewSpawn.Size = Buffer.ReadSingle();
NewSpawn.Face = Buffer.ReadByte();
NewSpawn.WalkSpeed = Buffer.ReadSingle();
NewSpawn.RunSpeed = Buffer.ReadSingle();
NewSpawn.Race = Buffer.ReadUInt32();
NewSpawn.PropCount = Buffer.ReadByte();
NewSpawn.BodyType = 0;
if (NewSpawn.PropCount >= 1)
//.........这里部分代码省略.........
示例12: GetLowResolutionMovementUpdates
public override List<PositionUpdate> GetLowResolutionMovementUpdates()
{
List<PositionUpdate> Updates = new List<PositionUpdate>();
List<byte[]> UpdatePackets = GetPacketsOfType("OP_MobUpdate", PacketDirection.ServerToClient);
foreach (byte[] MobUpdatePacket in UpdatePackets)
{
PositionUpdate PosUpdate = new PositionUpdate();
ByteStream Buffer = new ByteStream(MobUpdatePacket);
PosUpdate.SpawnID = Buffer.ReadUInt16();
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 low 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));
Updates.Add(PosUpdate);
}
return Updates;
}
示例13: 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;
}
}
}
示例14: ExploreSpawnDoor
public void ExploreSpawnDoor(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
{
uint DoorCount = Buffer.Length() / 96;
OutputStream.WriteLine("Door Count: {0}", DoorCount);
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();
OutputStream.WriteLine(" Name: {0} ID: {1} OT: {2} SAS: {3} IS: {4} DP: {5}",
DoorName, DoorID, OpenType, StateAtSpawn, InvertState, DoorParam);
// Skip past the trailing unknowns in the door struct, moving to the next door in the packet.
Buffer.SkipBytes(28);
}
}
示例15: ExploreMercenaryPurchaseWindow
public void ExploreMercenaryPurchaseWindow(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
{
UInt32 TypeCount = Buffer.ReadUInt32();
//OutputStream.WriteLine("Type Count: {0}\r\n", TypeCount);
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Number of Types (Journeyman and Apprentice in this case\r\n", TypeCount);
for (int i = 0; i < TypeCount; ++i)
{
UInt32 TypeDBStringID = Buffer.ReadUInt32();
//OutputStream.WriteLine(" Type {0} DBStringID {1}", i, TypeDBStringID);
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // DBStringID for Type {1}", TypeDBStringID, i);
}
UInt32 Count2 = Buffer.ReadUInt32();
//OutputStream.WriteLine(" Count 2 is {0}", Count2);
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Count of Sub-types that follow", Count2);
for (int i = 0; i < Count2; ++i)
{
int Offset = Buffer.GetPosition();
UInt32 Unknown1 = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown1);
UInt32 DBStringID1 = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // DBStringID of Type", DBStringID1);
UInt32 DBStringID2 = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // DBStringID of Sub-Type", DBStringID2);
UInt32 PurchaseCost = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Purchase Cost", PurchaseCost);
UInt32 UpkeepCost = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Upkeep Cost", UpkeepCost);
UInt32 Unknown2 = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown2);
UInt32 Unknown3 = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown3);
UInt32 Unknown4 = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown4);
byte Unknown5 = Buffer.ReadByte();
//OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint8, Buffer, {0}); // Unknown", Unknown5);
UInt32 Unknown6 = Buffer.ReadUInt32();
//OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown6);
UInt32 Unknown7 = Buffer.ReadUInt32();
//OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown7);
UInt32 Unknown8 = Buffer.ReadUInt32();
//OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown8);
UInt32 StanceCount = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Number of Stances for this Merc", StanceCount);
UInt32 Unknown10 = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown10);
byte Unknown11 = Buffer.ReadByte();
//OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint8, Buffer, {0}); // Unknown", Unknown11);
//OutputStream.WriteLine(" Offset: {5} Unknown1: {0} DBStrings: {1} {2} Purchase: {3} Upkeep: {4}\r\n", Unknown1, DBStringID1, DBStringID2,
// PurchaseCost, UpkeepCost, Offset);
//OutputStream.WriteLine(" Unknowns: {0} {1} {2} {3} {4} {5} {6} {7} {8}\r\n",
// Unknown2, Unknown3, Unknown4, Unknown5, Unknown6, Unknown7, Unknown8, Unknown10, Unknown11);
//OutputStream.WriteLine(" Stance Count: {0}", StanceCount);
for (int j = 0; j < StanceCount; ++j)
{
UInt32 StanceNum = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Stance Number", StanceNum);
UInt32 StanceType = Buffer.ReadUInt32();
OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Stance DBStringID (1 = Passive, 2 = Balanced etc.", StanceType);
//OutputStream.WriteLine(" {0}: {1}", StanceNum, StanceType);
}
OutputStream.WriteLine("");
}
OutputStream.WriteLine("\r\nBuffer position at end is {0}", Buffer.GetPosition());
OutputStream.WriteLine("");
}