public void Write(EndianBinaryWriter writer) { writer.WriteFixedString(Magic, 4); writer.Write(FileSize); writer.Write(Unknown1); writer.Write(DataOffset); writer.Write(Unknown2); writer.Write(Unknown3); writer.Write(Unknown4); writer.Write(Unknown5); writer.Write(NodeCount); writer.Write(Unknown6); writer.Write(Unknown7); writer.Write(FileEntriesOffset); writer.Write(Unknown8); writer.Write(StringTableOffset); writer.Write(FileEntryCount); writer.Write(UnknownBool1); writer.Write(Padding); writer.Write(Unknown10); }
public void ExportBMC(List<ByteColorAlpha> colorList, EndianBinaryWriter writer) { writer.WriteFixedString("MGCLbmc1", 8); writer.Write((int)34); writer.Write((int)1); for (int i = 0; i < 4; i++) { writer.Write((int)0); } writer.WriteFixedString("CLT1", 4); writer.Write((int)1056); writer.Write((short)256); writer.Write((short)0); foreach (ByteColorAlpha color in colorList) { writer.Write((byte)color.R); writer.Write((byte)color.G); writer.Write((byte)color.B); writer.Write((byte)color.A); } for (int i = 0; i < 5; i++) { writer.Write((int)0); } }
public void Write(EndianBinaryWriter writer) { writer.WriteFixedString(Type, 4); writer.Write(NameOffset); writer.Write(NameHash); writer.Write(FileEntryCount); writer.Write(FirstFileEntryIndex); }
public void Write(EndianBinaryWriter writer, EntityTemplate template) { if (template.BitField.Count > 0) { ProcessBitFields(template); } foreach (ElementProperty prop in Fields) { switch (prop.Type) { case FieldType.Byte: writer.Write((byte)prop.Data); break; case FieldType.Short: writer.Write((short)prop.Data); break; case FieldType.Integer: writer.Write((int)prop.Data); break; case FieldType.Float: writer.Write((float)prop.Data); break; case FieldType.Vector2: Vector2 vec2 = (Vector2)prop.Data; writer.Write((float)vec2.X); writer.Write((float)vec2.Y); break; case FieldType.Vector3: Vector3 vec3 = (Vector3)prop.Data; writer.Write((float)vec3.X); writer.Write((float)vec3.Y); writer.Write((float)vec3.Z); break; case FieldType.String: string name = (string)prop.Data; writer.WriteFixedString(name, 8); for (int i = 0; i < prop.Length - name.Length; i++) { writer.Write((byte)0); } break; case FieldType.ListByte: List<byte> byteList = (List<byte>)prop.Data; foreach (byte by in byteList) { writer.Write(by); } break; } } }
void Write(EndianBinaryWriter writer) { IEnumerable<IGrouping<string, Chunk>> query = Chunks.GroupBy(x => x.ChunkType, x => x); int numUniqueChunks = (int)query.Count<IGrouping<string, Chunk>>(); writer.Write(numUniqueChunks); foreach (IGrouping<string, Chunk> chunk in query) { writer.WriteFixedString(chunk.Key, 4); writer.Write((int)chunk.Count()); writer.Write((int)0); } for (int i = 0; i < numUniqueChunks; i++) { int offsetFieldOffset = (4 * (1 + i)) + (8 * (1 + i)); int currentWriterOffset = (int)writer.BaseStream.Position; writer.BaseStream.Position = offsetFieldOffset; writer.Write(currentWriterOffset); writer.BaseStream.Position = currentWriterOffset; foreach (Chunk chun in query.ElementAt(i)) { string chunkName = chun.ChunkType.Remove(chun.ChunkType.Length - 1); chun.Write(writer, ChunkTemplates.Find(x => x.ChunkID.Contains(chunkName))); } } }
public void WriteINF1Header(EndianBinaryWriter endianWriter, List<Message> exportList) { endianWriter.WriteFixedString((string)"INF1", 4); endianWriter.Write((int)((exportList.Count * 0x18) + 0x10 + 8)); endianWriter.Write((short)messageList.Count); endianWriter.Write((short)0x18); endianWriter.Write((int)0); }
public void WriteDAT1Header(EndianBinaryWriter endianWriter, List<Message> exportList) { uint newDat1Size = 0x09; foreach (Message mes in exportList) { newDat1Size += (uint)mes.charData.Count; } endianWriter.WriteFixedString("DAT1", 4); endianWriter.Write((uint)newDat1Size); endianWriter.Write((byte)0); }
public void WriteBMGHeader(EndianBinaryWriter endianWriter) { endianWriter.WriteFixedString((string)"MESGbmg1", 8); endianWriter.Write((int)0); endianWriter.Write((int)2); endianWriter.Write((int)0x1000000); endianWriter.Write((int)0); endianWriter.Write((int)0); endianWriter.Write((int)0); }