aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/MainStartup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ServerApplication/MainStartup.cs')
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs102
1 files changed, 6 insertions, 96 deletions
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 63d2cf30d..fb4fb86ff 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -256,10 +256,7 @@ namespace MediaBrowser.ServerApplication
{
Task.WaitAll(task);
- task = InstallVcredistIfNeeded(_appHost, _logger);
- Task.WaitAll(task);
-
- task = InstallFrameworkV46IfNeeded(_logger);
+ task = InstallVcredist2013IfNeeded(_appHost, _logger);
Task.WaitAll(task);
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
@@ -594,94 +591,7 @@ namespace MediaBrowser.ServerApplication
}
}
- private static async Task InstallFrameworkV46IfNeeded(ILogger logger)
- {
- bool installFrameworkV46 = false;
-
- try
- {
- using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)
- .OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\"))
- {
- if (ndpKey != null && ndpKey.GetValue("Release") != null)
- {
- if ((int)ndpKey.GetValue("Release") <= 393295)
- {
- //Found framework V4, but not yet V4.6
- installFrameworkV46 = true;
- }
- }
- else
- {
- //Nothing found in the registry for V4
- installFrameworkV46 = true;
- }
- }
- }
- catch (Exception ex)
- {
- logger.ErrorException("Error getting .NET Framework version", ex);
- }
-
- _logger.Info(".NET Framework 4.6 found: {0}", !installFrameworkV46);
-
- if (installFrameworkV46)
- {
- try
- {
- await InstallFrameworkV46().ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- logger.ErrorException("Error installing .NET Framework version 4.6", ex);
- }
- }
- }
-
- private static async Task InstallFrameworkV46()
- {
- var httpClient = _appHost.HttpClient;
-
- var tmp = await httpClient.GetTempFile(new HttpRequestOptions
- {
- Url = "https://github.com/MediaBrowser/Emby.Resources/raw/master/netframeworkV46/NDP46-KB3045560-Web.exe",
- Progress = new Progress<double>()
-
- }).ConfigureAwait(false);
-
- var exePath = Path.ChangeExtension(tmp, ".exe");
- File.Copy(tmp, exePath);
-
- var startInfo = new ProcessStartInfo
- {
- FileName = exePath,
-
- CreateNoWindow = true,
- WindowStyle = ProcessWindowStyle.Hidden,
- Verb = "runas",
- ErrorDialog = false,
- Arguments = "/q /norestart"
- };
-
-
- _logger.Info("Running {0}", startInfo.FileName);
-
- using (var process = Process.Start(startInfo))
- {
- process.WaitForExit();
- //process.ExitCode
- /*
- 0 --> Installation completed successfully.
- 1602 --> The user canceled installation.
- 1603 --> A fatal error occurred during installation.
- 1641 --> A restart is required to complete the installation. This message indicates success.
- 3010 --> A restart is required to complete the installation. This message indicates success.
- 5100 --> The user's computer does not meet system requirements.
- */
- }
- }
-
- private static async Task InstallVcredistIfNeeded(ApplicationHost appHost, ILogger logger)
+ private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger)
{
try
{
@@ -695,7 +605,7 @@ namespace MediaBrowser.ServerApplication
try
{
- await InstallVcredist().ConfigureAwait(false);
+ await InstallVcredist2013().ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -703,13 +613,13 @@ namespace MediaBrowser.ServerApplication
}
}
- private async static Task InstallVcredist()
+ private async static Task InstallVcredist2013()
{
var httpClient = _appHost.HttpClient;
var tmp = await httpClient.GetTempFile(new HttpRequestOptions
{
- Url = GetVcredistUrl(),
+ Url = GetVcredist2013Url(),
Progress = new Progress<double>()
}).ConfigureAwait(false);
@@ -735,7 +645,7 @@ namespace MediaBrowser.ServerApplication
}
}
- private static string GetVcredistUrl()
+ private static string GetVcredist2013Url()
{
if (Environment.Is64BitProcess)
{