public static DataCenterRegions Load(string filename)
 {
     using (var stream = File.OpenRead(filename))
     {
         return(RegionListReader.ReadAllRegions(stream));
     }
 }
Exemple #2
0
 public static DataCenterRegions ReadAllRegions(Stream stream)
 {
     using (var reader = new RegionListReader(stream))
     {
         return(reader.ReadDataCenter());
     }
 }
        internal DataCenterRaw(Stream stream)
        {
            _stream = stream;
            Console.WriteLine("Reading regions... ");
            Regions = RegionListReader.ReadAllRegions(stream);
            Console.WriteLine("Reading header... ");
            ReadHeader();
            Console.WriteLine("Reading strings... ");
            Strings = ReadSegmented(Regions.Strings, r => r.ReadTeraString());
            Console.WriteLine("Reading values... ");
            Values = ReadSegmented(Regions.Values, r => r.ReadDcValue());
            Console.WriteLine("Reading string IDs... ");
            StringIds = ReadAll(Regions.StringIds, r => r.ReadSegmentAddress());
            Console.WriteLine("Reading string unks... ");
            StringUnknown = ReadSegmented(Regions.Unknown1, r => r.ReadUnknown());
            Console.WriteLine("Reading names... ");
            Names = ReadSegmented(Regions.Names, r => r.ReadTeraString());
            Console.WriteLine("Reading name IDs... ");
            NameIds = ReadAll(Regions.NameIds, r => r.ReadSegmentAddress());
            Console.WriteLine("Reading name unks... ");
            NameUnknown = ReadSegmented(Regions.Unknown1, r => r.ReadUnknown());
            Console.WriteLine("Reading elements... ");
            Elements = ReadSegmented(Regions.Elements, r => r.ReadDcObject());

            AssertSequenceEquals(Strings.Select(x => x.Key), StringIds);
            AssertSequenceEquals(Names.Select(x => x.Key), NameIds);

            _buffer = null;
            _stream = null;
            Console.WriteLine("Done creating DataCenterRaw");
        }
Exemple #4
0
        internal DataCenterRaw(Stream stream)
        {
            _stream = stream;
            Regions = RegionListReader.ReadAllRegions(stream);

            ReadHeader();
            Strings       = ReadSegmented(Regions.Strings, r => r.ReadTeraString());
            Values        = ReadSegmented(Regions.Values, r => r.ReadDcValue());
            StringIds     = ReadAll(Regions.StringIds, r => r.ReadSegmentAddress());
            StringUnknown = ReadSegmented(Regions.Unknown1, r => r.ReadUnknown());
            Names         = ReadSegmented(Regions.Names, r => r.ReadTeraString());
            NameIds       = ReadAll(Regions.NameIds, r => r.ReadSegmentAddress());
            NameUnknown   = ReadSegmented(Regions.Unknown1, r => r.ReadUnknown());
            Elements      = ReadSegmented(Regions.Elements, r => r.ReadDcObject());

            AssertSequenceEquals(Strings.Select(x => x.Key), StringIds);
            AssertSequenceEquals(Names.Select(x => x.Key), NameIds);

            _buffer = null;
            _stream = null;
        }
 public static DataCenterRegions ReadAllRegions(Stream stream)
 {
     using (var reader = new RegionListReader(stream))
     {
         return reader.ReadDataCenter();
     }
 }