Exemplo n.º 1
0
        static public void Load()
        {
            string filename = db.XmlPath + "options.xml";

            if (!System.IO.File.Exists(filename))
            {
                return;
            }
            using (XmlTextReader gs = new XmlTextReader(filename))
            {
                gs.XmlResolver = null;
                while (gs.Read())
                {
                    if (gs.NodeType == XmlNodeType.Element)
                    {
                        switch (gs.Name)
                        {
                        case "InputMode":
                            string InputModeText = gs.ReadElementContentAsString();
                            if (InputModeText == "Advanced")
                            {
                                InputMode = InputMode.Advanced;
                            }
                            else if (InputModeText == "Standard")
                            {
                                InputMode = InputMode.Standard;
                            }
                            break;

                        case "UseHexInAdvancedMode": XmlReadBool(gs, ref UseHexInAdvancedMode); break;

                        case "PartSelectorTracking": XmlReadBool(gs, ref PartSelectorTracking); break;

                        case "ShowManufacturer": XmlReadBool(gs, ref ShowManufacturer); break;

                        case "ShowRarity": XmlReadBool(gs, ref ShowRarity); break;

                        case "ShowLevel": XmlReadBool(gs, ref ShowLevel); break;

                        case "UseColor": XmlReadBool(gs, ref UseColor); break;

                        case "lastLockerFile":
                        {
                            db.OpenedLockerFilename(gs.ReadElementContentAsString());
                        }
                        break;

                        case "MaxCash": XmlReadInt(gs, ref MaxCash); break;

                        case "MaxLevel": XmlReadInt(gs, ref MaxLevel); break;

                        case "MaxExperience": XmlReadInt(gs, ref MaxExperience); break;

                        case "MaxInventorySlots": XmlReadInt(gs, ref MaxBackpackSlots); break;

                        case "MaxBankSlots": XmlReadInt(gs, ref MaxBankSlots); break;

                        case "MaxSkillPoints": XmlReadInt(gs, ref MaxSkillPoints); break;

                        case "RarityColor0":
                        case "RarityColor1":
                        case "RarityColor2":
                        case "RarityColor3":
                        case "RarityColor4":
                        case "RarityColor5":
                        case "RarityColor6":
                        case "RarityColor7":
                        case "RarityColor8":
                        case "RarityColor9":
                        case "RarityColor10":
                        case "RarityColor11":
                            try
                            {
                                int    index = Parse.AsInt(gs.Name.After("RarityColor"));
                                uint   colorval;
                                string text = gs.ReadElementContentAsString();
                                if (uint.TryParse(text, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out colorval))
                                {
                                    GlobalSettings.RarityColor[index] = Color.FromArgb((int)colorval);
                                }
                            } catch { }
                            break;
                        }
                    }
                }
            }
        }