static void RunMaintenanceMode(Command command) { if (command.ContainsCommandArg("-installskin")) { // We are trying to install a new skin string skinPackagePath = command["-installskin"]; if (!string.IsNullOrEmpty(skinPackagePath) && File.Exists(skinPackagePath)) { bool installed = Skins.SkinManager.InstallSkin(skinPackagePath); if (installed) { System.Windows.Forms.MessageBox.Show("The skin has been installed!", "Installation completed!"); } else { System.Windows.Forms.MessageBox.Show("The selected file is not a valid skin package.", "Invalid Package"); } } } else if (command.ContainsCommandArg("-createfileassociations")) { // Create associations for the skin loader RegistryKey RegKey = Registry.ClassesRoot.CreateSubKey(".pmdcpskn"); RegKey.SetValue("", "PMDCP.Skin.Loader"); RegKey.Close(); RegKey = Registry.ClassesRoot.CreateSubKey("PMDCP.Skin.Loader"); RegKey.SetValue("", "PMDCP Skin Package"); RegKey.Close(); RegKey = Registry.ClassesRoot.CreateSubKey("PMDCP.Skin.Loader" + "\\DefaultIcon"); RegKey.SetValue("", @"C:\Program Files\Pokemon Mystery Dungeon Community Project\Client\pmdcpicon.ico" + "," + "0"); RegKey.Close(); RegKey = Registry.ClassesRoot.CreateSubKey("PMDCP.Skin.Loader" + "\\" + "Shell" + "\\" + "Open"); RegKey = RegKey.CreateSubKey("Command"); RegKey.SetValue("", "\"" + PMDCP.Core.Environment.StartupPath + "\" -installskin \"%1\""); RegKey.Close(); } }
static bool IsRunningUnderMaintenanceMode(Command command) { if (command.ContainsCommandArg("-installskin")) { return true; } else if (command.ContainsCommandArg("-createfileassociations")) { return true; } return false; }