public void Write(ChunkWriter writer) { ulong infoChunkLength = (ulong)((2U * 4U) + 4U + ((Name != null) ? Encoding.BigEndianUnicode.GetByteCount(Name) : 0)); ulong total = 16U + infoChunkLength; if (Elements != null) { foreach (GfxElement element in Elements) { total += element.ChunkSize(); } } if (ImportMetadata != null) { total += ImportMetadata.ChunkSize(); } writer.OpenChunk(ChunkType.GfxElementSet, total); writer.OpenChunk(ChunkType.GfxElementSetInfo, infoChunkLength); writer.Write(ElementWidth); writer.Write(ElementHeight); writer.Write(Name); writer.CloseChunk(); if (Elements != null) { foreach (GfxElement element in Elements) { element.Write(writer); } } if (ImportMetadata != null) { ImportMetadata.Write(writer); } writer.CloseChunk(); }
public void Write(ChunkWriter writer) { writer.OpenChunk(ChunkType.GfxElement, 8U + (4U * Width * Height)); writer.Write(Width); writer.Write(Height); for (uint pixel = 0; pixel < (Width * Height); pixel++) { writer.Write(Pixels[pixel]); } writer.CloseChunk(); }
public void Write(ChunkWriter writer) { writer.OpenChunk(ChunkType.TileViewerState, 19); writer.Write(Location.X); writer.Write(Location.Y); writer.Write(Size.Width); writer.Write(Size.Height); writer.Write((byte)Scale.Width); writer.Write((byte)Scale.Height); writer.Write((byte)((Rotate & 0x03U) | (FlipX ? 0x04U : 0x00U) | (FlipY ? 0x08U : 0x00U))); writer.CloseChunk(); }
public void Save(string path) { ChunkWriter writer = new ChunkWriter(new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write)); using (writer) { writer.OpenChunk(ChunkType.ProjectHeader, 0U); // Write project header writer.CloseChunk(); writer.StartCompression(); if ((mGfxSet != null) && ((mGfxSet.Elements != null) || (mGfxSet.ImportMetadata != null))) // Write everything else in this project { mGfxSet.Write(writer); } } mDirty = false; mFilePath = path; mDisplayName = Path.GetFileName(path); }
public void Write(ChunkWriter writer) { writer.OpenChunk(ChunkType.TileImportMetadata, ChunkContentLength()); writer.Write(ProfileFile); writer.Write(ProfileName); writer.Write(RegionName); writer.Write(LayoutName); writer.Write(Offset); writer.Write(Planes); writer.Write(RomFilenames.Length); // file path count foreach (String fileName in RomFilenames) { writer.Write(fileName); } writer.CloseChunk(); }