|
|
|
|
@ -215,40 +215,79 @@ namespace AM2RLauncher
|
|
|
|
|
/// <returns><see langword="true"/> if it is installed, <see langword="false"/> if not.</returns>
|
|
|
|
|
public static bool IsJavaInstalled()
|
|
|
|
|
{
|
|
|
|
|
string process = null;
|
|
|
|
|
string arguments = null;
|
|
|
|
|
|
|
|
|
|
if (currentPlatform.IsWinForms)
|
|
|
|
|
{
|
|
|
|
|
string process = "cmd.exe",
|
|
|
|
|
arguments = "/C java -version";
|
|
|
|
|
ProcessStartInfo javaStart = new ProcessStartInfo();
|
|
|
|
|
javaStart.FileName = process;
|
|
|
|
|
javaStart.Arguments = arguments;
|
|
|
|
|
javaStart.UseShellExecute = false;
|
|
|
|
|
javaStart.CreateNoWindow = true;
|
|
|
|
|
process = "cmd.exe";
|
|
|
|
|
arguments = "/C java -version";
|
|
|
|
|
}
|
|
|
|
|
else if (currentPlatform.IsGtk)
|
|
|
|
|
{
|
|
|
|
|
process = "java";
|
|
|
|
|
arguments = "-version";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProcessStartInfo javaStart = new ProcessStartInfo();
|
|
|
|
|
javaStart.FileName = process;
|
|
|
|
|
javaStart.Arguments = arguments;
|
|
|
|
|
javaStart.UseShellExecute = false;
|
|
|
|
|
javaStart.CreateNoWindow = true;
|
|
|
|
|
|
|
|
|
|
Process java = new Process();
|
|
|
|
|
|
|
|
|
|
java.StartInfo = javaStart;
|
|
|
|
|
Process java = new Process();
|
|
|
|
|
|
|
|
|
|
//this is primarily for linux, but could be happening on windows as well
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
java.Start();
|
|
|
|
|
java.StartInfo = javaStart;
|
|
|
|
|
|
|
|
|
|
java.WaitForExit();
|
|
|
|
|
}
|
|
|
|
|
catch (System.ComponentModel.Win32Exception)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//this is primarily for linux, but could be happening on windows as well
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
java.Start();
|
|
|
|
|
|
|
|
|
|
return java.ExitCode == 0;
|
|
|
|
|
java.WaitForExit();
|
|
|
|
|
}
|
|
|
|
|
else if (currentPlatform.IsGtk)
|
|
|
|
|
catch (System.ComponentModel.Win32Exception)
|
|
|
|
|
{
|
|
|
|
|
return true; // sorry linux users, either Eto, .net or GTK is dumb.
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return java.ExitCode == 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checks if command-line xdelta is installed on non-Windows systems.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns><see langword="true"/> if it is installed, <see langword="false"/> if not.</returns>
|
|
|
|
|
public static bool CheckIfXdeltaIsInstalled()
|
|
|
|
|
{
|
|
|
|
|
string process = "xdelta3";
|
|
|
|
|
string arguments = "-V";
|
|
|
|
|
|
|
|
|
|
ProcessStartInfo xdeltaStart = new ProcessStartInfo();
|
|
|
|
|
xdeltaStart.FileName = process;
|
|
|
|
|
xdeltaStart.Arguments = arguments;
|
|
|
|
|
xdeltaStart.UseShellExecute = false;
|
|
|
|
|
xdeltaStart.CreateNoWindow = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Process xdelta = new Process();
|
|
|
|
|
|
|
|
|
|
xdelta.StartInfo = xdeltaStart;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xdelta.Start();
|
|
|
|
|
|
|
|
|
|
xdelta.WaitForExit();
|
|
|
|
|
}
|
|
|
|
|
catch (System.ComponentModel.Win32Exception)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return xdelta.ExitCode == 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|