Beispiel #1
0
        /// <summary>
        /// Creates an instance of AsmHelper for working with assembly dynamically loaded to non-current AppDomain.
        /// This mathod initialises instance and creates new ('remote') AppDomain with 'domainName' name. New AppDomain is automatically unloaded as result of "disposable" behaviour of AsmHelper.
        /// </summary>
        /// <param name="asmFile">File name of the assembly to be loaded.</param>
        /// <param name="domainName">Name of the domain to be created.</param>
        /// <param name="deleteOnExit">'true' if assembly file should be deleted when new AppDomain is unloaded; otherwise, 'false'.</param>
        public AsmHelper(string asmFile, string domainName, bool deleteOnExit)
        {
            this.deleteOnExit = deleteOnExit;
            AppDomainSetup setup = new AppDomainSetup();

            setup.ApplicationBase       = Path.GetDirectoryName(asmFile);
            setup.PrivateBinPath        = AppDomain.CurrentDomain.BaseDirectory;
            setup.ApplicationName       = Path.GetFileName(Assembly.GetExecutingAssembly().Location);
            setup.ShadowCopyFiles       = "true";
            setup.ShadowCopyDirectories = Path.GetDirectoryName(asmFile);
            remoteAppDomain             = AppDomain.CreateDomain(domainName, null, setup);

            AsmRemoteBrowser asmBrowser = (AsmRemoteBrowser)remoteAppDomain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location, typeof(AsmRemoteBrowser).ToString());

            asmBrowser.asmFile = asmFile;
            this.asmBrowser    = (IAsmBrowser)asmBrowser;
        }
Beispiel #2
0
		/// <summary>
		/// Creates an instance of AsmHelper for working with assembly dynamically loaded to non-current AppDomain. 
		/// This mathod initialises instance and creates new ('remote') AppDomain with 'domainName' name. New AppDomain is automatically unloaded as result of "disposable" behaviour of AsmHelper.
		/// </summary>
		/// <param name="asmFile">File name of the assembly to be loaded.</param>
		/// <param name="domainName">Name of the domain to be created.</param>
		/// <param name="deleteOnExit">'true' if assembly file should be deleted when new AppDomain is unloaded; otherwise, 'false'.</param>
		public AsmHelper(string asmFile, string domainName, bool deleteOnExit)
		{
			this.deleteOnExit = deleteOnExit;
			AppDomainSetup setup = new AppDomainSetup();
			setup.ApplicationBase = Path.GetDirectoryName(asmFile);
			setup.PrivateBinPath = AppDomain.CurrentDomain.BaseDirectory;
			setup.ApplicationName = Path.GetFileName(Assembly.GetExecutingAssembly().Location);
			setup.ShadowCopyFiles = "true";
			setup.ShadowCopyDirectories = Path.GetDirectoryName(asmFile);
			remoteAppDomain = AppDomain.CreateDomain(domainName, null, setup);
	
			AsmRemoteBrowser asmBrowser = (AsmRemoteBrowser)remoteAppDomain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location, typeof(AsmRemoteBrowser).ToString());
			asmBrowser.asmFile = asmFile;
			this.asmBrowser = (IAsmBrowser)asmBrowser;
		}
Beispiel #3
0
 /// <summary>
 /// Creates an instance of AsmHelper for working with assembly dynamically loaded to current AppDomain.
 /// Calling "Dispose" is optional for "current AppDomain"scenario as no new AppDomain will be ever created.
 /// </summary>
 /// <param name="asm">Assembly object.</param>
 public AsmHelper(Assembly asm)
 {
     this.asmBrowser = (IAsmBrowser)(new AsmBrowser(asm));
 }
Beispiel #4
0
		/// <summary>
		/// Creates an instance of AsmHelper for working with assembly dynamically loaded to current AppDomain. 
		/// Calling "Dispose" is optional for "current AppDomain"scenario as no new AppDomain will be ever created.
		/// </summary>
		/// <param name="asm">Assembly object.</param>
		public AsmHelper(Assembly asm)
		{
			this.asmBrowser = (IAsmBrowser)(new AsmBrowser(asm));
		}