예제 #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 "CTDA":
                    if (Conditions == null)
                    {
                        Conditions = new List <Condition>();
                    }

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

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

                    Data.ReadBinary(reader);
                    break;

                case "RCIL":
                    if (Ingredients == null)
                    {
                        Ingredients = new List <RecipeIngredient>();
                    }

                    RecipeIngredient tempRCIL = new RecipeIngredient();
                    tempRCIL.ReadBinary(reader);
                    Ingredients.Add(tempRCIL);
                    break;

                case "RCOD":
                    if (Outputs == null)
                    {
                        Outputs = new List <RecipeOutput>();
                    }

                    RecipeOutput tempRCOD = new RecipeOutput();
                    tempRCOD.ReadBinary(reader);
                    Outputs.Add(tempRCOD);
                    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("Conditions", false, out subEle))
            {
                if (Conditions == null)
                {
                    Conditions = new List <Condition>();
                }

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

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

                foreach (XElement e in subEle.Elements())
                {
                    RecipeIngredient tempRCIL = new RecipeIngredient();
                    tempRCIL.ReadXML(e, master);
                    Ingredients.Add(tempRCIL);
                }
            }
            if (ele.TryPathTo("Outputs", false, out subEle))
            {
                if (Outputs == null)
                {
                    Outputs = new List <RecipeOutput>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecipeOutput tempRCOD = new RecipeOutput();
                    tempRCOD.ReadXML(e, master);
                    Outputs.Add(tempRCOD);
                }
            }
        }