Beispiel #1
0
 private void FillChunkBytes(ChunkImpl chunk)
 {
     if (chunk.SubchunksCount == 0)
     {
         chunk.SetChunkBytes(ReadBytes(chunk.ChunkContentPointer, chunk.ContentSize));
     }
 }
Beispiel #2
0
 public byte[] ReadChunkBytes(ChunkImpl chunk, long offset, long length)
 {
     if (length == -1)
     {
         length = chunk.ContentSize - offset;
     }
     return(ReadBytes(chunk.ChunkContentPointer + offset, length));
 }
Beispiel #3
0
        public void FillChunk(Chunk chunk)
        {
            ChunkImpl derivedChunk = chunk as ChunkImpl;

            FillSubchunks(derivedChunk);
            FillChunkBytes(derivedChunk);
            derivedChunk.IsAvaliable = true;
        }
Beispiel #4
0
        private ChunkImpl AllocateChunk(long chunkPointer)
        {
            ChunkImpl retChunk = new ChunkImpl(this);

            retChunk.ChunkStartPointer = chunkPointer;
            FillChunkTag(retChunk);
            FillChunkSize(retChunk);
            return(retChunk);
        }
Beispiel #5
0
 public void AddSubchunk(ChunkImpl chunk)
 {
     if (!subChunks.ContainsKey(chunk.tag))
     {
         subChunks.Add(chunk.tag, new List <Chunk>(new ChunkImpl[] { chunk }));
     }
     else
     {
         subChunks[chunk.tag].Add(chunk);
     }
 }
Beispiel #6
0
 private void FillSubchunks(ChunkImpl chunk)
 {
     FillSubchunksCount(chunk);
     byte[] subchunkPointerBytes = ReadBytes(chunk.SubchunkPointersPointer, chunk.SubchunkPointerArraySize);
     for (int iSubchunk = 0; iSubchunk < chunk.SubchunksCount; ++iSubchunk)
     {
         long      chunkPointer = BigEndianBytesToInt64(subchunkPointerBytes, (int)(iSubchunk * ChunkImpl.ChunkPointerSize));
         ChunkImpl subchunk     = AllocateChunk(chunkPointer);
         chunk.AddSubchunk(subchunk);
     }
 }
Beispiel #7
0
 public void AddSubchunk(ChunkImpl chunk)
 {
     if (!subChunks.ContainsKey(chunk.tag)) {
         subChunks.Add(chunk.tag, new List<Chunk>(new ChunkImpl[] { chunk }));
     } else {
         subChunks[chunk.tag].Add(chunk);
     }
 }
Beispiel #8
0
 private void FillSubchunksCount(ChunkImpl chunk)
 {
     chunk.SubchunksCount = BigEndianBytesToInt32(ReadBytes(chunk.SubchunksCountPointer, ChunkImpl.SubchunksCountSize), 0);
 }
Beispiel #9
0
 private void FillChunkTag(ChunkImpl chunk)
 {
     chunk.SetTag(BytesToString(ReadBytes(chunk.ChunkTagPointer, ChunkImpl.TagSize)));
 }
Beispiel #10
0
 private void FillChunkSize(ChunkImpl chunk)
 {
     chunk.ChunkSize = BigEndianBytesToInt64(ReadBytes(chunk.ChunkSizePointer, ChunkImpl.ChunkSizeSize), 0);
 }
Beispiel #11
0
 private void FillChunkBytes(ChunkImpl chunk)
 {
     if (chunk.SubchunksCount == 0) {
         chunk.SetChunkBytes( ReadBytes(chunk.ChunkContentPointer, chunk.ContentSize) );
     }
 }
Beispiel #12
0
 private ChunkImpl AllocateChunk(long chunkPointer)
 {
     ChunkImpl retChunk = new ChunkImpl(this);
     retChunk.ChunkStartPointer = chunkPointer;
     FillChunkTag(retChunk);
     FillChunkSize(retChunk);
     return retChunk;
 }
Beispiel #13
0
 private void FillChunkSize(ChunkImpl chunk)
 {
     chunk.ChunkSize = BigEndianBytesToInt64(ReadBytes(chunk.ChunkSizePointer, ChunkImpl.ChunkSizeSize), 0);
 }
Beispiel #14
0
 public byte[] ReadChunkBytes(ChunkImpl chunk, long offset, long length)
 {
     if (length == -1) {
         length = chunk.ContentSize - offset;
     }
     return ReadBytes(chunk.ChunkContentPointer + offset, length);
 }
Beispiel #15
0
 private void FillSubchunksCount(ChunkImpl chunk)
 {
     chunk.SubchunksCount = BigEndianBytesToInt32(ReadBytes(chunk.SubchunksCountPointer, ChunkImpl.SubchunksCountSize), 0);
 }
Beispiel #16
0
 private void FillSubchunks(ChunkImpl chunk)
 {
     FillSubchunksCount(chunk);
     byte[] subchunkPointerBytes = ReadBytes(chunk.SubchunkPointersPointer, chunk.SubchunkPointerArraySize);
     for (int iSubchunk = 0; iSubchunk < chunk.SubchunksCount; ++iSubchunk) {
         long chunkPointer = BigEndianBytesToInt64( subchunkPointerBytes, (int)(iSubchunk * ChunkImpl.ChunkPointerSize) );
         ChunkImpl subchunk = AllocateChunk(chunkPointer);
         chunk.AddSubchunk(subchunk);
     }
 }
Beispiel #17
0
 private void FillChunkTag(ChunkImpl chunk)
 {
     chunk.SetTag(BytesToString(ReadBytes(chunk.ChunkTagPointer, ChunkImpl.TagSize)));
 }