|
|
|
@ -1,13 +1,17 @@
|
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Windows.EnvironmentInfo
|
|
|
|
|
{
|
|
|
|
|
public class DotNetPlatformInfo : PlatformInfo
|
|
|
|
|
{
|
|
|
|
|
public DotNetPlatformInfo()
|
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
public DotNetPlatformInfo(Logger logger)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
var version = GetFrameworkVersion();
|
|
|
|
|
Environment.SetEnvironmentVariable("RUNTIME_VERSION", version.ToString());
|
|
|
|
|
Version = version;
|
|
|
|
@ -15,7 +19,9 @@ namespace NzbDrone.Windows.EnvironmentInfo
|
|
|
|
|
|
|
|
|
|
public override Version Version { get; }
|
|
|
|
|
|
|
|
|
|
private static Version GetFrameworkVersion()
|
|
|
|
|
private Version GetFrameworkVersion()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
|
|
|
|
|
using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey))
|
|
|
|
@ -51,9 +57,14 @@ namespace NzbDrone.Windows.EnvironmentInfo
|
|
|
|
|
{
|
|
|
|
|
return new Version(4, 5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
_logger.Error(e, "Couldnt get .NET framework version");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Version(4, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|