diff --git a/Pechkin/Factory.cs b/Pechkin/Factory.cs index 4a38fd1..283f983 100644 --- a/Pechkin/Factory.cs +++ b/Pechkin/Factory.cs @@ -39,12 +39,6 @@ public static class Factory /// private static AppDomain operatingDomain = null; - /// - /// In case we are running in .NET debug, the actual location of the - /// Pechkin assembly (not in the .NET temp folders) - /// - private static String realAssemblyLocation = null; - /// /// A thread used to invoke all calls to the wkhtmltopdf library /// so that multi-threaded applications can use Pechkin @@ -232,11 +226,9 @@ public static IPechkin Create(GlobalConfig config) Factory.SetupAppDomain(); } - String location = Factory.realAssemblyLocation ?? Assembly.GetExecutingAssembly().Location; - ObjectHandle handle = Activator.CreateInstanceFrom( Factory.operatingDomain, - location, + Assembly.GetExecutingAssembly().Location, typeof(SimplePechkin).FullName, false, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, @@ -283,57 +275,10 @@ private static void SetupAppDomain() Factory.synchronizer = new SynchronizedDispatcherThread(); } - String binPath = String.Empty; - - if (!String.IsNullOrEmpty(AppDomain.CurrentDomain.RelativeSearchPath)) - { - String[] paths = AppDomain.CurrentDomain.RelativeSearchPath.Split(';'); - - for (var i = 0; i < paths.Length; i++) - { - paths[i].Remove(0, AppDomain.CurrentDomain.BaseDirectory.Length); - } - - binPath = String.Join(";", paths); - } - - Factory.operatingDomain = AppDomain.CreateDomain("pechkin_internal_domain", null, - new AppDomainSetup - { - ApplicationBase = AppDomain.CurrentDomain.BaseDirectory, - // Sometimes, like in a web app, your bin folder is not the same - // as the base dir. - PrivateBinPath = binPath - }); - - if (binPath != String.Empty) - { - Factory.operatingDomain.SetData("assemblyLocation", Assembly.GetExecutingAssembly().Location); - - Factory.operatingDomain.DoCallBack(() => - { - String location = AppDomain.CurrentDomain.GetData("assemblyLocation").ToString(); - String filename = System.IO.Path.GetFileName(location); - List paths = new List(AppDomain.CurrentDomain.RelativeSearchPath.Split(';')); - - foreach (String path in paths.ToArray()) - { - paths.Remove(path); - paths.AddRange(System.IO.Directory.GetFiles(path, filename)); - } - - Assembly.LoadFrom(paths[0]); + var dirName = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var setup = new AppDomainSetup() { ApplicationBase = dirName }; + Factory.operatingDomain = AppDomain.CreateDomain("pechkin_internal_domain", null, setup); - AppDomain.CurrentDomain.SetData("assemblyLocation", paths[0]); - }); - - Factory.realAssemblyLocation = Factory.operatingDomain.GetData("assemblyLocation").ToString(); - } - else - { - Factory.operatingDomain.Load(Assembly.GetExecutingAssembly().FullName); - } - Func del = () => { Factory.operatingDomain.SetData("useX11Graphics", Factory.useX11Graphics); diff --git a/Pechkin/Properties/AssemblyInfo.cs b/Pechkin/Properties/AssemblyInfo.cs index 56a6c4c..6df2a1c 100644 --- a/Pechkin/Properties/AssemblyInfo.cs +++ b/Pechkin/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.9.3.0")] -[assembly: AssemblyFileVersion("0.9.3.0")] +[assembly: AssemblyVersion("0.9.3.1")] +[assembly: AssemblyFileVersion("0.9.3.1")]