//======================================================== private void Main_Loaded(object sender, RoutedEventArgs e) { blinkTimer.Tick += Console_Timer_Tick; blinkTimer.Interval = new TimeSpan(0, 0, 0, 0, 250); Lib.Updaters.ModManager_Updater update = new Lib.Updaters.ModManager_Updater(); DeleteOldUpdaterFiles(); var game = GameInfo.GetGame(SessionData.currentGame); BgThread.AddToQueue(() => { update.HandleUpdates(); string gameD = game.GameDir + "\\MelonLoader\\MelonLoader.dll"; MelonMod_Handler.HandleUpdates(game.GameDir, gameD); }); // check for mod helper and download if not exists var files = Directory.GetFiles(game.GameDir + "\\Mods"); var hasModHelper = files.Any(file => file.ToLower().Replace(" ", "").Replace(".", "").Contains("modhelperdll")); if (!hasModHelper) { var result = MessageBox.Show("It seems you don't have Bloons Mod Helper installed. Most mods require this to work." + " Do you want to download it now?", "Download Bloons Mod Helper?", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { MessageBox.Show("Great! The download will open when you close this popup. To get it, download BloonsTD6_Mod_Helper.zip and extract it to your BTD6 mod's folder"); Process.Start("https://github.com/gurrenm3/BTD-Mod-Helper/releases"); } } }
private static bool AreModsValid() { foreach (var mod in SessionData.loadedMods) { string filePath = mod; if (IsFileZip(filePath)) { continue; } var melonInfo = MelonMod_Handler.GetModInfo(filePath); string melonModName = string.IsNullOrEmpty(melonInfo?.Name) ? "" : melonInfo.Name; var similarMods = SessionData.loadedMods.Count(dupMod => GetModInfo(dupMod)?.Name == melonModName); bool isDuplicate = (similarMods > 1); if (!isDuplicate) { continue; } Logger.Log($"Error! You are trying to load \"{melonModName}\" more than once. " + $"You can only have one of \"{melonModName}\" active at a time.", OutputType.Both); return(false); } return(true); }
//======================================================== private void Main_Loaded(object sender, RoutedEventArgs e) { blinkTimer.Tick += Console_Timer_Tick; blinkTimer.Interval = new TimeSpan(0, 0, 0, 0, 250); Lib.Updaters.ModManager_Updater update = new Lib.Updaters.ModManager_Updater(); DeleteOldUpdaterFiles(); var game = GameInfo.GetGame(SessionData.currentGame); BgThread.AddToQueue(() => { update.HandleUpdates(); string gameD = game.GameDir + "\\MelonLoader\\MelonLoader.ModHandler.dll"; MelonMod_Handler.HandleUpdates(game.GameDir, gameD); }); }