コード例 #1
0
        /// <summary>
        /// Load Configuration
        /// </summary>
        internal static void Load()
        {
            BS_Utils.Utilities.Config oldConfig = new BS_Utils.Utilities.Config("modprefs");
            if (oldConfig.HasKey(Plugin.PluginName, "GripLeftPosition") && !oldConfig.GetBool(Plugin.PluginName, "IsExportedToNewConfig", false))
            {
                // Import SaberTailor's settings from the old configuration (ModPrefs)
                try
                {
                    PluginConfig importedConfig = ConfigurationImporter.ImportSettingsFromModPrefs(oldConfig);
                    PluginConfig.Instance = importedConfig;

                    // Store configuration in the new format immediately
                    PluginConfig.Instance.Changed();
                    Logger.log.Info("Configuration loaded from ModPrefs.");
                }
                catch (Exception ex)
                {
                    Logger.log.Warn("Failed to import ModPrefs configuration. Loading default BSIPA configuration instead.");
                    Logger.log.Warn(ex);
                }
            }

            LoadConfig();
            UpdateConfig();
            Logger.log.Debug("Configuration has been set");

            // Update variables used by mod logic
            UpdateModVariables();
        }
コード例 #2
0
        public static void LoadIni()
        {
            if (config.HasKey("BeatSaverDownloader", "beatsaverURL"))
            {
                beatsaverURL = config.GetString("BeatSaverDownloader", "beatsaverURL", "https://beatsaver.com");
                if (string.IsNullOrEmpty(beatsaverURL))
                {
                    config.SetString("BeatSaverDownloader", "beatsaverURL", "https://beatsaver.com");
                    beatsaverURL = "https://beatsaver.com";
                }
            }
            else
            {
                LoadOldIni();
                SaveConfig();
                return;
            }


            apiAccessToken = config.GetString("BeatSaverDownloader", "apiAccessToken", apiTokenPlaceholder, true);

            disableDeleteButton = config.GetBool("BeatSaverDownloader", "disableDeleteButton", false, true);

            deleteToRecycleBin = config.GetBool("BeatSaverDownloader", "deleteToRecycleBin", true, true);

            enableSongIcons = config.GetBool("BeatSaverDownloader", "enableSongIcons", true, true);

            rememberLastPackAndSong = config.GetBool("BeatSaverDownloader", "rememberLastPackAndSong", false, true);

            lastSelectedSong = config.GetString("BeatSaverDownloader", "lastSelectedSong", "", true);


            lastSelectedPack = config.GetString("BeatSaverDownloader", "lastSelectedPack", "", true);


            lastSelectedSortMode = (SortMode)config.GetInt("BeatSaverDownloader", "lastSelectedSortMode", 0, true);


            maxSimultaneousDownloads = config.GetInt("BeatSaverDownloader", "maxSimultaneousDownloads", 3, true);

            fastScrollSpeed = config.GetInt("BeatSaverDownloader", "fastScrollSpeed", 5, true);
        }