Ejemplo n.º 1
0
        private DataCenterRegion ReadRegion(int length, int paddedLength, int elementSize)
        {
            var result = new DataCenterRegion(BaseStream.Position, length, paddedLength, elementSize);

            BaseStream.Position += paddedLength;
            return(result);
        }
Ejemplo n.º 2
0
 private Stream GetStreamForRegion(DataCenterRegion region)
 {
     _buffer.SetLength(0);
     _buffer.Position = 0;
     new StreamSlice(_stream, region.Start, region.Length).CopyTo(_buffer);
     _buffer.Position = 0;
     return(_buffer);
 }
        public List <string> PrintLegacyRegions()
        {
            var list = new List <string>();
            Action <string, long, long> printRegion = (name, start, end) => list.Add(string.Format("\"{0}\", {1:X8}, {2:X8}", name, start, end));

            printRegion("data.dec", DataCenterRegion.Combine(Values).Start, DataCenterRegion.Combine(Values).PaddedEnd);
            printRegion("structs.dec", DataCenterRegion.Combine(Elements).Start + 16, DataCenterRegion.Combine(Elements).PaddedEnd);//old parser doesn't handle the root element correctly
            printRegion("strings.dec", DataCenterRegion.Combine(Strings).Start, DataCenterRegion.Combine(Strings).End);
            printRegion("strings_id.dec", StringIds.Start, StringIds.PaddedEnd);
            printRegion("args_id.dec", NameIds.Start, NameIds.PaddedEnd);
            printRegion("args.dec", DataCenterRegion.Combine(Names).Start, DataCenterRegion.Combine(Names).End);
            return(list);
        }
Ejemplo n.º 4
0
 private List <T> ReadAll <T>(DataCenterRegion region, Func <TeraDataReader, T> readOne)
 {
     return(TeraDataReader.ReadAll(GetStreamForRegion(region), readOne).ToList());
 }
Ejemplo n.º 5
0
 private DataCenterRegion ReadRegion(int length, int paddedLength, int elementSize)
 {
     var result = new DataCenterRegion(BaseStream.Position, length, paddedLength, elementSize);
     BaseStream.Position += paddedLength;
     return result;
 }