mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Rename static helpers.
This commit is contained in:
parent
ef2e618cd8
commit
75935224a8
@ -81,11 +81,11 @@
|
||||
<Link>Models\InstallerSettings.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Services\CommandLineParser.cs" />
|
||||
<Compile Include="Services\MessageBoxWrapper.cs" />
|
||||
<Compile Include="Services\MessageBoxEx.cs" />
|
||||
<Compile Include="Services\Executor.cs" />
|
||||
<Compile Include="Services\InstallerService.cs" />
|
||||
<Compile Include="Services\Logger.cs" />
|
||||
<Compile Include="Services\ProcessWrapper.cs" />
|
||||
<Compile Include="Services\ProcessEx.cs" />
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewModelBase.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
|
||||
@ -28,7 +28,7 @@ namespace Remotely.Agent.Installer.Win.Services
|
||||
if (!key.Contains("-"))
|
||||
{
|
||||
Logger.Write("Command line arguments are invalid.");
|
||||
MessageBoxWrapper.Show("Command line arguments are invalid.", "Invalid Arguments", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBoxEx.Show("Command line arguments are invalid.", "Invalid Arguments", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
i -= 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -87,15 +87,15 @@ namespace Remotely.Agent.Installer.Win.Services
|
||||
|
||||
StopService();
|
||||
|
||||
ProcessWrapper.StartHidden("cmd.exe", "/c sc delete Remotely_Service").WaitForExit();
|
||||
ProcessEx.StartHidden("cmd.exe", "/c sc delete Remotely_Service").WaitForExit();
|
||||
|
||||
await StopProcesses();
|
||||
|
||||
ProgressMessageChanged?.Invoke(this, "Deleting files.");
|
||||
ClearInstallDirectory();
|
||||
ProcessWrapper.StartHidden("cmd.exe", $"/c timeout 5 & rd /s /q \"{InstallPath}\"");
|
||||
ProcessEx.StartHidden("cmd.exe", $"/c timeout 5 & rd /s /q \"{InstallPath}\"");
|
||||
|
||||
ProcessWrapper.StartHidden("netsh", "advfirewall firewall delete rule name=\"Remotely ScreenCast\"").WaitForExit();
|
||||
ProcessEx.StartHidden("netsh", "advfirewall firewall delete rule name=\"Remotely ScreenCast\"").WaitForExit();
|
||||
|
||||
GetRegistryBaseKey().DeleteSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Remotely", false);
|
||||
|
||||
@ -112,8 +112,8 @@ namespace Remotely.Agent.Installer.Win.Services
|
||||
private void AddFirewallRule()
|
||||
{
|
||||
var screenCastPath = Path.Combine(InstallPath, "ScreenCast", "Remotely_ScreenCast.exe");
|
||||
ProcessWrapper.StartHidden("netsh", "advfirewall firewall delete rule name=\"Remotely ScreenCast\"").WaitForExit();
|
||||
ProcessWrapper.StartHidden("netsh", $"advfirewall firewall add rule name=\"Remotely ScreenCast\" program=\"{screenCastPath}\" protocol=any dir=in enable=yes action=allow profile=Private,Domain description=\"The agent that allows screen sharing and remote control for Remotely.\"").WaitForExit();
|
||||
ProcessEx.StartHidden("netsh", "advfirewall firewall delete rule name=\"Remotely ScreenCast\"").WaitForExit();
|
||||
ProcessEx.StartHidden("netsh", $"advfirewall firewall add rule name=\"Remotely ScreenCast\" program=\"{screenCastPath}\" protocol=any dir=in enable=yes action=allow profile=Private,Domain description=\"The agent that allows screen sharing and remote control for Remotely.\"").WaitForExit();
|
||||
}
|
||||
|
||||
private void BackupDirectory()
|
||||
@ -138,7 +138,7 @@ namespace Remotely.Agent.Installer.Win.Services
|
||||
var result = principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
if (!result)
|
||||
{
|
||||
MessageBoxWrapper.Show("Elevated privileges are required. Please restart the installer using 'Run as administrator'.", "Elevation Required", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
MessageBoxEx.Show("Elevated privileges are required. Please restart the installer using 'Run as administrator'.", "Elevation Required", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -336,7 +336,7 @@ namespace Remotely.Agent.Installer.Win.Services
|
||||
ProgressMessageChanged?.Invoke(this, "Installing the .NET Core runtime.");
|
||||
ProgressValueChanged?.Invoke(this, 0);
|
||||
|
||||
await Task.Run(() => { ProcessWrapper.StartHidden(targetFile, "/install /quiet /norestart").WaitForExit(); });
|
||||
await Task.Run(() => { ProcessEx.StartHidden(targetFile, "/install /quiet /norestart").WaitForExit(); });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -366,7 +366,7 @@ namespace Remotely.Agent.Installer.Win.Services
|
||||
Logger.Write("Service installed.");
|
||||
serv = ServiceController.GetServices().FirstOrDefault(ser => ser.ServiceName == "Remotely_Service");
|
||||
|
||||
ProcessWrapper.StartHidden("cmd.exe", "/c sc.exe failure \"Remotely_Service\" reset=5 actions=restart/5000");
|
||||
ProcessEx.StartHidden("cmd.exe", "/c sc.exe failure \"Remotely_Service\" reset=5 actions=restart/5000");
|
||||
}
|
||||
if (serv.Status != ServiceControllerStatus.Running)
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Windows;
|
||||
|
||||
namespace Remotely.Agent.Installer.Win.Services
|
||||
{
|
||||
public class MessageBoxWrapper
|
||||
public static class MessageBoxEx
|
||||
{
|
||||
public static MessageBoxResult Show(string message, string caption, MessageBoxButton messageBoxButton, MessageBoxImage messageBoxImage)
|
||||
{
|
||||
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Remotely.Agent.Installer.Win.Services
|
||||
{
|
||||
public static class ProcessWrapper
|
||||
public static class ProcessEx
|
||||
{
|
||||
public static Process StartHidden(string filePath, string arguments)
|
||||
{
|
||||
@ -95,7 +95,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxWrapper.Show("Log file doesn't exist.", "No Logs", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBoxEx.Show("Log file doesn't exist.", "No Logs", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -232,7 +232,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Write(ex);
|
||||
MessageBoxWrapper.Show("There was an error reading the installer settings. Try re-downloading the installer.", "Configuration Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBoxEx.Show("There was an error reading the installer settings. Try re-downloading the installer.", "Configuration Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -244,7 +244,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels
|
||||
var result = principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
if (!result)
|
||||
{
|
||||
MessageBoxWrapper.Show("Elevated privileges are required. Please restart the installer using 'Run as administrator'.", "Elevation Required", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
MessageBoxEx.Show("Elevated privileges are required. Please restart the installer using 'Run as administrator'.", "Elevation Required", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -254,7 +254,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels
|
||||
var result = !string.IsNullOrWhiteSpace(OrganizationID) || !string.IsNullOrWhiteSpace(ServerUrl);
|
||||
if (!result)
|
||||
{
|
||||
MessageBoxWrapper.Show("Required settings are missing. Try re-downloading the installer.", "Invalid Installer", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBoxEx.Show("Required settings are missing. Try re-downloading the installer.", "Invalid Installer", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user