Пример #1
0
        public HE_HFReunion(XDocument xdoc, World world)
            : base(xdoc, world)
        {
            foreach (XElement element in xdoc.Root.Elements())
            {
                string val = element.Value.ToString();
                int    valI;
                Int32.TryParse(val, out valI);

                switch (element.Name.LocalName)
                {
                case "id":
                case "year":
                case "seconds72":
                case "type":
                    break;

                case "site_id":
                    if (valI != -1)
                    {
                        SiteID = valI;
                    }
                    break;

                case "subregion_id":
                    if (valI != -1)
                    {
                        SubregionID = valI;
                    }
                    break;

                case "feature_layer_id":
                    if (valI != -1)
                    {
                        FeatureLayerID = valI;
                    }
                    break;

                case "group_1_hfid":
                    if (Group1HFID == null)
                    {
                        Group1HFID = new List <int>();
                    }
                    Group1HFID.Add(valI);
                    break;

                case "group_2_hfid":
                    if (Group2HFID == null)
                    {
                        Group2HFID = new List <int>();
                    }
                    Group2HFID.Add(valI);
                    break;

                default:
                    DFXMLParser.UnexpectedXMLElement(xdoc.Root.Name.LocalName + "\t" + HistoricalEvent.Types[Type], element, xdoc.Root.ToString());
                    break;
                }
            }
        }
Пример #2
0
        public HE_HFSimpleBattleEvent(XDocument xdoc, World world)
            : base(xdoc, world)
        {
            foreach (var element in xdoc.Root.Elements())
            {
                var val = element.Value;
                int valI;
                Int32.TryParse(val, out valI);

                switch (element.Name.LocalName)
                {
                case "id":
                case "year":
                case "seconds72":
                case "type":
                    break;

                case "site_id":
                    if (valI != -1)
                    {
                        SiteID = valI;
                    }
                    break;

                case "subregion_id":
                    if (valI != -1)
                    {
                        SubregionID = valI;
                    }
                    break;

                case "feature_layer_id":
                    if (valI != -1)
                    {
                        FeatureLayerID = valI;
                    }
                    break;

                case "subtype":
                    if (!Subtypes.Contains(val))
                    {
                        Subtypes.Add(val);
                    }
                    Subtype = Subtypes.IndexOf(val);
                    break;

                case "group_1_hfid":
                    if (Group1HFID == null)
                    {
                        Group1HFID = new List <int>();
                    }
                    Group1HFID.Add(valI);
                    break;

                case "group_2_hfid":
                    if (Group2HFID == null)
                    {
                        Group2HFID = new List <int>();
                    }
                    Group2HFID.Add(valI);
                    break;

                default:
                    DFXMLParser.UnexpectedXMLElement(xdoc.Root.Name.LocalName + "\t" + Types[Type], element, xdoc.Root.ToString());
                    break;
                }
            }
        }