/// <summary> /// /// </summary> /// <param name="filePath"></param> /// <param name="useAppDomain"></param> /// <returns></returns> private AssemblyWrapper CreateAssemblyWrapper(string filePath, bool useAppDomain) { if (useAppDomain) { var domain = AppDomain.CreateDomain(filePath); var inst = domain.CreateInstance(this.GetType().Assembly.FullName, typeof(AssemblyWrapper).FullName); var wrapper = (AssemblyWrapper)inst.Unwrap(); wrapper.LoadAssembly(filePath); return(wrapper); } else { var wrapper = new AssemblyWrapper(); wrapper.LoadAssembly(filePath); return(wrapper); } }
public ManifestAssemblyWrapper(string serviceName, string platform, string assemblyPath, bool useNewAppDomain) { var docId = NDocUtilities.GenerateDocId(serviceName, platform); if (useNewAppDomain) { Domain = AppDomain.CreateDomain(assemblyPath); var inst = Domain.CreateInstance(this.GetType().Assembly.FullName, typeof(AssemblyWrapper).FullName, true, BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance, null, new object[] { docId }, null, null); SdkAssembly = (AssemblyWrapper)inst.Unwrap(); SdkAssembly.LoadAssembly(assemblyPath); } else { SdkAssembly = new AssemblyWrapper(docId); SdkAssembly.LoadAssembly(assemblyPath); } }
/// <summary> /// /// </summary> /// <param name="filePath"></param> /// <param name="useAppDomain"></param> /// <returns></returns> private AssemblyWrapper CreateAssemblyWrapper(string filePath, bool useAppDomain) { var docId = NDocUtilities.GenerateDocId(ServiceName, Options.Platform); if (useAppDomain) { var domain = AppDomain.CreateDomain(filePath); var inst = domain.CreateInstance(this.GetType().Assembly.FullName, typeof(AssemblyWrapper).FullName, true, BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance, null, new object[] { docId }, null, null); var wrapper = (AssemblyWrapper)inst.Unwrap(); wrapper.LoadAssembly(filePath); return(wrapper); } else { var wrapper = new AssemblyWrapper(docId); wrapper.LoadAssembly(filePath); return(wrapper); } }
/// <summary> /// /// </summary> /// <param name="filePath"></param> /// <param name="useAppDomain"></param> /// <returns></returns> private AssemblyWrapper CreateAssemblyWrapper(string filePath, bool useAppDomain) { var docId = NDocUtilities.GenerateDocId(ServiceName, Options.Platform); if (useAppDomain) { var domain = AppDomain.CreateDomain(filePath); var inst = domain.CreateInstance( this.GetType().Assembly.FullName, typeof(AssemblyWrapper).FullName, true, BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance, null, new object[] {docId}, null, null); var wrapper = (AssemblyWrapper)inst.Unwrap(); wrapper.LoadAssembly(filePath); return wrapper; } else { var wrapper = new AssemblyWrapper(docId); wrapper.LoadAssembly(filePath); return wrapper; } }
/// <summary> /// /// </summary> /// <param name="filePath"></param> /// <param name="useAppDomain"></param> /// <returns></returns> private AssemblyWrapper CreateAssemblyWrapper(string filePath, bool useAppDomain) { if (useAppDomain) { var domain = AppDomain.CreateDomain(filePath); var inst = domain.CreateInstance(this.GetType().Assembly.FullName, typeof(AssemblyWrapper).FullName); var wrapper = (AssemblyWrapper)inst.Unwrap(); wrapper.LoadAssembly(filePath); return wrapper; } else { var wrapper = new AssemblyWrapper(); wrapper.LoadAssembly(filePath); return wrapper; } }