Exemple #1
0
        private void ResetList()
        {
            ClearList();

            if (JSONFormatting.ParseModRegistry(ModsDirectory + "\\mods_registry.json", out ListOfMods))
            {
                GameDataJSON GDJ = new GameDataJSON();
                if (JSONFormatting.ParseGameData(ModsDirectory + "\\game_data.json", out GDJ))
                {
                    DLCLoadJSON DLJ = new DLCLoadJSON();

                    if (JSONFormatting.ParseDLCLoadJSON(ModsDirectory + "\\dlc_load.json", out DLJ))
                    {
                        CreateList(ListOfMods, GDJ, DLJ);
                    }
                }
            }
        }
Exemple #2
0
        private void ImportListButton_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                string file = openFileDialog1.FileName;
                try
                {
                    ClearList();
                    CustomOrderList COL = JSONFormatting.ParseCustomOrderList(file);
                    GameDataJSON    GDJ = new GameDataJSON(COL);
                    GDJ.modsOrder.Clear();

                    foreach (string g in COL.modsOrderSteamID)
                    {
                        foreach (KeyValuePair <string, ModRegistryJSON> m in ListOfMods)
                        {
                            if (m.Value.steamId == g)
                            {
                                GDJ.modsOrder.Add(m.Value.objectKey);
                                break;
                            }
                        }
                    }

                    GDJ.isEulaAccepted = COL.isEulaAccepted;

                    DLCLoadJSON DLJ = new DLCLoadJSON(COL);

                    CreateList(ListOfMods, GDJ, DLJ);
                }
                catch (IOException)
                {
                    Console.WriteLine("It's f****d");
                }
            }
        }
Exemple #3
0
        private void CreateList(Dictionary <string, ModRegistryJSON> ListOfMods, GameDataJSON GDJ, DLCLoadJSON DLJ)
        {
            int ModNumber = 1, TotalPanelHeight = 0;

            foreach (string ID in GDJ.modsOrder)
            {
                ModRegistryJSON Mod = new ModRegistryJSON();
                if (ListOfMods.TryGetValue(ID, out Mod))
                {
                    bool IsEnabled = false;
                    if (DLJ.enabled_mods.Find(x => x == Mod.gameRegistryId) != null)
                    {
                        IsEnabled = true;
                    }

                    //Create new ModPanel
                    ModPanel mPanel = new ModPanel(ModNumber.ToString(), Mod.displayName, ID, Mod.gameRegistryId, Mod.steamId, IsEnabled);

                    //Add to container
                    MainModPanel.Controls.Add(mPanel.MainPanel);
                    //Set location
                    mPanel.MainPanel.Location = new Point(mPanel.MainPanel.Location.X, TotalPanelHeight);
                    //Set next Y position
                    TotalPanelHeight += mPanel.MainPanel.Height;

                    //Add panel to dictionary
                    ModList.Add(ModNumber, mPanel);
                    //Hash codes for referencing panels
                    PanelHashList.Add(mPanel.MainPanel.GetHashCode(), ModNumber);

                    //Mouse start hover
                    mPanel.MainPanel.MouseEnter  += ModPanelMouseEnter;
                    mPanel.ModLabel.MouseEnter   += ModPanelMouseEnter;
                    mPanel.OrderLabel.MouseEnter += ModPanelMouseEnter;
                    mPanel.Enabled.MouseEnter    += ModPanelMouseEnter;

                    //Mouse end hover
                    mPanel.MainPanel.MouseLeave  += ModPanelMouseLeave;
                    mPanel.ModLabel.MouseLeave   += ModPanelMouseLeave;
                    mPanel.OrderLabel.MouseLeave += ModPanelMouseLeave;
                    mPanel.Enabled.MouseLeave    += ModPanelMouseLeave;

                    //Select panel
                    mPanel.MainPanel.MouseClick  += ModPanelSelected;
                    mPanel.ModLabel.MouseClick   += ModPanelSelected;
                    mPanel.OrderLabel.MouseClick += ModPanelSelected;
                    mPanel.Enabled.MouseClick    += ModPanelSelected;

                    //Increase mod number to keep count
                    ModNumber++;
                }
            }
        }