[VMware Launcher 2.0.9.5]
- Refactored code. - Fixed bug: "#1 Welcome message shows despite VMware not being installed"
This commit is contained in:
Binary file not shown.
+10
-7
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Express 2013 for Windows Desktop
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 12.0.21005.1
|
VisualStudioVersion = 16.0.31025.194
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VmwareLauncher", "VmwareLauncher\VmwareLauncher.csproj", "{40A28143-CEF4-41B4-8476-3466822AAAA5}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VmwareLauncher", "VmwareLauncher\VmwareLauncher.csproj", "{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -11,12 +11,15 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {D877D8E5-8AB4-41AD-A601-EFBD24992B7E}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace VMwareLauncher
|
||||||
|
{
|
||||||
|
public static class ApplicationControl
|
||||||
|
{
|
||||||
|
public static void Shutdown(int exitCode)
|
||||||
|
{
|
||||||
|
Startup.trayIcon.Destroy();
|
||||||
|
Environment.Exit(exitCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ namespace VMwareLauncher
|
|||||||
{
|
{
|
||||||
public class CheckDependencies
|
public class CheckDependencies
|
||||||
{
|
{
|
||||||
private BackgroundWorker performInitialChecks = new BackgroundWorker();
|
private readonly BackgroundWorker performInitialChecks = new BackgroundWorker();
|
||||||
|
|
||||||
public void PerformCheck()
|
public void PerformCheck()
|
||||||
{
|
{
|
||||||
@@ -14,10 +14,10 @@ namespace VMwareLauncher
|
|||||||
if (!File.Exists(ProcessControl.DefaultVmwarePath))
|
if (!File.Exists(ProcessControl.DefaultVmwarePath))
|
||||||
{
|
{
|
||||||
MessageHandler.Show(MessageHandler.MessageCode.VmwareNotInstalled);
|
MessageHandler.Show(MessageHandler.MessageCode.VmwareNotInstalled);
|
||||||
|
ApplicationControl.Shutdown(-1);
|
||||||
ApplicationControl.BlockingErrors = true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Determine if VML has ever run before.
|
// Determine if VML has ever run before.
|
||||||
string vmlPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\VmwareLauncher";
|
string vmlPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\VmwareLauncher";
|
||||||
string vmlKey = "HasBeenSetup";
|
string vmlKey = "HasBeenSetup";
|
||||||
@@ -27,9 +27,7 @@ namespace VMwareLauncher
|
|||||||
Registry.SetValue(vmlPath, vmlKey, 1);
|
Registry.SetValue(vmlPath, vmlKey, 1);
|
||||||
MessageHandler.Show(MessageHandler.MessageCode.WelcomeMessage);
|
MessageHandler.Show(MessageHandler.MessageCode.WelcomeMessage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Modify service status to manual.
|
|
||||||
ApplicationControl.BlockingErrors = Startup.serviceControl.ForceServicesManual();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System.Diagnostics;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -10,8 +7,11 @@ namespace VMwareLauncher
|
|||||||
public class ProcessControl
|
public class ProcessControl
|
||||||
{
|
{
|
||||||
public readonly static string DefaultVmwareExe = "vmware";
|
public readonly static string DefaultVmwareExe = "vmware";
|
||||||
public readonly static string DefaultVmwarePath = (string)Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation", "InstallPath", null) + $"{DefaultVmwareExe}.exe";
|
public readonly static string DefaultVmwarePath = (string) Microsoft.Win32.Registry.GetValue(
|
||||||
public readonly static string DefaultVmlPath = "vmwarelauncher";
|
@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation",
|
||||||
|
"InstallPath", null) +
|
||||||
|
$"{DefaultVmwareExe}.exe";
|
||||||
|
public readonly static string DefaultVmLauncherPath = "vmwarelauncher";
|
||||||
public string ProcessName { get; set; }
|
public string ProcessName { get; set; }
|
||||||
|
|
||||||
public void StartProcess()
|
public void StartProcess()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Windows;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("VMware Launcher")]
|
[assembly: AssemblyProduct("VMware Launcher")]
|
||||||
[assembly: AssemblyCopyright("Rebound Software - 2017")]
|
[assembly: AssemblyCopyright("Rebound Software - 2021")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -51,5 +51,5 @@ using System.Windows;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.0.0.0")]
|
[assembly: AssemblyVersion("2.0.9.5")]
|
||||||
[assembly: AssemblyFileVersion("2.0.0.0")]
|
[assembly: AssemblyFileVersion("2.0.9.5")]
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace VMwareLauncher
|
namespace VMwareLauncher
|
||||||
{
|
{
|
||||||
public class ServiceControl
|
public class ServiceControl
|
||||||
{
|
{
|
||||||
public static readonly List<string> DefaultVmwareServices = new List<string> { "VMnetDHCP", "VMUSBArbService", "VMware NAT Service", "VMwareHostd", "VMAuthdService" }; //Array of services to close
|
public static readonly List<string> VMwareServiceList = new List<string> //Array of services to close
|
||||||
public List<string> ServiceList { get; set; }
|
{
|
||||||
|
"VMnetDHCP",
|
||||||
|
"VMUSBArbService",
|
||||||
|
"VMware NAT Service",
|
||||||
|
"VMwareHostd",
|
||||||
|
"VMAuthdService" };
|
||||||
|
|
||||||
public bool ForceServicesManual()
|
public bool ForceServicesManual()
|
||||||
{
|
{
|
||||||
@@ -19,7 +21,7 @@ namespace VMwareLauncher
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var service in ServiceList)
|
foreach (var service in VMwareServiceList)
|
||||||
{
|
{
|
||||||
string currentService = winServices + "\\" + service;
|
string currentService = winServices + "\\" + service;
|
||||||
if ((int)Registry.GetValue(currentService, "Start", null) != 3)
|
if ((int)Registry.GetValue(currentService, "Start", null) != 3)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Windows;
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace VMwareLauncher
|
namespace VMwareLauncher
|
||||||
{
|
{
|
||||||
@@ -17,44 +16,27 @@ namespace VMwareLauncher
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
serviceControl.ServiceList = ServiceControl.DefaultVmwareServices;
|
ProcessControl vmWStationControl = new ProcessControl();
|
||||||
|
vmWStationControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
||||||
|
|
||||||
ProcessControl vmwareControl = new ProcessControl();
|
ProcessControl vmLauncherControl = new ProcessControl();
|
||||||
vmwareControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
vmLauncherControl.ProcessName = ProcessControl.DefaultVmLauncherPath;
|
||||||
|
|
||||||
ProcessControl vmlControl = new ProcessControl();
|
|
||||||
vmlControl.ProcessName = ProcessControl.DefaultVmlPath;
|
|
||||||
|
|
||||||
// Only continue if no errors have been detected.
|
|
||||||
checkDependencies.PerformCheck();
|
checkDependencies.PerformCheck();
|
||||||
if (ApplicationControl.BlockingErrors)
|
|
||||||
ApplicationControl.Shutdown();
|
|
||||||
|
|
||||||
if (!vmlControl.IsProcessRunning())
|
// Modify service status to manual.
|
||||||
|
serviceControl.ForceServicesManual();
|
||||||
|
|
||||||
|
if (!vmLauncherControl.IsProcessRunning())
|
||||||
{
|
{
|
||||||
statusWindow.Show();
|
statusWindow.Show();
|
||||||
trayIcon.Create();
|
trayIcon.Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vmwareControl.StartProcess();
|
vmWStationControl.StartProcess();
|
||||||
ApplicationControl.Shutdown();
|
ApplicationControl.Shutdown(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ApplicationControl
|
|
||||||
{
|
|
||||||
public static bool BlockingErrors { get; set; }
|
|
||||||
|
|
||||||
public static void Shutdown()
|
|
||||||
{
|
|
||||||
Startup.trayIcon.Destroy();
|
|
||||||
|
|
||||||
if (BlockingErrors)
|
|
||||||
Environment.Exit(1);
|
|
||||||
else
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace VMwareLauncher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (string service in Startup.serviceControl.ServiceList)
|
foreach (string service in ServiceControl.VMwareServiceList)
|
||||||
{
|
{
|
||||||
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
||||||
|
|
||||||
@@ -56,14 +56,14 @@ namespace VMwareLauncher
|
|||||||
sc.WaitForStatus(ServiceControllerStatus.Stopped);
|
sc.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApplicationControl.Shutdown();
|
ApplicationControl.Shutdown(0);
|
||||||
}
|
}
|
||||||
catch (Exception) { throw; }
|
catch (Exception) { throw; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadServices_DoWork(object sender, DoWorkEventArgs e)
|
private void LoadServices_DoWork(object sender, DoWorkEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (string service in Startup.serviceControl.ServiceList)
|
foreach (string service in ServiceControl.VMwareServiceList)
|
||||||
{
|
{
|
||||||
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
||||||
|
|
||||||
@@ -84,8 +84,6 @@ namespace VMwareLauncher
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void RunProcess_DoWork(object sender, DoWorkEventArgs e)
|
private void RunProcess_DoWork(object sender, DoWorkEventArgs e)
|
||||||
{
|
|
||||||
if (!ApplicationControl.BlockingErrors)
|
|
||||||
{
|
{
|
||||||
ProcessControl processControl = new ProcessControl();
|
ProcessControl processControl = new ProcessControl();
|
||||||
processControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
processControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
||||||
@@ -102,7 +100,6 @@ namespace VMwareLauncher
|
|||||||
}
|
}
|
||||||
stopServices.RunWorkerAsync();
|
stopServices.RunWorkerAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disable user from terminating application from close button.
|
/// Disable user from terminating application from close button.
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="ApplicationControl.cs" />
|
||||||
<Compile Include="CheckDependencies.cs" />
|
<Compile Include="CheckDependencies.cs" />
|
||||||
<Compile Include="ProcessControl.cs" />
|
<Compile Include="ProcessControl.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
|||||||
Reference in New Issue
Block a user