Пример #1
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "DESC":
                    if (Description == null)
                    {
                        Description = new SimpleSubrecord <String>();
                    }

                    Description.ReadBinary(reader);
                    break;

                case "ICON":
                    if (LargeIcon == null)
                    {
                        LargeIcon = new SimpleSubrecord <String>();
                    }

                    LargeIcon.ReadBinary(reader);
                    break;

                case "MICO":
                    if (SmallIcon == null)
                    {
                        SmallIcon = new SimpleSubrecord <String>();
                    }

                    SmallIcon.ReadBinary(reader);
                    break;

                case "CTDA":
                    if (Requirements == null)
                    {
                        Requirements = new List <Condition>();
                    }

                    Condition tempCTDA = new Condition();
                    tempCTDA.ReadBinary(reader);
                    Requirements.Add(tempCTDA);
                    break;

                case "DATA":
                    if (Data == null)
                    {
                        Data = new PerkData();
                    }

                    Data.ReadBinary(reader);
                    break;

                case "PRKE":
                    if (Effects == null)
                    {
                        Effects = new List <PerkEffect>();
                    }

                    PerkEffect tempPRKE = new PerkEffect();
                    tempPRKE.ReadBinary(reader);
                    Effects.Add(tempPRKE);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
Пример #2
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

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

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

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

                Description.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Large", false, out subEle))
            {
                if (LargeIcon == null)
                {
                    LargeIcon = new SimpleSubrecord <String>();
                }

                LargeIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Small", false, out subEle))
            {
                if (SmallIcon == null)
                {
                    SmallIcon = new SimpleSubrecord <String>();
                }

                SmallIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Requirements", false, out subEle))
            {
                if (Requirements == null)
                {
                    Requirements = new List <Condition>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    Condition tempCTDA = new Condition();
                    tempCTDA.ReadXML(e, master);
                    Requirements.Add(tempCTDA);
                }
            }
            if (ele.TryPathTo("Data", false, out subEle))
            {
                if (Data == null)
                {
                    Data = new PerkData();
                }

                Data.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Effects", false, out subEle))
            {
                if (Effects == null)
                {
                    Effects = new List <PerkEffect>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    PerkEffect tempPRKE = new PerkEffect();
                    tempPRKE.ReadXML(e, master);
                    Effects.Add(tempPRKE);
                }
            }
        }