replace file system calls with IFileSystem when needed

This commit is contained in:
Luke Pulverenti
2013-10-31 10:03:23 -04:00
parent 579b507f7f
commit 6c8d919298
80 changed files with 570 additions and 302 deletions

View File

@@ -17,6 +17,7 @@ using System.Security.Cryptography.X509Certificates;
using Gtk;
using Gdk;
using System.Threading.Tasks;
using System.Reflection;
namespace MediaBrowser.Server.Mono
{
@@ -203,6 +204,8 @@ namespace MediaBrowser.Server.Mono
logger.Info("Server: {0}", Environment.MachineName);
logger.Info("Operating system: {0}", Environment.OSVersion.ToString());
MonoBug11817WorkAround.Apply ();
}
/// <summary>
@@ -280,4 +283,34 @@ namespace MediaBrowser.Server.Mono
return true;
}
}
public class MonoBug11817WorkAround
{
public static void Apply()
{
var property = typeof(TimeZoneInfo).GetProperty("TimeZoneDirectory", BindingFlags.Static | BindingFlags.NonPublic);
if (property == null) return;
var zoneInfo = FindZoneInfoFolder();
property.SetValue(null, zoneInfo, new object[0]);
}
public static string FindZoneInfoFolder()
{
var current = new DirectoryInfo(Directory.GetCurrentDirectory());
while(current != null)
{
var zoneinfoTestPath = Path.Combine(current.FullName, "zoneinfo");
if (Directory.Exists(zoneinfoTestPath))
return zoneinfoTestPath;
current = current.Parent;
}
return null;
}
}
}