2013-08-16 02:20:54 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
2013-08-31 01:42:30 +00:00
|
|
|
|
using NzbDrone.Common.Instrumentation;
|
2013-08-16 02:20:54 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Host
|
|
|
|
|
{
|
|
|
|
|
public static class PlatformValidation
|
|
|
|
|
{
|
2013-08-31 01:42:30 +00:00
|
|
|
|
private static readonly Logger Logger = NzbDroneLogger.GetLogger();
|
2013-08-16 02:20:54 +00:00
|
|
|
|
|
|
|
|
|
public static bool IsValidate(IUserAlert userAlert)
|
|
|
|
|
{
|
|
|
|
|
if (OsInfo.IsMono)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!IsAssemblyAvailable("System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"))
|
|
|
|
|
{
|
|
|
|
|
userAlert.Alert("It looks like you don't have full version of .NET Framework installed. You will now be directed the download page.");
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Process.Start("http://www.microsoft.com/en-ca/download/details.aspx?id=30653");
|
|
|
|
|
}
|
2014-05-31 22:11:33 +00:00
|
|
|
|
catch (Exception)
|
2013-08-16 02:20:54 +00:00
|
|
|
|
{
|
|
|
|
|
userAlert.Alert("Oops. can't start default browser. Please visit http://www.microsoft.com/en-ca/download/details.aspx?id=30653 to download .NET Framework 4.5.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static bool IsAssemblyAvailable(string assemblyString)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Assembly.Load(assemblyString);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Logger.Warn("Couldn't load {0}", e.Message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|