public void WriteChunkString(ChunkId chunkID, string value) { byte[] data = Encoding.UTF8.GetBytes(value); chunkID.ToStream(_writer); LEB128.Write(_writer, data.Length); _writer.Write(data); }
public void Dispose() { // Update chunk size long newPosition = _chunkWriter._writer.Position; long chunkSize = newPosition - _previousPosition; _chunkWriter._writer.Position = _chunkSizePosition; LEB128.Write(_chunkWriter._writer, chunkSize, _maximumSize); _chunkWriter._writer.Position = newPosition; }
public ChunkWritingState(ChunkWriter chunkWriter, ChunkId chunkID, long maximumSize) { _chunkWriter = chunkWriter; // Write chunk ID chunkID.ToStream(chunkWriter._writer); // Write chunk size _chunkSizePosition = chunkWriter._writer.Position; LEB128.Write(chunkWriter._writer, 0, maximumSize); // Prepare for writeing chunk content _previousPosition = chunkWriter._writer.Position; _maximumSize = maximumSize; }
public void WriteChunkInt(int chunkID, long value) { _writer.Write((int)chunkID); _writer.Write((long)8); LEB128.Write(_writer, value); }
public void ToStream(BinaryWriterFast stream) { LEB128.Write(stream, _idLength); stream.Write(_idBytes, 0, _idLength); }
public void WriteChunkVector4(ChunkId chunkID, Vector4 value) { chunkID.ToStream(_writer); LEB128.Write(_writer, 16); _writer.Write(value); }
public void WriteChunkFloat(ChunkId chunkID, double value) { chunkID.ToStream(_writer); LEB128.Write(_writer, 8); _writer.Write(value); }
public void WriteChunkInt(ChunkId chunkID, long value) { chunkID.ToStream(_writer); LEB128.Write(_writer, LEB128.GetLength(_writer, value)); LEB128.Write(_writer, value); }
public void WriteChunkArrayOfBytes(ChunkId chunkID, byte[] value) { chunkID.ToStream(_writer); LEB128.Write(_writer, value.Length); _writer.Write(value); }
public void WriteChunkBool(ChunkId chunkID, bool value) { chunkID.ToStream(_writer); LEB128.Write(_writer, 1); _writer.Write(value); }
public void WriteChunkEmpty(ChunkId chunkID) { chunkID.ToStream(_writer); LEB128.Write(_writer, 0); }