예제 #1
0
 protected WmiEventSink(ManagementOperationObserver watcher, object context, ManagementScope scope, string path, string className)
 {
     try
     {
         this.context   = context;
         this.watcher   = watcher;
         this.className = className;
         this.isLocal   = false;
         if (path != null)
         {
             this.path = new ManagementPath(path);
             if ((string.Compare(this.path.Server, ".", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.path.Server, Environment.MachineName, StringComparison.OrdinalIgnoreCase) == 0))
             {
                 this.isLocal = true;
             }
         }
         if (scope != null)
         {
             this.scope = scope.Clone();
             if ((path == null) && ((string.Compare(this.scope.Path.Server, ".", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.scope.Path.Server, Environment.MachineName, StringComparison.OrdinalIgnoreCase) == 0)))
             {
                 this.isLocal = true;
             }
         }
         WmiNetUtilsHelper.GetDemultiplexedStub_f(this, this.isLocal, out this.stub);
         this.hash = Interlocked.Increment(ref s_hash);
     }
     catch
     {
     }
 }
        //Constructor
        internal ManagementObjectCollection(
            ManagementScope scope,
            EnumerationOptions options,
            IEnumWbemClassObject enumWbem)
        {
            if (null != options)
            {
                this.options = (EnumerationOptions)options.Clone();
            }
            else
            {
                this.options = new EnumerationOptions();
            }

            if (null != scope)
            {
                this.scope = (ManagementScope)scope.Clone();
            }
            else
            {
                this.scope = ManagementScope._Clone(null);
            }

            this.enumWbem = enumWbem;
        }
 protected WmiEventSink(ManagementOperationObserver watcher, object context, ManagementScope scope, string path, string className)
 {
     try
     {
         this.context = context;
         this.watcher = watcher;
         this.className = className;
         this.isLocal = false;
         if (path != null)
         {
             this.path = new ManagementPath(path);
             if ((string.Compare(this.path.Server, ".", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.path.Server, Environment.MachineName, StringComparison.OrdinalIgnoreCase) == 0))
             {
                 this.isLocal = true;
             }
         }
         if (scope != null)
         {
             this.scope = scope.Clone();
             if ((path == null) && ((string.Compare(this.scope.Path.Server, ".", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.scope.Path.Server, Environment.MachineName, StringComparison.OrdinalIgnoreCase) == 0)))
             {
                 this.isLocal = true;
             }
         }
         WmiNetUtilsHelper.GetDemultiplexedStub_f(this, this.isLocal, out this.stub);
         this.hash = Interlocked.Increment(ref s_hash);
     }
     catch
     {
     }
 }
 internal ManagementObjectCollection(ManagementScope scope, EnumerationOptions options, IEnumWbemClassObject enumWbem)
 {
     if (options != null)
     {
         this.options = (EnumerationOptions) options.Clone();
     }
     else
     {
         this.options = new EnumerationOptions();
     }
     if (scope != null)
     {
         this.scope = scope.Clone();
     }
     else
     {
         this.scope = ManagementScope._Clone(null);
     }
     this.enumWbem = enumWbem;
 }
예제 #5
0
        protected WmiEventSink(ManagementOperationObserver watcher,
                               object context,
                               ManagementScope scope,
                               string path,
                               string className)
        {
            try
            {
                this.context   = context;
                this.watcher   = watcher;
                this.className = className;
                this.isLocal   = false;

                if (null != path)
                {
                    this.path = new ManagementPath(path);
                    if ((0 == string.Compare(this.path.Server, ".", StringComparison.OrdinalIgnoreCase)) ||
                        (0 == string.Compare(this.path.Server, System.Environment.MachineName, StringComparison.OrdinalIgnoreCase)))
                    {
                        this.isLocal = true;
                    }
                }

                if (null != scope)
                {
                    this.scope = (ManagementScope)scope.Clone();
                    if (null == path) // use scope to see if sink is local
                    {
                        if ((0 == string.Compare(this.scope.Path.Server, ".", StringComparison.OrdinalIgnoreCase)) ||
                            (0 == string.Compare(this.scope.Path.Server, System.Environment.MachineName, StringComparison.OrdinalIgnoreCase)))
                        {
                            this.isLocal = true;
                        }
                    }
                }

                WmiNetUtilsHelper.GetDemultiplexedStub_f(this, this.isLocal, out stub);
                hash = Threading.Interlocked.Increment(ref s_hash);
            }
            catch { }
        }
예제 #6
0
 /// <summary>
 /// Connect to a given ManagementScope.
 /// </summary>
 /// <param name="mScope">ManagementScope object to be connected to.</param>
 public Provider(ManagementScope mScope)
 {
     mScope = mScope.Clone();
 }
예제 #7
0
        //internal IWbemServices GetIWbemServices () {
        //  return scope.GetIWbemServices ();
        //}

        //internal ConnectionOptions Connection {
        //  get { return scope.Connection; }
        //}

        //Constructor
        internal ManagementObjectCollection(
            ManagementScope scope,
            EnumerationOptions options, 
            IEnumWbemClassObject enumWbem)
        {
            if (null != options)
                this.options = (EnumerationOptions) options.Clone();
            else
                this.options = new EnumerationOptions ();

            if (null != scope)
                this.scope = (ManagementScope)scope.Clone ();
            else
                this.scope = ManagementScope._Clone(null);

            this.enumWbem = enumWbem;
        }