Esempio n. 1
0
        internal WmiClass(WmiNamespace wmiNamespace, string name, bool checkIfExists)
        {
            Check.ArgumentNull(wmiNamespace, nameof(wmiNamespace));
            Check.ArgumentNull(name, nameof(name));
            Check.ArgumentEx.StringNotEmpty(name, nameof(name));

            Namespace = wmiNamespace;
            Name      = name;

            if (checkIfExists && !CSharp.Try(() => GetManagementClass().ClassPath != null))
            {
                throw Throw.Management("Class '" + name + "' could not be retrieved.");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WmiClass" /> class with the specified <see cref="WmiNamespace" /> and the specified name.
 /// </summary>
 /// <param name="wmiNamespace">The WMI namespace of this class, in accordance to the <paramref name="name" /> parameter.</param>
 /// <param name="name">The name of the <see cref="WmiClass" />.</param>
 public WmiClass(WmiNamespace wmiNamespace, string name) : this(wmiNamespace, name, true)
 {
 }