public void SerializeShort(BinaryWriterExt writer) { writer.Write(Id); writer.Write(MarkId); writer.WriteUnicodeStatic(Name, 14); writer.Write((ushort)0); // NLevel? }
/// <summary> /// writes quantanized value to stream /// </summary> /// <param name="d"></param> /// <param name="Value"></param> public void WriteValue(BinaryWriterExt d, float Value) { if (!Quantanized) { Quantanize(); } switch (ValueType) { case GXAnimDataFormat.HSD_A_FRAC_FLOAT: d.Write(Value * ValueScale); break; case GXAnimDataFormat.HSD_A_FRAC_S16: d.Write((short)(Quantanize(Value, ValueType, ValueScale))); break; case GXAnimDataFormat.HSD_A_FRAC_U16: d.Write((ushort)(Quantanize(Value, ValueType, ValueScale))); break; case GXAnimDataFormat.HSD_A_FRAC_S8: d.Write((sbyte)(Quantanize(Value, ValueType, ValueScale))); break; case GXAnimDataFormat.HSD_A_FRAC_U8: d.Write((byte)(Quantanize(Value, ValueType, ValueScale))); break; default: throw new Exception("Unknown GXAnimDataFormat " + ValueType.ToString()); } }
public void Write(BinaryWriterExt writer) { writer.Write((int)dxgiFormat); writer.Write((int)resourceDimension); writer.Write(miscFlag); writer.Write(arraySize); writer.Write(miscFlags2); }
public override void Write(BinaryWriterExt writer) { base.Write(writer); writer.Write((byte)1); writer.Write(X); writer.Write(Y); }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(262144); // First packet, 262145 would be 2nd, 3rd etc. bs.Write(InventoryItems.Length); foreach (var item in InventoryItems) { bs.Write(item); } } return(ms.ToArray()); } /* * var ack = new Packet(Packets.ItemListAck); * ack.Writer.Write( * (uint) 0x40000); // WHAT THE? unsigned int ListUpdate; <-- Multiple pages -> Multiple packets * //ack.Writer.Write((uint)0); // Count * ack.Writer.Write((uint) 1); // Count * // 52 bytes of data for each item * * ack.Writer.Write((uint) 4); // CarID * ack.Writer.Write((ushort) 0); // State // (0 = Inventory, 1 = Equip, 4 = Auction) * ack.Writer.Write((ushort) 1); // Slot * ack.Writer.Write((uint) 1); // StateVar * ack.Writer.Write(1); // StackNum * ack.Writer.Write(0); // Random * * ack.Writer.Write((uint) 0); // AssistA * ack.Writer.Write((uint) 0); // AssistB * ack.Writer.Write((uint) 0); // Box // 255 = drop rate 5.7??? * ack.Writer.Write((uint) 0); // Belonging (0 = , 1 = equip, 2 = get) * ack.Writer.Write(0); // Upgrade * ack.Writer.Write(0); // UpgradePoint * ack.Writer.Write((uint) 0); // ExpireTick * ack.Writer.Write((uint) 1); // TableIdx * ack.Writer.Write((uint) 0); // InvenIdx * ack.Writer.Write((uint) 0); // Is upgrade pack?? * ack.Writer.Write((uint) 0); // Tradeable? * //ack.Writer.Write(new byte[46]); // 94 * * /* Pulled from Rice: * byte[] testItem = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x91, 0x00, 0x00, 0x00, 0x00, 0x80, 0xBF, * 0x00, 0x00, 0x00, 0x00, 0xD9, 0x04, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; * var ack = new RicePacket(401); * ack.Writer.Write(262144); // ListUpdate (262144 = First packet from list queue, 262145 = sequential) * ack.Writer.Write(1); // ItemNum * ack.Writer.Write(testItem); // Null Item (96 bytes per XiStrMyItem) * packet.Sender.Send(ack); */ }
public override void Write(BinaryWriterExt writer) { base.Write(writer); writer.Write((byte)1); writer.Write(ID); Shape.Write(writer); }
private void SaveAndWriteTdf(string fileName) { /*_tdfFile.Header.Col = (uint) listView1.Columns.Count; * _tdfFile.Header.Row = (uint) listView1.Items.Count; * //tdfFile.Header.Offset = tdfFile.Header.Col * tdfFile.Header.Row;*/ //_tdfFile.DataTable = new int[_tdfFile.Header.Col * _tdfFile.Header.Row]; if (changeDateToolStripMenuItem.Checked) { _tdfFile.Header.Date.Day = (char)DateTime.Now.Day; _tdfFile.Header.Date.Month = (char)DateTime.Now.Month; _tdfFile.Header.Date.Year = (ushort)DateTime.Now.Year; } if (increaseVersionToolStripMenuItem.Checked) { if (_tdfFile.Version.Minor < 9) { _tdfFile.Version.Minor++; } else { _tdfFile.Version.Major++; _tdfFile.Version.Minor = 0; } } var columns = (int)_tdfFile.Header.Col; var rows = (int)_tdfFile.Header.Row; var offset = (int)_tdfFile.Header.Offset; //var size = offset + (columns * 4 * rows + 24); var size = offset - (columns * 4 * rows + 24); _tdfFile.ResTable = new byte[size]; // Each column has only 4 bytes? using (var writer = new BinaryWriterExt(new MemoryStream(_tdfFile.ResTable))) { for (var row = 0; row < _tdfFile.Header.Row; row++) { for (var col = 1; col < _tdfFile.Header.Col + 1; col++) { var colText = listView1.Items[row].SubItems[col].Text; foreach (var c in colText) { Debug.WriteLineIf(row == 0, "Writing char: " + c); writer.Write(Encoding.ASCII.GetBytes(new[] { c })); writer.Write((byte)0); } writer.Write(new byte[2]); } } } _tdfFile.Save(fileName); }
public override void Write(BinaryWriterExt writer) { base.Write(writer); writer.Write((byte)1); writer.Write(Position.X); writer.Write(Position.Y); writer.Write(Angle); writer.Write(LineIndex); }
public override void Write(BinaryWriterExt writer) { base.Write(writer); writer.Write((byte)1); writer.Write(Left); writer.Write(Right); writer.Write(Top); writer.Write(Bottom); }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(Result); bs.Write(Permission); } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(GlobalTime); bs.Write(SystemTick); } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(TableIndex); bs.Write(FailNum); } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(Hancoins); // Hancoins? bs.Write(Mileage); // Mileage? } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(CarId); bs.Write(SellPrice); } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(Time); bs.Write(Signal); bs.Write(State); } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.WriteUnicodeStatic(CharacterName, 21); bs.Write(CharacterId); bs.Write(ActiveVehicleId); } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(Result); bs.Write(CityId); bs.WriteAsciiStatic(Post1, 255); bs.WriteAsciiStatic(Post2, 255); } return(ms.ToArray()); } }
/* * struct XiPlayerInfo * { * wchar_t Cname[13]; * unsigned __int16 Serial; * unsigned __int16 Age; * __unaligned __declspec(align(1)) __int64 Cid; * unsigned __int16 Level; * unsigned int Exp; * __unaligned __declspec(align(1)) __int64 TeamId; * __unaligned __declspec(align(1)) __int64 TeamMarkId; * wchar_t TeamName[14]; * unsigned __int16 TeamNLevel; * XiVisualItem VisualItem; * float UseTime; * }; */ /// <summary> /// 216 length but 150 bytes used! /// Leaked files has 156 bytes :/ /// </summary> /// <param name="writer"></param> public void Serialize(BinaryWriterExt writer) { writer.WriteUnicodeStatic(Character.Name, 13, true); // 26 writer.Write(Serial); // 2 writer.Write(Age); // 2 writer.Write(Character.Id); // 8 writer.Write(Character.Level); // 2 writer.Write(Character.ExperienceInfo.BaseExp); // 4 //writer.Write(Character.TeamId); // 8 if (Character.Crew == null) { new Crew().SerializeShort(writer); } else { Character.Crew.SerializeShort(writer); /* * writer.Write(Character.Team.MarkId); // 8 * writer.WriteUnicodeStatic(Character.Team.Name, 14, true); * writer.Write(TeamNLevel); // 2 */ } writer.Write(VisualItem); // 50? writer.Write(UseTime); // 4 writer.Write(new byte[60]); //writer.Write(new byte[186]); }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(TableIndex); bs.Write(Quantity); bs.Write(Money); bs.Write(Slot); } return(ms.ToArray()); } }
/// <summary> /// 00000002 TableIdx dd ? /// 00000006 field_2 dd ? /// 0000000A field_3 db ? /// </summary> /// <returns></returns> public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(TableIndex); // int // char bs.Write(new byte[3]); // Missing? } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(Serial); bs.Write(Age); bs.Write(CarId); CarInfo.Serialize(bs); } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(Items.Length); foreach (var item in Items) { bs.Write(item); } } return(ms.ToArray()); } }
public void Serialize(BinaryWriterExt writer) { writer.Write(Speed); writer.Write(Crash); writer.Write(Accel); writer.Write(Boost); writer.Write(AddSpeed); writer.Write(Drop); writer.Write(Exp); writer.Write(MitronCapacity); writer.Write(MitronEfficiency); }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(PlayerInfos.Length + 1); bs.Write(PlayerInfo); foreach (var playerInfo in PlayerInfos) { bs.Write(playerInfo); } } return(ms.ToArray()); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(AreaId); bs.Write(1); // Result bs.Write(LocalTime); bs.Write(Environment.TickCount); //bs.Write(new byte[6]); bs.Write(new byte[4]); } return(ms.ToArray()); } }
public Packet(ushort id) { Writer = new BinaryWriterExt(new MemoryStream()); Id = id; Writer.Write(id); }
public void Serialize(BinaryWriterExt writer) { writer.Write(PrimarySlot); writer.Write((byte)Characters.Count); writer.Write((byte)Inventory.Count); foreach (var character in Characters) { writer.Write(character); } foreach (var invItem in Inventory) { writer.Write(invItem); } }
public override byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var bs = new BinaryWriterExt(ms)) { bs.Write(City); bs.Write(LastChannel); bs.Write(Position); bs.Write(PositionState); // Rice sends an extra byte for some reason?? //ack.Writer.Write((byte)0); } return(ms.ToArray()); } }
public void Serialize(BinaryWriterExt writer) { writer.Write(ExpirationTime); writer.Write(CharAcCode); writer.Write(TattooCode); writer.Write(SaleType); writer.Write(ProtectionItemId); writer.Write(SurvivalItemId); writer.Write(TacticalItemId); writer.Write(TrainingItemId); writer.Write(CTSItemId); }
/// <summary> /// Writes the packet to a byte-array /// </summary> /// <returns>The packet in byte array</returns> public byte[] GetBytes() { using (var ms = new MemoryStream()) { using (var writer = new BinaryWriterExt(ms)) { var bodyBytes = Encoding.ASCII.GetBytes(Payload + '\0'); writer.WriteLittleEndian(bodyBytes.Length + 9); writer.WriteLittleEndian(Id); writer.WriteLittleEndian((int)Type); writer.Write(bodyBytes); writer.Write('\0'); return(ms.ToArray()); } } }