예제 #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);
 }