コード例 #1
0
        public void ReadFromFile(BinaryReader reader)
        {
            if (reader.ReadInt32() != 1668571506)
            {
                return;
            }

            if (reader.ReadInt32() != 1)
            {
                return;
            }

            areaCount      = reader.ReadInt32();
            namesLength    = reader.ReadInt32();
            names          = new string(reader.ReadChars(namesLength));
            areaCollection = new List <AreaData>();

            for (int i = 0; i != areaCount; i++)
            {
                AreaData areaData = new AreaData();
                areaData.ReadFromFile(reader);
                int pos = areaData.Index1;

                areaData.IndexedString = names.Substring(pos, names.IndexOf('\0', pos) - pos);
                pos = areaData.Index2;

                if (pos != 65535)
                {
                    areaData.IndexedString2 = names.Substring(pos, names.IndexOf('\0', pos) - pos);
                }

                areaCollection.Add(areaData);
            }
        }
コード例 #2
0
        public void ReadFromFile(BinaryReader reader)
        {
            if (reader.ReadInt32() != 1668576104)
            {
                return;
            }

            fileVersion = reader.ReadInt32();
            numAreas    = reader.ReadInt32();
            bufferSize  = reader.ReadInt32();
            numDatas    = reader.ReadInt32();
            unk1        = reader.ReadInt32();
            unk2        = reader.ReadInt32();
            unk3        = reader.ReadInt32();
            names       = new Dictionary <int, string>();

            //this is updated version of areas, easier to use for shops.
            while (true)
            {
                int offset = (int)reader.BaseStream.Position - 32; // header is 32 bytes.

                if (offset == bufferSize)
                {
                    break;
                }

                string name = StringHelpers.ReadString(reader); //read string
                names.Add(offset, name);                        //add offset as unique key and string
            }

            areas     = new List <Area>();
            areaDatas = new List <AreaData>();

            for (int i = 0; i != numAreas; i++)
            {
                Area area = new Area();
                area.ReadFromFile(reader, fileVersion);
                area.Name = names[area.NameKey];
                areas.Add(area);
            }
            for (int i = 0; i != numDatas; i++)
            {
                AreaData areaData = new AreaData();
                areaData.ReadFromFile(reader, fileVersion);
                areaData.TranslokatorName = names[areaData.TranslokatorNameKey];
                for (int y = 0; y != areaData.Translokators.Count; y++)
                {
                    areaData.Translokators[y].Name = names[areaData.Translokators[y].NameKey];
                }
                areaDatas.Add(areaData);
            }
        }