internal void Read(IBitReader reader) { reader.PushFrameLength(24); this._Unknown1 = reader.ReadUInt32(); // probably a primitive type { reader.PushFrameLength(24); reader.ReadBytes(this._Unknown2); reader.ReadBytes(this._Unknown3); reader.ReadBytes(this._Unknown4); reader.ReadBytes(this._Unknown5); this._Unknown6 = reader.ReadUInt32(); this._Unknown7 = reader.ReadUInt32(); // probably another primitive type { var unknown8Length = reader.ReadUInt32(); this._Unknown8 = reader.ReadBytes((int)unknown8Length); } reader.PopFrameLength(); } reader.PopFrameLength(); }
internal void Read(IBitReader reader) { reader.PushFrameLength(24); this._Unknown1.Clear(); var unknown1Count = reader.ReadUInt16(); for (int i = 0; i < unknown1Count; i++) { reader.PushFrameLength(24); var unknown1Key = reader.ReadUInt32(); var unknown1Value = reader.ReadBytes(16); reader.PopFrameLength(); this._Unknown1.Add(new KeyValuePair <uint, byte[]>(unknown1Key, unknown1Value)); } this._Unknown2.Clear(); var unknown2Count = reader.ReadUInt16(); for (int i = 0; i < unknown2Count; i++) { reader.PushFrameLength(24); var unknown2Key = reader.ReadUInt32(); var unknown2Value = reader.ReadBytes(16); reader.PopFrameLength(); this._Unknown2.Add(new KeyValuePair <uint, byte[]>(unknown2Key, unknown2Value)); } reader.PopFrameLength(); }
internal void Read(IBitReader reader) { reader.PushFrameLength(24); reader.ReadBytes(this._Unknown1); this._Unknown2 = reader.ReadUInt32(); this._Unknown3 = reader.ReadUInt32(); var unknown4Length = reader.ReadUInt32(); this._Unknown4 = reader.ReadBytes((int)unknown4Length); reader.PopFrameLength(); }
public override void Read(IBitReader reader, ushort version) { base.Read(reader, version); reader.ReadBytes(this._Unknown1); this._HeadId = reader.ReadUInt32(); this._Unknown2 = reader.ReadUInt32(); }
public byte[] Decode(IBitReader reader) { byte num = (byte)((ulong)reader.BaseStream.Length / 8UL); reader.ReadByte(); return(reader.ReadBytes(num - 2)); }
public override void Read(IBitReader reader, ushort version) { base.Read(reader, version); this._LayoutSignature = reader.ReadUInt32(); var packedDataLength = reader.ReadUInt32(); this._PackedData = reader.ReadBytes((int)packedDataLength); }
internal void Read(IBitReader reader) { reader.PushFrameLength(24); reader.ReadBytes(this._Unknown1); this._Unknown2 = reader.ReadUInt8(); this._Unknown3 = reader.ReadUInt8(); this._Unknown4 = reader.ReadFunkyValue(); reader.PopFrameLength(); }
internal void Read(IBitReader reader) { reader.PushFrameLength(24); this._Unknown1 = reader.ReadUInt32(); this._Unknown2 = reader.ReadBoolean(); this._Unknown3 = reader.ReadUInt32(); // TODO(gibbed): figure out what this actually this._Unknown4 = reader.ReadBytes(Math.Max(1, (int)((this._Unknown3 + 31) >> 5)) * 4); reader.PopFrameLength(); }
internal void Read(IBitReader reader, uint version) { reader.PushFrameLength(24); var dataBytesLength = reader.ReadUInt32(); this._DataBytes = reader.ReadBytes((int)dataBytesLength); this._Unknown1 = version >= 6 && reader.ReadBoolean(); this._Unknown2 = version >= 6 && reader.ReadBoolean(); reader.PopFrameLength(); }
private D2S(IBitReader reader) { Header = Header.Read(reader); ActiveWeapon = reader.ReadUInt32(); Name = reader.ReadString(16); Status = Status.Read(reader.ReadByte()); Progression = reader.ReadByte(); Unk0x0026 = reader.ReadBytes(2); ClassId = reader.ReadByte(); Unk0x0029 = reader.ReadBytes(2); Level = reader.ReadByte(); Created = reader.ReadUInt32(); LastPlayed = reader.ReadUInt32(); Unk0x0034 = reader.ReadBytes(4); AssignedSkills = Enumerable.Range(0, 16).Select(_ => Skill.Read(reader)).ToArray(); LeftSkill = Skill.Read(reader); RightSkill = Skill.Read(reader); LeftSwapSkill = Skill.Read(reader); RightSwapSkill = Skill.Read(reader); Appearances = Appearances.Read(reader); Location = Locations.Read(reader); MapId = reader.ReadUInt32(); Unk0x00af = reader.ReadBytes(2); Mercenary = Mercenary.Read(reader); RealmData = reader.ReadBytes(140); Quests = QuestsSection.Read(reader); Waypoints = WaypointsSection.Read(reader); NPCDialog = NPCDialogSection.Read(reader); Attributes = Attributes.Read(reader); ClassSkills = ClassSkills.Read(reader, ClassId); PlayerItemList = ItemList.Read(reader, Header.Version); PlayerCorpses = CorpseList.Read(reader, Header.Version); if (Status.IsExpansion) { MercenaryItemList = MercenaryItemList.Read(reader, Mercenary, Header.Version); Golem = Golem.Read(reader, Header.Version); } }
public byte[] Decode(IBitReader reader) { ushort num1 = reader != null?reader.ReadUInt16() : throw new ArgumentNullException(nameof(reader)); byte[] buffer = num1 <= 1020 ? reader.ReadBytes(num1) : throw new InvalidOperationException(string.Format("The packet length must not be larger than 1020 bytes (it is: " + num1 + ").")); ushort num2 = reader.ReadUInt16(); int num3 = CRC.FMPro3.CalcCrc16(buffer); if (num2 != num3) { throw new InvalidOperationException(string.Format("The CRC check failed expected: 0x{0:X4}, actual 0x{1:X4}", num2, num3)); } return(buffer); }
internal void Read(IBitReader reader) { reader.PushFrameLength(24); reader.ReadBytes(this._Unknown1); this._Unknown2.Clear(); var unknown2Count = reader.ReadUInt16(); for (int i = 0; i < unknown2Count; i++) { var unknown2 = new WorldMapUnknown1(); unknown2.Read(reader); this._Unknown2.Add(unknown2); } reader.PopFrameLength(); }
internal override void Read4(IBitReader reader) { base.Read4(reader); var unknown1Count = reader.ReadUInt16(); this._Unknown.Clear(); for (int i = 0; i < unknown1Count; i++) { reader.PushFrameLength(24); var unknown1Key = reader.ReadUInt32(); var unknown1ValueLength = reader.ReadUInt32(); var unknown1Value = reader.ReadBytes((int)unknown1ValueLength); reader.PopFrameLength(); this._Unknown.Add(new KeyValuePair <uint, byte[]>(unknown1Key, unknown1Value)); } }
public Command Decode(IBitReader reader) { byte num = reader != null?reader.ReadByte() : throw new ArgumentNullException(nameof(reader)); Command command; if (CommandIdToType.ContainsKey(num)) { command = ((Command)Activator.CreateInstance(CommandIdToType[num])).Decode(num, reader); } else { command = new Command(num); int count = reader.ReadInt32(); command.Data = reader.ReadBytes(count); } return(command); }
public static NPCDialogSection Read(IBitReader reader) { var npcDialogSection = new NPCDialogSection { Header = reader.ReadUInt16(), Length = reader.ReadUInt16() }; Span <byte> bytes = stackalloc byte[0x30]; reader.ReadBytes(bytes); using var bits = new InternalBitArray(bytes); for (int i = 0; i < npcDialogSection._difficulties.Length; i++) { npcDialogSection._difficulties[i] = NPCDialogDifficulty.Read(bits); } return(npcDialogSection); }
public AvlData Decode(IBitReader reader) { byte num = reader != null?reader.ReadByte() : throw new ArgumentNullException(nameof(reader)); byte[] buffer = reader.ReadBytes(num); if (reader.ReadByte() != CRC.CalculateXor(buffer)) { throw new Exception("AvlData Record CRC failure. Received CRC - {0}, calculated CRC - {1}."); } using (MemoryStream stream = new MemoryStream()) { using (IBitReader suitableBitReader = stream.CreateSuitableBitReader()) { stream.Write(buffer, 0, num); stream.Position = 0L; long timestamp = suitableBitReader.ReadUInt32() * 1000L; AvlDataPriority priority = (AvlDataPriority)suitableBitReader.ReadByte(); GpsElement gps = DefaultGpsElementEncoding.Instance.Decode(suitableBitReader); IoElement data = DefaultIOElementEncoding.Instance.Decode(suitableBitReader); DateTime dateTime = DateTimeExt.FromAvl(timestamp); return(new AvlData(priority, dateTime, gps, data)); } } }
public override void Read(IBitReader reader, ushort version) { base.Read(reader, version); this._Unknown1 = reader.ReadGuid(); this._Unknown2 = reader.ReadGuid(); var sliderCount = reader.ReadUInt32(); var sliderGuids = new Guid[sliderCount]; for (uint i = 0; i < sliderCount; i++) { sliderGuids[i] = reader.ReadGuid(); } var sliderValues = new float[sliderCount]; for (uint i = 0; i < sliderCount; i++) { sliderValues[i] = reader.ReadFloat32(); } this._SliderValues.Clear(); for (uint i = 0; i < sliderCount; i++) { var instance = new SliderData(); instance.Guid = sliderGuids[i]; instance.Value = sliderValues[i]; this._SliderValues.Add(instance); } this._Unknown4 = reader.ReadUInt8(); this._HeadTextureId = version < 4 ? 0 : reader.ReadUInt32(); var unknown5Count = reader.ReadUInt32(); this._Unknown5.Clear(); for (uint i = 0; i < unknown5Count; i++) { this._Unknown5.Add(reader.ReadUInt32()); } var unknown6Count = reader.ReadUInt32(); this._Unknown6.Clear(); for (uint i = 0; i < unknown6Count; i++) { this._Unknown6.Add(reader.ReadUInt32()); } var unknown7Count = reader.ReadUInt32(); this._Unknown7.Clear(); for (uint i = 0; i < unknown7Count; i++) { this._Unknown7.Add(reader.ReadVector3()); } var boneCount = reader.ReadUInt32(); this._Bones.Clear(); for (uint i = 0; i < boneCount; i++) { this._Bones.Add(reader.ReadBytes(12)); } }