Exemple #1
0
        private void infoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem contextItem = sender as ToolStripMenuItem;

            if (contextItem == null)
            {
                return;
            }
            MaterialContextMenuStrip contextMenu = contextItem.Owner as MaterialContextMenuStrip;

            if (contextMenu == null)
            {
                return;
            }
            MaterialCheckbox parentCheckbox = contextMenu.SourceControl as MaterialCheckbox;

            if (parentCheckbox == null)
            {
                return;
            }
            ModFile mod = parentCheckbox.Tag as ModFile;

            if (mod == null)
            {
                return;
            }

            MessageBox.Show("Information about this mod:\n\n" +
                            "Name: " + mod.Name + "\n" +
                            "Activate: " + mod.Active.ToString() + "\n" +
                            "Path: " + mod.Path,
                            "Mod Info");
        }
Exemple #2
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem contextItem = sender as ToolStripMenuItem;

            if (contextItem == null)
            {
                return;
            }
            MaterialContextMenuStrip contextMenu = contextItem.Owner as MaterialContextMenuStrip;

            if (contextMenu == null)
            {
                return;
            }
            MaterialCheckbox parentCheckbox = contextMenu.SourceControl as MaterialCheckbox;

            if (parentCheckbox == null)
            {
                return;
            }
            ModFile mod = parentCheckbox.Tag as ModFile;

            if (mod == null)
            {
                return;
            }

            RenameMod(mod);
        }
Exemple #3
0
        private void RenameMod(ModFile mod)
        {
            InputDialog dialog = new InputDialog("Enter the new Name for '" + mod.Name + "':", "Rename Mod");

            dialog.ShowDialog();
            if (dialog.DialogResult == DialogResult.OK)
            {
                string fileName = dialog.InputText;
                File.Move(mod.Path, Path.GetDirectoryName(mod.Path) + @"\" + fileName + ((mod.Active) ? ".vpk" : ".vpk.disabled"));
                ReloadModlist();
            }
        }
Exemple #4
0
        public static List <ModFile> GetModList(string tfDir)
        {
            List <ModFile> modList = new List <ModFile>();

            string[] enabledFiles  = Directory.GetFiles(FileSystem.GetCustomDir(tfDir), "*.vpk");
            string[] disabledFiles = Directory.GetFiles(FileSystem.GetDisabledDir(tfDir), "*.vpk");

            // Get all enabled Mods
            foreach (string file in enabledFiles)
            {
                string fileName = Path.GetFileNameWithoutExtension(file);
                string modName  = fileName;

                modName = modName.Replace('_', ' ');
                modName = modName.Replace('-', ' ');
                modName = modName.Replace(".vpk", "");
                modName = modName.Trim();

                ModFile mod = new ModFile(modName, file, tfDir, true);
                modList.Add(mod);
            }

            // Get all disabled Mods
            foreach (string file in disabledFiles)
            {
                string fileName = Path.GetFileNameWithoutExtension(file);
                string modName  = fileName;

                modName = modName.Replace('_', ' ');
                modName = modName.Replace('-', ' ');
                modName = modName.Replace(".vpk", "");
                modName = modName.Trim();

                ModFile mod = new ModFile(modName, file, tfDir, false);
                modList.Add(mod);
            }

            return(modList);
        }
Exemple #5
0
        private void Checkbox_CheckStateChanged(object sender, EventArgs e)
        {
            MaterialCheckbox checkbox = sender as MaterialCheckbox;

            if (checkbox == null)
            {
                return;
            }

            ModFile mod = checkbox.Tag as ModFile;

            if (mod == null)
            {
                return;
            }

            try
            {
                modHelper.SetActive(mod, checkbox.Checked);
            } catch (Exception ex)
            {
                MessageBox.Show("The mod couldn't be " + ((checkbox.Checked) ? "enabled" : "disabled") + ". Please make sure that the game is closed!\n" + ex.Message);
            }
        }
Exemple #6
0
        private void DeleteMod(ModFile mod)
        {
            DialogResult result = MessageBox.Show("Do you want to create a backup before deleting '" + mod.Name + "'?", "Delete Mod", MessageBoxButtons.YesNoCancel);

            try
            {
                if (result == DialogResult.Yes)
                {
                    modHelper.BackupMod(mod);
                    modHelper.DeleteMod(mod);
                }
                else if (result == DialogResult.No)
                {
                    modHelper.DeleteMod(mod);
                }

                ReloadModlist();
                SetStatus("Mod " + mod.Name + " deleted");
            }
            catch (Exception)
            {
                MessageBox.Show("The mod couln't be deleted. Please close the game first!");
            }
        }