コード例 #1
0
        public override void ReadBinary(ESPReader reader)
        {
            List <string> readTags = new List <string>();

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "RDAT":
                    if (readTags.Contains("RDAT"))
                    {
                        return;
                    }
                    Header.ReadBinary(reader);
                    break;

                case "RDOT":
                    if (readTags.Contains("RDOT"))
                    {
                        return;
                    }
                    if (ObjectList == null)
                    {
                        ObjectList = new RegionObjectList();
                    }

                    ObjectList.ReadBinary(reader);
                    break;

                case "RDMP":
                    if (readTags.Contains("RDMP"))
                    {
                        return;
                    }
                    if (MapName == null)
                    {
                        MapName = new SimpleSubrecord <String>();
                    }

                    MapName.ReadBinary(reader);
                    break;

                case "RDGS":
                    if (readTags.Contains("RDGS"))
                    {
                        return;
                    }
                    if (GrassList == null)
                    {
                        GrassList = new RegionGrassList();
                    }

                    GrassList.ReadBinary(reader);
                    break;

                case "RDMD":
                    if (readTags.Contains("RDMD"))
                    {
                        return;
                    }
                    if (MusicType == null)
                    {
                        MusicType = new SimpleSubrecord <RegionMusicType>();
                    }

                    MusicType.ReadBinary(reader);
                    break;

                case "RDMO":
                    if (readTags.Contains("RDMO"))
                    {
                        return;
                    }
                    if (Music == null)
                    {
                        Music = new RecordReference();
                    }

                    Music.ReadBinary(reader);
                    break;

                case "RDSI":
                    if (readTags.Contains("RDSI"))
                    {
                        return;
                    }
                    if (IncidentalMediaSet == null)
                    {
                        IncidentalMediaSet = new RecordReference();
                    }

                    IncidentalMediaSet.ReadBinary(reader);
                    break;

                case "RDSB":
                    if (BattleMediaSets == null)
                    {
                        BattleMediaSets = new List <RecordReference>();
                    }

                    RecordReference tempRDSB = new RecordReference();
                    tempRDSB.ReadBinary(reader);
                    BattleMediaSets.Add(tempRDSB);
                    break;

                case "RDSD":
                    if (readTags.Contains("RDSD"))
                    {
                        return;
                    }
                    if (Sounds == null)
                    {
                        Sounds = new RegionSoundList();
                    }

                    Sounds.ReadBinary(reader);
                    break;

                case "RDWT":
                    if (readTags.Contains("RDWT"))
                    {
                        return;
                    }
                    if (Weathers == null)
                    {
                        Weathers = new WeatherList();
                    }

                    Weathers.ReadBinary(reader);
                    break;

                case "RDID":
                    if (readTags.Contains("RDID"))
                    {
                        return;
                    }
                    if (Imposters == null)
                    {
                        Imposters = new FormArray();
                    }

                    Imposters.ReadBinary(reader);
                    break;

                default:
                    return;
                }

                readTags.Add(subTag);
            }
        }
コード例 #2
0
        public override void ReadXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Header", false, out subEle))
            {
                if (Header == null)
                {
                    Header = new RegionDataHeader();
                }

                Header.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectList", false, out subEle))
            {
                if (ObjectList == null)
                {
                    ObjectList = new RegionObjectList();
                }

                ObjectList.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MapName", false, out subEle))
            {
                if (MapName == null)
                {
                    MapName = new SimpleSubrecord <String>();
                }

                MapName.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("GrassList", false, out subEle))
            {
                if (GrassList == null)
                {
                    GrassList = new RegionGrassList();
                }

                GrassList.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MusicType", false, out subEle))
            {
                if (MusicType == null)
                {
                    MusicType = new SimpleSubrecord <RegionMusicType>();
                }

                MusicType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Music", false, out subEle))
            {
                if (Music == null)
                {
                    Music = new RecordReference();
                }

                Music.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MediaSet/Incidental", false, out subEle))
            {
                if (IncidentalMediaSet == null)
                {
                    IncidentalMediaSet = new RecordReference();
                }

                IncidentalMediaSet.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MediaSet/Battle", false, out subEle))
            {
                if (BattleMediaSets == null)
                {
                    BattleMediaSets = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference temp = new RecordReference();
                    temp.ReadXML(e, master);
                    BattleMediaSets.Add(temp);
                }
            }
            if (ele.TryPathTo("Sounds", false, out subEle))
            {
                if (Sounds == null)
                {
                    Sounds = new RegionSoundList();
                }

                Sounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Weathers", false, out subEle))
            {
                if (Weathers == null)
                {
                    Weathers = new WeatherList();
                }

                Weathers.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Imposters", false, out subEle))
            {
                if (Imposters == null)
                {
                    Imposters = new FormArray();
                }

                Imposters.ReadXML(subEle, master);
            }
        }