コード例 #1
0
        public void SetSettings(XmlNode settings)
        {
            setDefaults();
            XmlElement element = (XmlElement)settings;

            if (!element.IsEmpty)
            {
                if (element[LOG_KEY] != null)
                {
                    LogLocation = element[LOG_KEY].InnerText;
                }
                if (element[LOAD_REMOVAL_FLAG] != null)
                {
                    LoadRemovalEnabled = bool.Parse(element[LOAD_REMOVAL_FLAG].InnerText);
                }
                if (element[AUTO_SPLIT_FLAG] != null)
                {
                    AutoSplitEnabled = bool.Parse(element[AUTO_SPLIT_FLAG].InnerText);
                }
                if (element[SPLIT_LABYRINTH_TYPE] != null)
                {
                    LabSplitType = (LabSplitMode)Enum.Parse(typeof(LabSplitMode), element[SPLIT_LABYRINTH_TYPE].InnerText);
                }
                if (element[SPLIT_CRITERIA] != null)
                {
                    CriteriaToSplit = (SplitCriteria)Enum.Parse(typeof(SplitCriteria), element[SPLIT_CRITERIA].InnerText);
                }
                if (element[GENERATE_WITH_ICONS] != null)
                {
                    GenerateWithIcons = bool.Parse(element[GENERATE_WITH_ICONS].InnerText);
                }
                if (element[SPLIT_ZONES] != null)
                {
                    HashSet <string> deserialized = DeserializeZones(element[SPLIT_ZONES]);
                    foreach (Zone zone in Zone.ZONES)
                    {
                        if (deserialized.Contains(zone.Serialize()))
                        {
                            SplitZones.Add(zone);
                        }
                    }
                }
                if (element[SPLIT_LEVELS] != null)
                {
                    foreach (XmlNode child in element[SPLIT_LEVELS].GetElementsByTagName(SPLIT_LEVEL))
                    {
                        SplitLevels.Add(Int32.Parse(child.InnerText));
                    }
                }
                if (element[LEGACY_SPLIT_LABYRINTH] != null && bool.Parse(element[LEGACY_SPLIT_LABYRINTH].InnerText))
                {
                    // Override to support old split settings.
                    CriteriaToSplit = SplitCriteria.Labyrinth;
                }
            }
        }
コード例 #2
0
 private void setDefaults()
 {
     AutoSplitEnabled   = true;
     LoadRemovalEnabled = false;
     LabSplitType       = LabSplitMode.AllZones;
     GenerateWithIcons  = true;
     CriteriaToSplit    = SplitCriteria.Zones;
     logLocation        = DEFAULT_LOG_LOCATION;
     SplitZones         = new HashSet <IZone>();
     SplitLevels        = new HashSet <int>();
 }