Ejemplo n.º 1
0
 private void ReadHeader()
 {
     using (var reader = new TeraDataReader(_stream))
     {
         _stream.Position = 0x0C;
         Revision         = reader.ReadInt32();
     }
 }
Ejemplo n.º 2
0
 public static IEnumerable <T> ReadAll <T>(Stream stream, Func <TeraDataReader, T> readOne)
 {
     using (var reader = new TeraDataReader(stream))
     {
         while (reader.BaseStream.Position < reader.BaseStream.Length)
         {
             yield return(readOne(reader));
         }
         if (reader.BaseStream.Position > reader.BaseStream.Length)
         {
             throw new Exception("Read beyond the end");
         }
     }
 }
Ejemplo n.º 3
0
 private List <KeyValuePair <SegmentAddress, T> > ReadSegmented <T>(IEnumerable <DataCenterRegion> regions, Func <TeraDataReader, T> readOne)
 {
     return(Flatten(regions.Select(region => ReadAll(region, TeraDataReader.WithOffset(readOne, region.ElementSize)))));
 }
Ejemplo n.º 4
0
 private List <T> ReadAll <T>(DataCenterRegion region, Func <TeraDataReader, T> readOne)
 {
     return(TeraDataReader.ReadAll(GetStreamForRegion(region), readOne).ToList());
 }