private ComponentTask SetRegistry_ScheduleResolutionSetter() { bool runOnce = true; RegistryUtil.StartupRegistryHives startupRegistryHive = RegistryUtil.StartupRegistryHives.CURRENT_USER; string registryKeyValueName = "TBInstaller_SetResolution"; CLICommand sleepCommand = new CLICommand { Program = "sleep" }; sleepCommand.Options.Add(new CommandOption("3")); CLICommand qresCommand = CMDCommands.QRes(SetupProperties.DisplayWidth, SetupProperties.DisplayHeight); CLICommand taskkillCommand = CMDCommands.TaskKill("explorer.exe"); CLICommand startCommand = CMDCommands.Start("explorer.exe"); CLICommand[] commands = new CLICommand[] { sleepCommand, qresCommand, taskkillCommand, startCommand }; StringComparison validationStringComparison = StringComparison.OrdinalIgnoreCase; return(ComponentTaskPresets.SetRegistryRunCommand( runOnce, startupRegistryHive, registryKeyValueName, commands, validationStringComparison)); }
private ComponentTask SetRegistry_ScheduleWindowsTempFolderFilesCleanup() { bool runOnce = true; RegistryUtil.StartupRegistryHives startupRegistryHive = RegistryUtil.StartupRegistryHives.LOCAL_MACHINE; string registryKeyValueName = "TBInstallerCleanup_WindowsTempFolderFiles"; bool force = true; bool deleteFromSubfolders = true; bool quiet = true; string filePath = StringUtil.DQuote(@"C:\Windows\Temp\*"); CLICommand command = CMDCommands.Del( force, deleteFromSubfolders, quiet, filePath); StringComparison validationStringComparison = StringComparison.OrdinalIgnoreCase; return(ComponentTaskPresets.SetRegistryRunCommand( runOnce, startupRegistryHive, registryKeyValueName, command, validationStringComparison)); }
private ComponentTask SetRegistry_ScheduleTBInstallerDeletion() { bool runOnce = true; RegistryUtil.StartupRegistryHives startupRegistryHive = RegistryUtil.StartupRegistryHives.LOCAL_MACHINE; string registryKeyValueName = "TBInstallerCleanup_DeleteInstaller"; bool force = true; bool deleteFromSubfolders = false; bool quiet = true; string filePath = StringUtil.DQuote(Path.Combine(SystemPathConstants.StartupPath, "FirstSetup.exe")); CLICommand command = CMDCommands.Del( force, deleteFromSubfolders, quiet, filePath); StringComparison validationStringComparison = StringComparison.OrdinalIgnoreCase; return(ComponentTaskPresets.SetRegistryRunCommand( runOnce, startupRegistryHive, registryKeyValueName, command, validationStringComparison)); }
public static ComponentTask SetRegistryRunCommand( bool runOnce, RegistryUtil.StartupRegistryHives startupRegistryHive, string registryKeyValueName, CLICommand[] commands, StringComparison validationStringComparison ) { /************************************************ * Task Type: Setup * Task Prerequisite: None. * Task Description: Create a Run or RunOnce registry key * at the HKLM or HKCU registry hive for * a cmd /c command. * Task Validation: No cleanup required. ************************************************/ Func <bool> prequisiteFunc = null; Action setupAction = () => RegistryUtil.SetRunCommand( runOnce, startupRegistryHive, registryKeyValueName, commands); Func <bool> setupActionValidation = () => RegistryUtil.RegistryKeyValueDataExists( RegistryUtil.GetStartupRunKey(runOnce, startupRegistryHive), registryKeyValueName, SystemPathConstants.CmdPathCommand + " " + CMDCommands.ToOneLine(commands), validationStringComparison); SetupTask setupTask = new SetupTask(prequisiteFunc, setupAction, setupActionValidation, true); /************************************************/ /************************************************ * Task Type: Cleanup * Task Description: No cleanup required. ************************************************/ Action cleanupAction = null; Func <bool> cleanupActionValidation = null; CleanupTask cleanupTask = new CleanupTask(cleanupAction, cleanupActionValidation); /************************************************/ return(new ComponentTask(setupTask, cleanupTask)); }
public ServerViewModel() { Server = new Server(IPAddress.Any); Server.ClientConnected += Server_ClientConnected; Server.ClientDisconnected += Server_ClientDisconnected; Server.MessageReceived += Server_MessageReceived; Server.OnPropertyChanged += Server_OnPropertyChanged; Server.Start(); Audio = new AudioCommands(Server, "Audio"); Visual = new VisualCommands(Server, "Visuals"); Windows = new WindowsCommands(Server, "Windows"); Client = new ClientCommands(Server, "Client"); CMD = new CMDCommands(Server, "CMD"); Task.Run(() => new ServerDiscovery("gang?", "Dopple gang").Discover()); }