예제 #1
0
 private void SetWorkingDirectory()
 {
     if (!string.IsNullOrEmpty(HostSetup.WorkingDirectory))
     {
         currentDirectorySwitcher = new CurrentDirectorySwitcher(HostSetup.WorkingDirectory);
     }
 }
예제 #2
0
        /// <inheritdoc />
        protected override void Dispose(bool disposing)
        {
            if (assemblyLoader != null)
            {
                assemblyLoader.Dispose();
                assemblyLoader = null;
            }

            if (currentDirectorySwitcher != null)
            {
                currentDirectorySwitcher.Dispose();
                currentDirectorySwitcher = null;
            }

            base.Dispose(disposing);
        }
예제 #3
0
 private void ResetWorkingDirectory()
 {
     try
     {
         if (currentDirectorySwitcher != null)
         {
             currentDirectorySwitcher.Dispose();
         }
     }
     catch (Exception ex)
     {
         Logger.Log(LogSeverity.Warning, "Could not reset working directory.", ex);
     }
     finally
     {
         currentDirectorySwitcher = null;
     }
 }
예제 #4
0
        /// <summary>
        /// Creates a local host.
        /// </summary>
        /// <param name="hostSetup">The host setup.</param>
        /// <param name="logger">The logger for host message output.</param>
        /// <param name="debuggerManager">The debugger manager.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="hostSetup"/>, <paramref name="logger"/>
        /// or <paramref name="debuggerManager"/> is null.</exception>
        public LocalHost(HostSetup hostSetup, ILogger logger, IDebuggerManager debuggerManager)
            : base(hostSetup, logger)
        {
            if (debuggerManager == null)
            {
                throw new ArgumentNullException("debuggerManager");
            }

            this.debuggerManager = debuggerManager;

            if (!string.IsNullOrEmpty(hostSetup.WorkingDirectory))
            {
                currentDirectorySwitcher = new CurrentDirectorySwitcher(hostSetup.WorkingDirectory);
            }

            if (hostSetup.HintDirectories.Count != 0)
            {
                assemblyLoader = new DefaultAssemblyLoader();
                GenericCollectionUtils.ForEach(hostSetup.HintDirectories, assemblyLoader.AddHintDirectory);
            }
        }