Beispiel #1
0
        private void updateModsCombo()
        {
            string currentMod = (modsCombo.EditValue != null ? modsCombo.EditValue.ToString() : string.Empty);

            modsCombo.Properties.Items.Clear();

            string currentGame = (gamesCombo.EditValue != null ? gamesCombo.EditValue.ToString() : string.Empty);

            if (currentGame == string.Empty)
            {
                return;
            }

            Dictionary <string, Mod> dictionary = launcher.GetModsList(launcher.GetGamesList()[currentGame]);

            foreach (KeyValuePair <string, Mod> item in dictionary)
            {
                modsCombo.Properties.Items.Add(item.Key);
            }

            if (modsCombo.Properties.Items.Count > 0 && modsCombo.Properties.Items.Contains(currentMod))
            {
                modsCombo.EditValue = currentMod;
            }
            else if (modsCombo.Properties.Items.Count > 0)
            {
                modsCombo.EditValue = modsCombo.Properties.Items[0];
            }
            else
            {
                modsCombo.EditValue = string.Empty;
            }
        }
Beispiel #2
0
        private void menuModding_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // Open folder
            if (e.Item == menuModdingOpenFolder)
            {
                launcher.GetCurrentMod().OpenInstallFolder();
            }

            // Clean
            else if (e.Item == menuModdingClean)
            {
                CleanDialog dialog = new CleanDialog(launcher);
                if (dialog.files.Count > 0)
                {
                    dialog.ShowDialog();
                }
            }

            // Import
            else if (e.Item == menuModdingImport2)
            {
                ModSelectionDialog dialog = new ModSelectionDialog();
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string gameName = dialog.game;
                    string modName  = dialog.mod;

                    Game game = launcher.GetGamesList()[gameName];
                    Mod  mod  = launcher.GetModsList(game)[modName];

                    AssetsCopierForm assetsCopierForm = new AssetsCopierForm(game, mod);
                    if (assetsCopierForm.ShowDialog() == DialogResult.OK)
                    {
                    }
                }
            }

            // File explorer
            else if (e.Item == menuModdingFileExplorer)
            {
                FileExplorer form = new FileExplorer(launcher);
                form.ShowDialog();
            }

            // Export
            else if (e.Item == menuModdingExport)
            {
                Game game = launcher.GetGamesList()[toolsGames.EditValue.ToString()];
                Mod  mod  = launcher.GetModsList(game)[toolsMods.EditValue.ToString()];

                AssetsCopierForm form = new AssetsCopierForm(game, mod);
                form.ShowDialog();
            }

            // Hud Editor
            else if (e.Item == menuModdingHudEditor)
            {
                HudEditorForm form = new HudEditorForm(launcher);
                form.ShowDialog();
            }

            // Delete mod
            else if (e.Item == menuModdingDelete)
            {
                if (XtraMessageBox.Show("Are you sure you want to delete this mod?", "Delete mod", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    launcher.GetCurrentGame().DeleteMod();
                    updateToolsGames();
                    updateToolsMods();
                }
            }
        }