コード例 #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);
 }