Esempio n. 1
0
        public EC_Duel(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 "start_year":
                case "start_seconds72":
                case "end_year":
                case "end_seconds72":
                case "event":
                case "type":
                    break;

                case "ordinal":
                    Ordinal = valI;
                    break;

                case "parent_eventcol":
                    ParentEventCol_ = valI;
                    break;

                case "subregion_id":
                    SubregionID = valI;
                    break;

                case "feature_layer_id":
                    FeatureLayerID = valI;
                    break;

                case "site_id":
                    SiteID = valI;
                    break;

                case "coords":
                    Coords = new Point(Convert.ToInt32(val.Split(',')[0]), Convert.ToInt32(val.Split(',')[1]));
                    break;

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

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

                default:
                    DFXMLParser.UnexpectedXMLElement(xdoc.Root.Name.LocalName + "\t" + Types[Type], element, xdoc.Root.ToString());
                    break;
                }
            }
        }
Esempio n. 2
0
        public EC_Battle(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 "start_year":
                case "start_seconds72":
                case "end_year":
                case "end_seconds72":
                case "event":
                case "type":
                    break;

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

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

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

                case "coords":
                    Coords = new Point(Convert.ToInt32(val.Split(',')[0]), Convert.ToInt32(val.Split(',')[1]));
                    break;

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

                case "name":
                    Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(val);
                    break;

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

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

                case "war_eventcol":
                    WarEventCol_ = valI;
                    break;

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

                case "attacking_squad_race":
                    if (AttackingSquadRace == null)
                    {
                        AttackingSquadRace = new List <string>();
                    }
                    AttackingSquadRace.Add(val);
                    break;

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

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

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

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

                case "defending_squad_race":
                    if (DefendingSquadRace == null)
                    {
                        DefendingSquadRace = new List <string>();
                    }
                    DefendingSquadRace.Add(val);
                    break;

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

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

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

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

                case "outcome":
                    Outcome = val;
                    break;

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