mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
install 2015 vcredist
This commit is contained in:
parent
6fd86f61cb
commit
260f2da0a1
1 changed files with 74 additions and 40 deletions
|
@ -380,6 +380,9 @@ namespace MediaBrowser.ServerApplication
|
||||||
task = InstallVcredist2013IfNeeded(_appHost, _logger);
|
task = InstallVcredist2013IfNeeded(_appHost, _logger);
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
|
|
||||||
|
task = InstallVcredist2015IfNeeded(_appHost, _logger);
|
||||||
|
Task.WaitAll(task);
|
||||||
|
|
||||||
Microsoft.Win32.SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
|
Microsoft.Win32.SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
|
||||||
|
|
||||||
HideSplashScreen();
|
HideSplashScreen();
|
||||||
|
@ -736,31 +739,6 @@ namespace MediaBrowser.ServerApplication
|
||||||
Process.Start(startInfo);
|
Process.Start(startInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CanRestartWindowsService()
|
|
||||||
{
|
|
||||||
var startInfo = new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = "cmd.exe",
|
|
||||||
CreateNoWindow = true,
|
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
|
||||||
Verb = "runas",
|
|
||||||
ErrorDialog = false,
|
|
||||||
Arguments = String.Format("/c sc query {0}", BackgroundService.GetExistingServiceName())
|
|
||||||
};
|
|
||||||
using (var process = Process.Start(startInfo))
|
|
||||||
{
|
|
||||||
process.WaitForExit();
|
|
||||||
if (process.ExitCode == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger)
|
private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger)
|
||||||
{
|
{
|
||||||
// Reference
|
// Reference
|
||||||
|
@ -791,9 +769,11 @@ namespace MediaBrowser.ServerApplication
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("The Visual C++ 2013 Runtime will now be installed.");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await InstallVcredist2013().ConfigureAwait(false);
|
await InstallVcredist(GetVcredist2013Url()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -801,13 +781,79 @@ namespace MediaBrowser.ServerApplication
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async static Task InstallVcredist2013()
|
private static string GetVcredist2013Url()
|
||||||
|
{
|
||||||
|
if (Environment.Is64BitProcess)
|
||||||
|
{
|
||||||
|
return "https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2013/vcredist_x64.exe";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: ARM url - https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2013/vcredist_arm.exe
|
||||||
|
|
||||||
|
return "https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2013/vcredist_x86.exe";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task InstallVcredist2015IfNeeded(ApplicationHost appHost, ILogger logger)
|
||||||
|
{
|
||||||
|
// Reference
|
||||||
|
// http://stackoverflow.com/questions/12206314/detect-if-visual-c-redistributable-for-visual-studio-2012-is-installed
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var subkey = Environment.Is64BitProcess
|
||||||
|
? "SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\x64"
|
||||||
|
: "SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\x86";
|
||||||
|
|
||||||
|
using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Default)
|
||||||
|
.OpenSubKey(subkey))
|
||||||
|
{
|
||||||
|
if (ndpKey != null && ndpKey.GetValue("Version") != null)
|
||||||
|
{
|
||||||
|
var installedVersion = ((string)ndpKey.GetValue("Version")).TrimStart('v');
|
||||||
|
if (installedVersion.StartsWith("14", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.ErrorException("Error getting .NET Framework version", ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("The Visual C++ 2015 Runtime will now be installed.");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await InstallVcredist(GetVcredist2015Url()).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.ErrorException("Error installing Visual Studio C++ runtime", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetVcredist2015Url()
|
||||||
|
{
|
||||||
|
if (Environment.Is64BitProcess)
|
||||||
|
{
|
||||||
|
return "https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2015/vc_redist.x64.exe";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: ARM url - https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2015/vcredist_arm.exe
|
||||||
|
|
||||||
|
return "https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2015/vc_redist.x86.exe";
|
||||||
|
}
|
||||||
|
|
||||||
|
private async static Task InstallVcredist(string url)
|
||||||
{
|
{
|
||||||
var httpClient = _appHost.HttpClient;
|
var httpClient = _appHost.HttpClient;
|
||||||
|
|
||||||
var tmp = await httpClient.GetTempFile(new HttpRequestOptions
|
var tmp = await httpClient.GetTempFile(new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = GetVcredist2013Url(),
|
Url = url,
|
||||||
Progress = new Progress<double>()
|
Progress = new Progress<double>()
|
||||||
|
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
|
@ -833,18 +879,6 @@ namespace MediaBrowser.ServerApplication
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetVcredist2013Url()
|
|
||||||
{
|
|
||||||
if (Environment.Is64BitProcess)
|
|
||||||
{
|
|
||||||
return "https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2013/vcredist_x64.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: ARM url - https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2013/vcredist_arm.exe
|
|
||||||
|
|
||||||
return "https://github.com/MediaBrowser/Emby.Resources/raw/master/vcredist2013/vcredist_x86.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the error mode.
|
/// Sets the error mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in a new issue