Exemple #1
0
        private void LoadGUI(object sender, EventArgs e)
        {
            InitTimer();                                //progress timer

            AllocConsole();                             //enables console
            JsonCommon.OverrideModInstallerVariables(); //overrides vars if possible

            //check if in vs
            string dir = Directory.GetCurrentDirectory();

            for (int i = 0; i < 3; i++)
            {
                dir = Directory.GetParent(dir).ToString(); //move up 3 dirs
            }
            dir += @"\bin\";                               //add bin
            Console.WriteLine(ModInstallerCommon.Files.MainFiledir);
            Console.WriteLine("Detecting for" + ModInstallerCommon.Files.execdir);
            if (!File.Exists(ModInstallerCommon.Files.execdir) && !ModInstallerCommon.BypassExec && !Directory.Exists(dir))
            {
                MessageBox.Show("ModInstaller cannot find the executable! Make sure my location is in a folder inside the h3vr directory! Just in case, I'll pull up a tutorial for you.", "Exectuable not found!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                var psi = new ProcessStartInfo
                {
                    FileName        = "https://youtu.be/LBcxS_mYLFE?t=21",
                    UseShellExecute = true
                };
                Process.Start(psi);
                Application.Exit();
            }

            var onlineversion = new Version(JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo).Modlist[0].Version);

            if (ModInstallerCommon.ModInstallerVersion.CompareTo(onlineversion) < 0)
            {
                MessageBox.Show("H3VRModInstaller is out of date! (" + ModInstallerCommon.ModInstallerVersion + " vs " + onlineversion + ")", "Wrong version detected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                var psi = new ProcessStartInfo
                {
                    FileName        = JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo).Modlist[0].Website,
                    UseShellExecute = true
                };
                Process.Start(psi);
            }

            InstallButton.Hide();
            UpdateButton.Hide();
            ModVer.Hide();
            Delete.Hide();
            CheckButton.Hide();
            InstalledModsList.Hide();

            ModsEnabled.Checked = true;
            UpdateModList();
            UpdateCatagories();
        }
        public static Tuple <ModFile[], ModFile[]> GetRelevantMods(string category)
        {
            relevantCategory = category; //set new relevantcat
            ModFile[] DLmods = new ModFile[0];

            //get downloadable mods, all or select category
            if (category == "" || category == "all")
            {
                DLmods = ModParsing.GetAllMods();
            }
            else
            {
                DLmods = JsonModList.GetDeserializedModListFormatOnline(category).Modlist;
            }
            ModFile[] ILmods = InstalledMods.GetInstalledMods(); //get all installed mods

            List <ModFile> resultDLmods = new List <ModFile>();  //i've never actually used a List before! --potatoes
            List <ModFile> resultILmods = new List <ModFile>();  //that's why 95% of my array code uses resize. oh well, who needs speed!

            for (int i = 0; i < DLmods.Length; i++)
            {
                bool inILmods = false;
                for (int x = 0; x < ILmods.Length; x++)
                {
                    if (DLmods[i].ModId == ILmods[i].ModId)
                    {
                        inILmods = true; break;
                    }                                                                   //if in ilmods, set to true
                }
                if (inILmods)
                {
                    resultILmods.Add(ILmods[i]);
                }                                              //if overlap btwn dl&il, put to il
                else
                {
                    resultDLmods.Add(DLmods[i]);
                }                                     //otherwise, put to dl
                //this also means that if there is an il but no dl, it is discarded.
            }

            return(new Tuple <ModFile[], ModFile[]>(resultDLmods.ToArray(), resultILmods.ToArray()));
        }
Exemple #3
0
        private void LoadGUI(object sender, EventArgs e)
        {
            KeyDown += Form_KeyDown;

            if (!File.Exists(Utilities.ModCache))
            {
                MessageBox.Show("Thank you for downloading H3VRModInstaller!\nIf there are any issues, or if you want a mod added, please hit us up on the Homebrew discord (@Frityet and @Potatoes)", "Thank you!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            InitTimer();                                //progress timer
            //AllocConsole(); //enables console
            JsonCommon.OverrideModInstallerVariables(); //overrides vars if possible

            var onlineversion = new Version(JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo)
                                            .Modlist[0].Version);

            if (ModInstallerCommon.ModInstallerVersion.CompareTo(onlineversion) < 0)
            {
                MessageBox.Show("H3VRModInstaller is out of date! (" + ModInstallerCommon.ModInstallerVersion + " vs " + onlineversion + ")", "Out of date version detected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                var psi = new ProcessStartInfo
                {
                    FileName = JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo)
                               .Modlist[0]
                               .Website,
                    UseShellExecute = true
                };
                Process.Start(psi);
            }

            InstallButton.Hide();
            UpdateButton.Hide();
            ModVer.Hide();
            Delete.Hide();
            CheckButton.Hide();
            UpdateModList();
            UpdateCatagories();

            CatagoriesComboBox.SelectedIndex = 0;
        }
Exemple #4
0
        public void UpdateModList(string dispcat = "n/a", string filter = "")
        {
            Program.CheckForManuallyUninstalledMods();
            DownloadableModsList.Items.Clear();
            InstalledModsList.Items.Clear();

            if (dispcat == "n/a")
            {
                dispcat = publicdispcat;
            }
            publicdispcat = dispcat;

            var totalmods = ModParsing.GetAllMods();

            if (dispcat == "n/a")
            {
                dispcat = "dependencies";
            }

            Console.WriteLine(dispcat);

            var dispmods = JsonModList.GetDeserializedModListFormatOnline(dispcat).Modlist;

            var installedMods = InstalledMods.GetInstalledMods(); //f**k you

            ModFile[] list = null;

            var relevantint = 0;

            for (var i = 0; i < totalmods.Length; i++)
            {
                //this just checks if the mod we're working with is an installedmod, or a dl mod in isinstldmod
                var isinstldmod = false;
                var x           = 0;
                for (x = 0; x < installedMods.Length; x++)
                {
                    if (totalmods[i].ModId == installedMods[x].ModId)
                    {
                        isinstldmod = true;
                        break;
                    }
                }

                var isdispmod = false;
                for (var y = 0; y < dispmods.Length; y++)
                {
                    if (totalmods[i].ModId == dispmods[y].ModId)
                    {
                        isdispmod = true;
                        break;
                    }
                }

                //sets vars to installedmods or input
                if (isinstldmod)
                {
                    list        = installedMods;
                    relevantint = x;
                }
                else
                {
                    if (publicdispcat == "n/a")
                    {
                        goto Finish;
                    }
                    list        = totalmods;
                    relevantint = i;
                }


                var mod = new ListViewItem(list[relevantint].Name, 0);         //0
                mod.SubItems.Add(list[relevantint].Version);                   //1
                mod.SubItems.Add(string.Join(", ", list[relevantint].Author)); //2
                mod.SubItems.Add(list[relevantint].Description);               //3
                mod.SubItems.Add(list[relevantint].ModId);                     //4

                if (String.IsNullOrEmpty(filter))
                {
                    if (!isinstldmod && isdispmod)
                    {
                        DownloadableModsList.Items.Add(mod);
                    }
                    if (isinstldmod)
                    {
                        InstalledModsList.Items.Add(mod);
                    }
                }
                else
                {
                    //search bar functionality
                    filter = filter.ToLower();
                    var modname      = list[relevantint].Name.ToLower();
                    var authorString = string.Join("", list[relevantint].Author).ToLower();
                    if (modname.Contains(filter) || authorString.Contains(filter))
                    {
                        Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
                        AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                        Console.WriteLine("");
                        switch (isinstldmod)
                        {
                        case false when isdispmod:
                            DownloadableModsList.Items.Add(mod);
                            break;

                        case true:
                            InstalledModsList.Items.Add(mod);
                            break;
                        }
                    }
                }

                Finish :;
            }

            for (var i = 0; i < InstalledModsList.Items.Count; i++)
            {
                //if cached installed mod is a older version than the database
                if (new Version(InstalledModsList.Items[i].SubItems[1].Text).CompareTo(
                        new Version(ModParsing.GetSpecificMod(InstalledModsList.Items[i].SubItems[4].Text).Version)) < 0)
                {
                    InstalledModsList.Items[i].BackColor = Color.Yellow;
                }

                string delinfo = ModParsing.GetSpecificMod(InstalledModsList.Items[i].SubItems[4].Text).DelInfo; //if cached mod is disabled

                if (!String.IsNullOrEmpty(delinfo))
                {
                    string path =
                        Path.Combine(Utilities.GameDirectory,
                                     delinfo.Split('?')[0]);                                    //split to get the first delinfo arg
                    string path2 = Path.Combine(Utilities.DisableCache,
                                                new DirectoryInfo(delinfo.Split('?')[0]).Name); //basically loc of the cache area
                    if ((!File.Exists(path) && !Directory.Exists(path)) &&
                        (File.Exists(path2) || Directory.Exists(path2)))                        //if it is not disabled
                    {
                        InstalledModsList.Items[i].BackColor = Color.Gray;
                        UpdateButton.Hide();
                    }
                    else
                    {
                        UpdateButton.Show();
                    }
                }
            }
        }
Exemple #5
0
        public void UpdateModList(string dispcat = "n/a")
        {
            DownloadableModsList.Items.Clear();
            InstalledModsList.Items.Clear();

            if (dispcat == "n/a")
            {
                dispcat = publicdispcat;
            }
            publicdispcat = dispcat;

            var totalmods = JsonCommon.GetAllMods();

            if (dispcat == "n/a")
            {
                dispcat = "dependencies";
            }

            Console.WriteLine(dispcat);

            var dispmods = JsonModList.GetDeserializedModListFormatOnline(dispcat).Modlist;

            var installedMods = H3VRModInstaller.Backend.JSON.InstalledMods.GetInstalledMods(); //f**k you

            ModFile[] list = null;

            var relevantint = 0;

            for (var i = 0; i < totalmods.Length; i++)
            {
                //this just checks if the mod we're working with is an installedmod, or a dl mod in isinstldmod
                var isinstldmod = false;
                var x           = 0;
                for (x = 0; x < installedMods.Length; x++)
                {
                    if (totalmods[i].ModId == installedMods[x].ModId)
                    {
                        isinstldmod = true;
                        break;
                    }
                }

                var isdispmod = false;
                for (int y = 0; y < dispmods.Length; y++)
                {
                    if (totalmods[i].ModId == dispmods[y].ModId)
                    {
                        isdispmod = true;
                        break;
                    }
                }

                //sets vars to installedmods or input
                if (isinstldmod)
                {
                    list        = installedMods;
                    relevantint = x;
                }
                else
                {
                    if (publicdispcat == "n/a")
                    {
                        goto Finish;
                    }
                    list        = totalmods;
                    relevantint = i;
                }


                var mod = new ListViewItem(list[relevantint].Name, 0); //0
                mod.SubItems.Add(list[relevantint].Version);           //1
                mod.SubItems.Add(list[relevantint].Author[0]);         //2
                mod.SubItems.Add(list[relevantint].Description);       //3
                mod.SubItems.Add(list[relevantint].ModId);             //4


                if (!isinstldmod && isdispmod)
                {
                    DownloadableModsList.Items.Add(mod);
                }
                if (isinstldmod)
                {
                    InstalledModsList.Items.Add(mod);
                }
                Finish :;
            }

            for (int i = 0; i < InstalledModsList.Items.Count; i++)
            {
                //if cached installed mod is a older version than the database
                if (new Version(InstalledModsList.Items[i].SubItems[1].Text).CompareTo(new Version(ModParsing.GetSpecificMod(InstalledModsList.Items[i].SubItems[4].Text).Version)) < 0)
                {
                    InstalledModsList.Items[i].BackColor = System.Drawing.Color.Yellow;
                }
            }
        }