You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/src/NzbDrone.Mono/MonoRuntimeProvider.cs

42 lines
1020 B

using System;
using System.Reflection;
using NLog;
using NzbDrone.Common.Processes;
namespace NzbDrone.Mono
{
public class MonoRuntimeProvider : IRuntimeProvider
{
private readonly Logger _logger;
public MonoRuntimeProvider(Logger logger)
{
_logger = logger;
}
public String GetVersion()
{
try
{
var type = Type.GetType("Mono.Runtime");
if (type != null)
{
var displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
if (displayName != null)
{
return displayName.Invoke(null, null).ToString();
}
}
}
catch (Exception ex)
{
_logger.ErrorException("Unable to get mono version: " + ex.Message, ex);
}
return String.Empty;
}
}
}