public void UpdateCatagories() { var catagories = JsonModList.GetModLists(); for (var i = 0; i < catagories.Length; i++) { CatagoriesComboBox.Items.Add(catagories[i].ModListName); } }
/// <summary> /// Gets all mods, from the JSON files /// </summary> /// <returns><c>ModFile</c> Array</returns> public static ModFile[] GetAllMods() { var result = new ModFile[0]; var jsonfiles = JsonModList.GetModLists(); for (var i = 0; i < jsonfiles.Length; i++) { result = result.Concat(jsonfiles[i].Modlist).ToArray(); } return(result); }
public void UpdateCatagories() { var catagories = JsonModList.GetModLists(); for (int i = 0; i < catagories.Length; i++) { // var mod = new ListViewItem(catagories[i].modlistname, 0); //0 // mod.SubItems.Add(catagories[i].modlistid); //1 CatagoriesComboBox.Items.Add(catagories[i].ModListName); } }
/// <summary> /// Backend input /// </summary> /// <param name="inputargs">Input</param> /// public static void doCommand(string[] inputargs) { switch (inputargs[0]) { case "wipe": File.Delete(Utilities.ModCache); Console.WriteLine("Wiped!"); break; case "check": var ml = JsonModList.GetModLists(); for (var i = 0; i < ml.Length; i++) { for (var x = 0; x < ml[i].Modlist.Length; x++) { if (ml[i].Modlist[x].ModId == inputargs[1]) { var link = ml[i].Modlist[x].Website; var psi = new ProcessStartInfo { FileName = link, UseShellExecute = true }; Process.Start(psi); } } } break; case "dl": Downloader.DownloadModDirector(inputargs[1]); break; case "toggledebugging": ModInstallerCommon.enableDebugging = !ModInstallerCommon.enableDebugging; Console.WriteLine("Debugging is now " + ModInstallerCommon.enableDebugging); break; //deletion case "rm": Console.WriteLine($"Deleting {inputargs[1]}"); Uninstaller.DeleteMod(inputargs[1]); break; default: Console.WriteLine("Invalid command!"); break; } }
private void CatagoriesComboBox_SelectedIndexChanged(object sender, EventArgs e) { string name = CatagoriesComboBox.SelectedItem.ToString(); var catagories = JsonModList.GetModLists(); for (int i = 0; i < catagories.Length; i++) { if (catagories[i].ModListName == name) { try { UpdateModList(catagories[i].ModListID); } catch (Exception exception) { Console.WriteLine(exception); } break; } } }
/// <summary> /// Gets the mod info of a deserialized <c>ModFile</c> class /// </summary> /// <param name="modid">Modid of mod you want</param> /// <returns></returns> public static ModFile GetSpecificMod(string modid) { var ml = JsonModList.GetModLists(); for (var i = 0; i < ml.Length; i++) { for (var x = 0; x < ml[i].Modlist.Length; x++) { if (ml[i].Modlist[x].ModId == modid) { return (ml[i].Modlist[x]); //sift through every goddamn modfile and find the one with the matching modid } } } return(null); }
public IEnumerable <ModItem> GetDownloadableItems() { var modList = JsonModList.GetModLists(); var listItems = ( from modlistarr in modList from modfile in modlistarr.Modlist select new ModItem { Name = modfile.Name, Authors = Actions.ArrayToString(modfile.Author), Description = modfile.Description } ).ToList(); return(listItems); }
private void CheckButton_Click(object sender, EventArgs e) { var ml = JsonModList.GetModLists(); for (var i = 0; i < ml.Length; i++) { for (var x = 0; x < ml[i].Modlist.Length; x++) { if (ml[i].Modlist[x].ModId == impModID[0]) { var link = ml[i].Modlist[x].Website; var psi = new ProcessStartInfo { FileName = link, UseShellExecute = true }; Process.Start(psi); } } } }
/// <summary> /// Backend input /// </summary> /// <param name="inputargs">Input</param> public static void doCommand(string[] inputargs) { switch (inputargs[0]) { case "reload": JsonModList.GetModLists(true); break; case "wipe": File.Delete(Directory.GetCurrentDirectory() + @"\installedmods.json"); Console.WriteLine("Wiped!"); break; case "modlists": listmodlists(); break; case "check": var ml = JsonModList.GetModLists(); for (var i = 0; i < ml.Length; i++) { for (var x = 0; x < ml[i].Modlist.Length; x++) { if (ml[i].Modlist[x].ModId == inputargs[1]) { var link = ml[i].Modlist[x].Website; var psi = new ProcessStartInfo { FileName = link, UseShellExecute = true }; Process.Start(psi); } } } break; case "dl": Downloader.DownloadModDirector(inputargs[1]); break; case "install": Downloader.DownloadModDirector(inputargs[1], true); break; case "list": if (inputargs[1] == "installedmods") { var mf = InstalledMods.GetInstalledMods(); for (var i = 0; i < mf.Length; i++) { Console.WriteLine(mf[i].Name); } } else { list(inputargs[1]); } break; case "exit": return; case "help": Console.WriteLine("wipe - Wipes the installed registry (DOES NOT DELETE MODS)"); Console.WriteLine("modlists - Lists all modlists, which are lists of mods."); Console.WriteLine("dl [modname] - Downloads mod listed."); Console.WriteLine("check [modname] - Opens browser to modpage."); Console.WriteLine("list [modlist] - Lists all mods contained in a modlist."); Console.WriteLine("list installedmods - Lists all mods registered as installed."); Console.WriteLine("exit - Close H3VRModInstaller."); break; case "toggledebugging": ModInstallerCommon.enableDebugging = !ModInstallerCommon.enableDebugging; Console.WriteLine("Debugging is now " + ModInstallerCommon.enableDebugging); break; //deletion case "rm": Console.WriteLine($"Deleting {inputargs[1]}"); Uninstaller.DeleteMod(inputargs[1]); break; default: Console.WriteLine("Invalid command!"); break; } }