private void SetWorkingDirectory() { if (!string.IsNullOrEmpty(HostSetup.WorkingDirectory)) { currentDirectorySwitcher = new CurrentDirectorySwitcher(HostSetup.WorkingDirectory); } }
/// <inheritdoc /> protected override void Dispose(bool disposing) { if (assemblyLoader != null) { assemblyLoader.Dispose(); assemblyLoader = null; } if (currentDirectorySwitcher != null) { currentDirectorySwitcher.Dispose(); currentDirectorySwitcher = null; } base.Dispose(disposing); }
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; } }
/// <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); } }