示例#1
0
        private const int CAT_DEFAULT = 1;      // default tracing event category

        #region Initializating, reinitializating and closing runspace
        /// <summary>
        /// Initializes a new instance of the <see cref="PowerShellSupport" /> class.
        /// </summary>
        /// <param name="localSnapinNames">Local snapins to be loaded</param>
        /// <param name="useRemoteSession">Whether to use remote session (e.g. for managing Exchange)</param>
        /// <param name="createRunspaceMethod">A method used to create a new runspace (if null, a default implementation is used)</param>
        /// <param name="messageCatalog">The message catalog used for conveying localized messages.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="messageCatalog"/> is null.</exception>
        public PowerShellSupport(IList <string> localSnapinNames, CreateRunspaceDelegate createRunspaceMethod, ConnectorMessages messageCatalog)
        {
            Assertions.NullCheck(messageCatalog, "messageCatalog");
            _messageCatalog   = messageCatalog;
            _localSnapinNames = localSnapinNames;
            _runSpacePool     = new MyRunspacePool(createRunspaceMethod ?? DefaultRunspaceCreateMethod);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PowerShellSupport" /> class.
 /// </summary>
 /// <param name="localSnapinNames">Local snapins to be loaded</param>
 /// <param name="useRemoteSession">Whether to use remote session (e.g. for managing Exchange)</param>
 /// <param name="createRunspaceMethod">A method used to create a new runspace (if null, a default implementation is used)</param>
 /// <param name="messageCatalog">The message catalog used for conveying localized messages.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="messageCatalog"/> is null.</exception>
 public PowerShellSupport(IList<string> localSnapinNames, CreateRunspaceDelegate createRunspaceMethod, ConnectorMessages messageCatalog)
 {
     Assertions.NullCheck(messageCatalog, "messageCatalog");
     _messageCatalog = messageCatalog;
     _localSnapinNames = localSnapinNames;
     _runSpacePool = new MyRunspacePool(createRunspaceMethod ?? DefaultRunspaceCreateMethod);
 }