Ejemplo n.º 1
0
        private static List <Chassis> ParseChassis(IDictionary <string, IDictionary <string, string> > sections, Rules rules)
        {
            var outChassis = new List <Chassis>();

            foreach (var section in sections)
            {
                IDictionary <string, string> sectionPairs = section.Value;
                if (!IsSectionTypeOf(sectionPairs, iniValueTypeChassis))
                {
                    continue;
                }
                IDictionary <string, string> chassisSectionPairs = sectionPairs;
                string chassisSectionName = section.Key;

                var chassis = new Chassis(chassisSectionName);
                ParsePart(chassisSectionPairs, chassis);

                // Обязательные параметры.
                try {
                    string      passabilityName = chassisSectionPairs[iniKeyChassisPassability];
                    Passability passability     = rules.GetPassability(iniKeyChassisPassability);
                    chassis.Passability = (Passability)passability.Clone();
                }
                catch (KeyNotFoundException) {
                    continue;
                }
                catch (FormatException) {
                    continue;
                }
                catch (InvalidOperationException) {
                    continue;
                }

                outChassis.Add(chassis);
            }

            return(outChassis);
        }
Ejemplo n.º 2
0
 public Chassis(string name, string displayedName, int maxHP, int masse, Passability passability) : base(name, displayedName, maxHP, masse)
 {
     Passability = passability;
 }