The base class for commands.
Inheritance: CommandBase
        /// <summary>
        /// Initializes the game launch commands.
        /// </summary>
        protected override void SetupCommands()
        {
            Trace.TraceInformation("Launch Commands:");
            Trace.Indent();

            ClearLaunchCommands();

            string strCommand = GetPlainLaunchCommand();
            Trace.TraceInformation("Plain Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            Image imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
			AddLaunchCommand(new Command("PlainLaunch", "Launch Starbound", "Launches default Starbound.", imgIcon, LaunchStarboundPlain, true));

            strCommand = GetCustomLaunchCommand();
            Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("OpenGLLaunch", "Launch OpenGL Starbound", "Launches OpenGL Starbound.", imgIcon, LaunchStarboundOpenGL, true));

            strCommand = GetCustomLaunchCommand();
            Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("CustomLaunch", "Launch Custom Starbound", "Launches Starbound with custom command.", imgIcon, LaunchStarboundCustom, true));

			DefaultLaunchCommand = new Command("Launch Starbound", "Launches Starbound.", LaunchGame);

            Trace.Unindent();
        }
        /// <summary>
        /// Initializes the game launch commands.
        /// </summary>
        protected override void SetupCommands()
        {
            Trace.TraceInformation("Launch Commands:");
            Trace.Indent();

            ClearLaunchCommands();

            string strCommand = GetPlainLaunchCommand();
            Trace.TraceInformation("Plain Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            Image imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("PlainLaunch", "Launch Morrowind", "Launches plain Morrowind.", imgIcon, LaunchMorrowindPlain, true));

            strCommand = GetMwseLaunchCommand();
            Trace.TraceInformation("MWSE Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            if (File.Exists(strCommand))
            {
                imgIcon = Icon.ExtractAssociatedIcon(strCommand).ToBitmap();
                AddLaunchCommand(new Command("MwseLaunch", "Launch MWSE", "Launches Morrowind with MWSE.", imgIcon, LaunchMorrowindMWSE, true));
            }

            strCommand = GetCustomLaunchCommand();
            Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("CustomLaunch", "Launch Custom Morrowind", "Launches Morrowind with custom command.", imgIcon, LaunchMorrowindCustom, true));

            DefaultLaunchCommand = new Command("Launch Morrowind", "Launches Morrowind.", LaunchGame);

            Trace.Unindent();
        }
		/// <summary>
		/// Initializes the game launch commands.
		/// </summary>
		protected override void SetupCommands()
		{
			Trace.TraceInformation("Launch Commands:");
			Trace.Indent();

			ClearLaunchCommands();

			string strCommand = GetPlainLaunchCommand();
			Trace.TraceInformation("Plain Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			Image imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
			AddLaunchCommand(new Command("PlainLaunch", "Launch Dragon Age 2", "Launches Dragon Age 2.", imgIcon, LaunchDragonAge2Plain, true));

			strCommand = GetCustomLaunchCommand();
			Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
			AddLaunchCommand(new Command("CustomLaunch", "Launch Dragon Age 2 Custom", "Launches Dragon Age 2 Custom.", imgIcon, LaunchDragonAge2Custom, true));

			strCommand = GetLauncherLaunchCommand();
			Trace.TraceInformation("Laucher Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			if (File.Exists(strCommand))
			{
				imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
				AddLaunchCommand(new Command("LauncherLaunch", "Launch Dragon Age 2 Launcher", "Launches Dragon Age 2 Launcher.", imgIcon, LaunchDragonAge2Launcher, true));
			}

			DefaultLaunchCommand = new Command("Launch Dragon Age 2", "Launches Dragon Age 2", LaunchGame);

			Trace.Unindent();
		}
Example #4
0
        /// <summary>
        /// Initializes the game launch commands.
        /// </summary>
        protected override void SetupCommands()
        {
            Trace.TraceInformation("Launch Commands:");
            Trace.Indent();

            ClearLaunchCommands();

            string strCommand = GetPlainLaunchCommand();
            Trace.TraceInformation("Plain Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            Image imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
			AddLaunchCommand(new Command("PlainLaunch", "Launch The Elder Scrolls Online", "Launches plain The Elder Scrolls Online.", imgIcon, LaunchTESOPlain, true));

			strCommand = GetESOLauncherLaunchCommand();
			Trace.TraceInformation("ESO Launcher Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			if (File.Exists(strCommand))
			{
				imgIcon = Icon.ExtractAssociatedIcon(strCommand).ToBitmap();
				AddLaunchCommand(new Command("ESOLauncher", "Launch the ESO Launcher", "Launches the ESO Launcher.", imgIcon, LaunchESOLauncher, true));
			}

            strCommand = GetCustomLaunchCommand();
            Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
			AddLaunchCommand(new Command("CustomLaunch", "Launch Custom The Elder Scrolls Online", "Launches The Elder Scrolls Online with custom command.", imgIcon, LaunchTESOCustom, true));

			DefaultLaunchCommand = new Command("Launch the ESO Launcher", "Launches the ESO Launcher.", LaunchGame);

            Trace.Unindent();
        }
        /// <summary>
        /// Initializes the game launch commands.
        /// </summary>
        protected override void SetupCommands()
        {
            Trace.TraceInformation("Launch Commands:");
            Trace.Indent();

            ClearLaunchCommands();

			string strCommand = GetCMLaunchCommand();
			string strCMIcon = Path.Combine(GameMode.ExecutablePath, "editor.release.exe");
			Trace.TraceInformation("CM Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			Image imgIcon = File.Exists(strCMIcon) ? Icon.ExtractAssociatedIcon(strCMIcon).ToBitmap() : null;
			AddLaunchCommand(new Command("CMLaunch", "Launch The Witcher 2 CM", "Launches The Witcher 2 Content Manager.", imgIcon, LaunchWitcher2CM, true));

            strCommand = GetPlainLaunchCommand();
            Trace.TraceInformation("Plain Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("PlainLaunch", "Launch The Witcher 2", "Launches The Witcher 2.", imgIcon, LaunchWitcher2Plain, true));

            strCommand = GetCustomLaunchCommand();
            Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("CustomLaunch", "Launch The Witcher 2 Custom", "Launches The Witcher 2 Custom.", imgIcon, LaunchWitcher2Custom, true));

			DefaultLaunchCommand = new Command("Launch The Witcher 2 Content Manager", "Launches The Witcher 2 Content Manager.", LaunchGame);

            Trace.Unindent();
        }
        /// <summary>
        /// Initializes the game launch commands.
        /// </summary>
        protected override void SetupCommands()
        {
            Trace.TraceInformation("Launch Commands:");
            Trace.Indent();

            ClearLaunchCommands();

            string strCommand = GetPlainLaunchCommand();
            Trace.TraceInformation("Plain Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            Image imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("PlainLaunch", "Launch WorldOfTanks", "Launches plain WorldOfTanks.", imgIcon, LaunchWoTPlain, true));

            strCommand = GetCustomLaunchCommand();
            Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
            imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
            AddLaunchCommand(new Command("CustomLaunch", "Launch Custom WorldOfTanks", "Launches WorldOfTanks with custom command.", imgIcon, LaunchWoTCustom, true));

            DefaultLaunchCommand = new Command("Launch WorldOfTanks", "Launches WorldOfTanks.", LaunchGame);

            Trace.Unindent();
        }
		/// <summary>
		/// Initializes the game launch commands.
		/// </summary>
		protected override void SetupCommands()
		{
			Trace.TraceInformation("Launch Commands:");
			Trace.Indent();

			ClearLaunchCommands();
			
			string strCommand = GetPlainLaunchCommand();
			Trace.TraceInformation("Plain Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			Image imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
			AddLaunchCommand(new Command("PlainLaunch", "Launch Fallout: New Vegas", "Launches plain Fallout: New Vegas.", imgIcon, LaunchFalloutNVPlain, true));

			strCommand = GetNvseLaunchCommand();
			Trace.TraceInformation("NVSE Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			if (File.Exists(strCommand))
			{
				imgIcon = Icon.ExtractAssociatedIcon(strCommand).ToBitmap();
				AddLaunchCommand(new Command("NvseLaunch", "Launch NVSE", "Launches Fallout: New Vegas with NVSE.", imgIcon, LaunchFalloutNVNVSE, true));
			}

			strCommand = Get4GbLaunchCommand();
			Trace.TraceInformation("FNV4GB Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			if (File.Exists(strCommand))
			{
				imgIcon = Icon.ExtractAssociatedIcon(strCommand).ToBitmap();
				AddLaunchCommand(new Command("FNV4GBLaunch", "Launch FNV4GB", "Launches Fallout: New Vegas with FNV4GB.", imgIcon, LaunchFalloutNV4GB, true));
			}

			strCommand = GetCustomLaunchCommand();
			Trace.TraceInformation("Custom Command: {0} (IsNull={1})", strCommand, (strCommand == null));
			imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
			AddLaunchCommand(new Command("CustomLaunch", "Launch Custom Fallout: New Vegas", "Launches Fallout: New Vegas with custom command.", imgIcon, LaunchFalloutNVCustom, true));

			DefaultLaunchCommand = new Command("Launch Fallout: New Vegas", "Launches Fallout: New Vegas.", LaunchGame);

			Trace.Unindent();
		}
		/// <summary>
		/// A simple constructor that initializes the object with the given dependencies.
		/// </summary>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_gmrInstalledGames">The registry of insalled games.</param>
		/// <param name="p_gmdGameMode">The game mode currently being managed.</param>
		/// <param name="p_mrpModRepository">The repository we are logging in to.</param>
		/// <param name="p_dmtMonitor">The download monitor to use to track task progress.</param>
		/// <param name="p_umgUpdateManager">The update manager to use to perform updates.</param>
		/// <param name="p_mmgModManager">The <see cref="ModManager"/> to use to manage mods.</param>
		/// <param name="p_pmgPluginManager">The <see cref="PluginManager"/> to use to manage plugins.</param>
        public MainFormVM(IEnvironmentInfo p_eifEnvironmentInfo, GameModeRegistry p_gmrInstalledGames, IGameMode p_gmdGameMode, IModRepository p_mrpModRepository, DownloadMonitor p_dmtMonitor, ActivateModsMonitor p_ammMonitor, UpdateManager p_umgUpdateManager, ModManager p_mmgModManager, IPluginManager p_pmgPluginManager)
		{
			EnvironmentInfo = p_eifEnvironmentInfo;
			GameMode = p_gmdGameMode;
			GameMode.GameLauncher.GameLaunching += new CancelEventHandler(GameLauncher_GameLaunching);
			ModManager = p_mmgModManager;
			ModRepository = p_mrpModRepository;
			UpdateManager = p_umgUpdateManager;
			ModManagerVM = new ModManagerVM(p_mmgModManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode.ModeTheme);
			DownloadMonitorVM = new DownloadMonitorVM(p_dmtMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager, p_mrpModRepository);
			ModActivationMonitor = p_ammMonitor;
			ActivateModsMonitorVM = new ActivateModsMonitorVM(p_ammMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager);
			if (GameMode.UsesPlugins)
				PluginManagerVM = new PluginManagerVM(p_pmgPluginManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode, p_ammMonitor);

			HelpInfo = new HelpInformation(p_eifEnvironmentInfo);

			GeneralSettingsGroup gsgGeneralSettings = new GeneralSettingsGroup(p_eifEnvironmentInfo);
			foreach (IModFormat mftFormat in p_mmgModManager.ModFormats)
				gsgGeneralSettings.AddFileAssociation(mftFormat.Extension, mftFormat.Name);

			ModOptionsSettingsGroup mosModOptions = new ModOptionsSettingsGroup(p_eifEnvironmentInfo);

			List<ISettingsGroupView> lstSettingGroups = new List<ISettingsGroupView>();
			lstSettingGroups.Add(new GeneralSettingsPage(gsgGeneralSettings));
			lstSettingGroups.Add(new ModOptionsPage(mosModOptions));
			DownloadSettingsGroup dsgDownloadSettings = new DownloadSettingsGroup(p_eifEnvironmentInfo, ModRepository);
			lstSettingGroups.Add(new DownloadSettingsPage(dsgDownloadSettings));

			if (p_gmdGameMode.SettingsGroupViews != null)
				lstSettingGroups.AddRange(p_gmdGameMode.SettingsGroupViews);

			SettingsFormVM = new SettingsFormVM(p_gmdGameMode, p_eifEnvironmentInfo, lstSettingGroups);

			UpdateCommand = new Command("Update", String.Format("Update {0}", EnvironmentInfo.Settings.ModManagerName), UpdateProgramme);
			LogoutCommand = new Command("Logout", "Logout", Logout);

			List<Command> lstChangeGameModeCommands = new List<Command>();
			List<IGameModeDescriptor> lstSortedModes = new List<IGameModeDescriptor>(p_gmrInstalledGames.RegisteredGameModes);
			lstSortedModes.Sort((x, y) => x.Name.CompareTo(y.Name));
			foreach (IGameModeDescriptor gmdInstalledGame in lstSortedModes)
			{
				string strId = gmdInstalledGame.ModeId;
				string strName = gmdInstalledGame.Name;
				string strDescription = String.Format("Change game to {0}", gmdInstalledGame.Name);
				Image imgCommandIcon = new Icon(gmdInstalledGame.ModeTheme.Icon, 32, 32).ToBitmap();
				lstChangeGameModeCommands.Add(new Command(strId, strName, strDescription, imgCommandIcon, () => ChangeGameMode(strId), true));
			}
			lstChangeGameModeCommands.Add(new Command("Change Default Game...", "Change Default Game", () => ChangeGameMode(CHANGE_DEFAULT_GAME_MODE)));
			lstChangeGameModeCommands.Add(new Command("Rescan Installed Games...", "Rescan Installed Games", () => ChangeGameMode(RESCAN_INSTALLED_GAMES)));
			ChangeGameModeCommands = lstChangeGameModeCommands;
		}
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_objTrigger">The object that can trigger the command.</param>
		/// <param name="p_cmdCommand">The command that can be triggered.</param>
		protected CommandBinding(object p_objTrigger, Command p_cmdCommand)
			: base(p_objTrigger, p_cmdCommand)
		{
		}
		/// <summary>
		/// Initialized the object with the given values.
		/// </summary>
		/// <param name="p_gmdGameMode">The current game mode.</param>
		public ArchiveInvalidation(SkyrimGameMode p_gmdGameMode)
		{
			GameMode = p_gmdGameMode;
			LaunchCommand = new Command("Reset Archive Invalidation", "Resets Archive Invalidation.", ResetArchiveInvalidation);
		}
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_vmlScriptEditorVM">The <see cref="InstallScriptEditorVM"/> that encapsulates the data
		/// and operations for diaplying the <see cref="IScript"/> editor.</param>
		/// <param name="p_vmlInfoEditorVM">The <see cref="ModInfoEditorVM"/> that encapsulates the data
		/// and operations for diaplying the <see cref="IModInfo"/> editor.</param>
		/// <param name="p_prjModProject">The <see cref="Project"/> to edit.</param>
		/// <param name="p_srgScriptTypeRegistry">The <see cref="IScriptTypeRegistry"/> of available <see cref="IScriptType"/>s.</param>
		/// <param name="p_mpkModBuilder">he <see cref="ModPackager"/> to use to build mod files
		/// from <see cref="Project"/>s.</param>
		public ModPackagingFormVM(InstallScriptEditorVM p_vmlScriptEditorVM, ModInfoEditorVM p_vmlInfoEditorVM, Project p_prjModProject, IScriptTypeRegistry p_srgScriptTypeRegistry, ModPackager p_mpkModBuilder)
		{
			Errors = new ErrorContainer();
			Warnings = new ErrorContainer();

			ScriptEditorVM = p_vmlScriptEditorVM;
			InfoEditorVM = p_vmlInfoEditorVM;
			IScriptTypeRegistry = p_srgScriptTypeRegistry;
			ModBuilder = p_mpkModBuilder;
			
			ModProject = p_prjModProject ?? new Project(p_srgScriptTypeRegistry);

			SaveCommand = new Command<string>("Save Project", "Save the project.", SaveProject, ModProject.IsDirty);
			OpenCommand = new Command("Open Project", "Open a project.", OpenProject);
			NewCommand = new Command("New Project", "Create a new project.", NewProject);
			BuildCommand = new Command<string>("Build Mod", "Builds the mod file.", BuildMod);
		}
		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		/// <param name="p_pmgPluginManager">The plugin manager to use to manage plugins.</param>
		/// <param name="p_setSettings">The application and user settings.</param>
		/// <param name="p_gmdGameMode">The game mode that is currently being managed.</param>
		public PluginManagerVM(IPluginManager p_pmgPluginManager, ISettings p_setSettings, IGameMode p_gmdGameMode, ActivateModsMonitor p_ammMonitor)
		{
			PluginManager = p_pmgPluginManager;
			Settings = p_setSettings;
			CurrentGameMode = p_gmdGameMode;
			ModActivationMonitor = p_ammMonitor;

			CurrentGameMode.LoadOrderManager.ActivePluginUpdate += new EventHandler(LoadOrderManager_ActivePluginUpdate);
			CurrentGameMode.LoadOrderManager.LoadOrderUpdate += new EventHandler(LoadOrderManager_LoadOrderUpdate);
			CurrentGameMode.LoadOrderManager.ExternalPluginAdded +=	new EventHandler(LoadOrderManager_ExternalPluginAdded);
			CurrentGameMode.LoadOrderManager.ExternalPluginRemoved += new EventHandler(LoadOrderManager_ExternalPluginRemoved);

			ActivatePluginCommand = new Command<Plugin>("Activate Plugin", "Activates the selected plugin.", ActivatePlugin);
			DeactivatePluginCommand = new Command<Plugin>("Deactivate Plugin", "Deactivates the selected plugin.", DeactivatePlugin);
			MoveUpCommand = new Command<IEnumerable<Plugin>>("Move Plugin Up", "Moves the plugin up in the load order.", MovePluginsUp);
			MoveDownCommand = new Command<IList<Plugin>>("Move Plugin Down", "Moves the plugin down in the load order.", MovePluginsDown);

			ExportLoadOrderToFileCommand = new Command<string>("Export to a text file", "Exports the current load order to a text file.", ExportLoadOrderToFile);
			ExportLoadOrderToClipboardCommand = new Command("Export to the clipboard", "Exports the current load order to the clipboard.", ExportLoadOrderToClipboard);
			ImportLoadOrderFromFileCommand = new Command<string>("Import from a text file", "Imports a load order from a text file", ImportLoadOrderFromFile);
			ImportLoadOrderFromClipboardCommand = new Command("Import from the clipboard", "Imports a load order from the clipboard", ImportLoadOrderFromClipboard);
		}
		/// <summary>
		/// Adds the given launch command.
		/// </summary>
		/// <param name="p_cmdLaunch">The launch command to add.</param>
		protected void AddLaunchCommand(Command p_cmdLaunch)
		{
			m_lstLaunchCommands.Add(p_cmdLaunch);
		}