2014-07-25 06:37:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using NLog;
|
2014-07-30 06:23:43 +00:00
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
2014-07-25 06:37:32 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Mono
|
|
|
|
|
{
|
2014-07-30 06:23:43 +00:00
|
|
|
|
public class MonoRuntimeProvider : RuntimeInfoBase
|
2014-07-25 06:37:32 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
2014-07-30 06:23:43 +00:00
|
|
|
|
public MonoRuntimeProvider(Common.IServiceProvider serviceProvider, Logger logger)
|
|
|
|
|
:base(serviceProvider, logger)
|
2014-07-25 06:37:32 +00:00
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-30 06:23:43 +00:00
|
|
|
|
public override String RuntimeVersion
|
2014-07-25 06:37:32 +00:00
|
|
|
|
{
|
2014-07-30 06:23:43 +00:00
|
|
|
|
get
|
2014-07-25 06:37:32 +00:00
|
|
|
|
{
|
2014-07-30 06:23:43 +00:00
|
|
|
|
try
|
2014-07-25 06:37:32 +00:00
|
|
|
|
{
|
2014-07-30 06:23:43 +00:00
|
|
|
|
var type = Type.GetType("Mono.Runtime");
|
2014-07-25 06:37:32 +00:00
|
|
|
|
|
2014-07-30 06:23:43 +00:00
|
|
|
|
if (type != null)
|
2014-07-25 06:37:32 +00:00
|
|
|
|
{
|
2014-07-30 06:23:43 +00:00
|
|
|
|
var displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
|
|
|
|
|
|
|
|
|
|
if (displayName != null)
|
|
|
|
|
{
|
|
|
|
|
return displayName.Invoke(null, null).ToString();
|
|
|
|
|
}
|
2014-07-25 06:37:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-30 06:23:43 +00:00
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.ErrorException("Unable to get mono version: " + ex.Message, ex);
|
|
|
|
|
}
|
2014-07-25 06:37:32 +00:00
|
|
|
|
|
2014-07-30 06:23:43 +00:00
|
|
|
|
return String.Empty;
|
|
|
|
|
}
|
2014-07-25 06:37:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|