public void OnApplicationStart() { // TODO: Remove this migration path at some point var songCoreIniPath = Path.Combine(UnityGame.UserDataPath, nameof(SongCore), "SongCore.ini"); if (File.Exists(songCoreIniPath)) { var modPrefs = new BS_Utils.Utilities.Config("SongCore/SongCore"); Configuration.CustomSongColors = modPrefs.GetBool("SongCore", "customSongColors", true, true); Configuration.CustomSongPlatforms = modPrefs.GetBool("SongCore", "customSongPlatforms", true, true); Configuration.DisplayDiffLabels = modPrefs.GetBool("SongCore", "displayDiffLabels", true, true); Configuration.ForceLongPreviews = modPrefs.GetBool("SongCore", "forceLongPreviews", false, true); //Delete Old Config try { File.Delete(songCoreIniPath); } catch { Logging.Logger.Warn("Failed to delete old config file!"); } } BSMLSettings.instance.AddSettingsMenu("SongCore", "SongCore.UI.settings.bsml", new SCSettingsController()); SceneManager.activeSceneChanged += OnActiveSceneChanged; _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.kyle1413.BeatSaber.SongCore"); BasicUI.GetIcons(); BS_Utils.Utilities.BSEvents.levelSelected += BSEvents_levelSelected; BS_Utils.Utilities.BSEvents.gameSceneLoaded += BSEvents_gameSceneLoaded; BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += BSEvents_menuSceneLoadedFresh; if (!File.Exists(Collections.DataPath)) { File.Create(Collections.DataPath); } else { Collections.LoadExtraSongData(); } Collections.RegisterCustomCharacteristic(BasicUI.MissingCharIcon !, "Missing Characteristic", "Missing Characteristic", "MissingCharacteristic", "MissingCharacteristic", false, false, 1000); Collections.RegisterCustomCharacteristic(BasicUI.LightshowIcon !, "Lightshow", "Lightshow", "Lightshow", "Lightshow", false, false, 100); Collections.RegisterCustomCharacteristic(BasicUI.ExtraDiffsIcon !, "Lawless", "Lawless - Anything Goes", "Lawless", "Lawless", false, false, 101); var foldersXmlFilePath = Path.Combine(UnityGame.UserDataPath, nameof(SongCore), "folders.xml"); if (!File.Exists(foldersXmlFilePath)) { File.WriteAllBytes(foldersXmlFilePath, Utilities.Utils.GetResource(Assembly.GetExecutingAssembly(), "SongCore.Data.folders.xml")); } Loader.SeperateSongFolders.InsertRange(0, Data.SeperateSongFolder.ReadSeperateFoldersFromFile(foldersXmlFilePath)); }
public void OnApplicationStart() { BSMLSettings.instance.AddSettingsMenu("SongCore", "SongCore.UI.settings.bsml", SCSettings.instance); SceneManager.activeSceneChanged += OnActiveSceneChanged; //Delete Old Config try { var songCoreIniPath = Path.Combine(UnityGame.UserDataPath, "SongCore.ini"); if (File.Exists(songCoreIniPath)) { File.Delete(songCoreIniPath); } } catch { Logging.Logger.Warn("Failed to delete old config file!"); } _harmony = new Harmony("com.kyle1413.BeatSaber.SongCore"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); BasicUI.GetIcons(); BS_Utils.Utilities.BSEvents.levelSelected += BSEvents_levelSelected; BS_Utils.Utilities.BSEvents.gameSceneLoaded += BSEvents_gameSceneLoaded; BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += BSEvents_menuSceneLoadedFresh; if (!File.Exists(Collections.DataPath)) { File.Create(Collections.DataPath); } else { Collections.LoadExtraSongData(); } Collections.RegisterCustomCharacteristic(BasicUI.MissingCharIcon !, "Missing Characteristic", "Missing Characteristic", "MissingCharacteristic", "MissingCharacteristic", false, false, 1000); Collections.RegisterCustomCharacteristic(BasicUI.LightshowIcon !, "Lightshow", "Lightshow", "Lightshow", "Lightshow", false, false, 100); Collections.RegisterCustomCharacteristic(BasicUI.ExtraDiffsIcon !, "Lawless", "Lawless - Anything Goes", "Lawless", "Lawless", false, false, 101); var foldersXmlFilePath = Path.Combine(UnityGame.UserDataPath, nameof(SongCore), "folders.xml"); if (!File.Exists(foldersXmlFilePath)) { File.WriteAllBytes(foldersXmlFilePath, Utilities.Utils.GetResource(Assembly.GetExecutingAssembly(), "SongCore.Data.folders.xml")); } Loader.SeperateSongFolders.InsertRange(0, Data.SeperateSongFolder.ReadSeperateFoldersFromFile(foldersXmlFilePath)); }