Пример #1
0
 public void WriteChunkString(ChunkId chunkID, string value)
 {
     byte[] data = Encoding.UTF8.GetBytes(value);
     chunkID.ToStream(_writer);
     LEB128.Write(_writer, data.Length);
     _writer.Write(data);
 }
Пример #2
0
            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;
            }
Пример #3
0
            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;
            }
Пример #4
0
 public void WriteChunkInt(int chunkID, long value)
 {
     _writer.Write((int)chunkID);
     _writer.Write((long)8);
     LEB128.Write(_writer, value);
 }
Пример #5
0
 public void ToStream(BinaryWriterFast stream)
 {
     LEB128.Write(stream, _idLength);
     stream.Write(_idBytes, 0, _idLength);
 }
Пример #6
0
 public void WriteChunkVector4(ChunkId chunkID, Vector4 value)
 {
     chunkID.ToStream(_writer);
     LEB128.Write(_writer, 16);
     _writer.Write(value);
 }
Пример #7
0
 public void WriteChunkFloat(ChunkId chunkID, double value)
 {
     chunkID.ToStream(_writer);
     LEB128.Write(_writer, 8);
     _writer.Write(value);
 }
Пример #8
0
 public void WriteChunkInt(ChunkId chunkID, long value)
 {
     chunkID.ToStream(_writer);
     LEB128.Write(_writer, LEB128.GetLength(_writer, value));
     LEB128.Write(_writer, value);
 }
Пример #9
0
 public void WriteChunkArrayOfBytes(ChunkId chunkID, byte[] value)
 {
     chunkID.ToStream(_writer);
     LEB128.Write(_writer, value.Length);
     _writer.Write(value);
 }
Пример #10
0
 public void WriteChunkBool(ChunkId chunkID, bool value)
 {
     chunkID.ToStream(_writer);
     LEB128.Write(_writer, 1);
     _writer.Write(value);
 }
Пример #11
0
 public void WriteChunkEmpty(ChunkId chunkID)
 {
     chunkID.ToStream(_writer);
     LEB128.Write(_writer, 0);
 }