//parameterized /// <summary> /// <para>Constructs a new options object to be used for a WMI /// connection with the specified values.</para> /// </summary> /// <param name='locale'>Indicates the locale to be used for this connection</param> /// <param name=' username'>Specifies the user name to be used for the connection. If null the currently logged on user's credentials are used.</param> /// <param name=' password'>Specifies the password for the given username. If null the currently logged on user's credentials are used.</param> /// <param name=' authority'><para>The authority to be used to authenticate the specified user</para></param> /// <param name=' impersonation'>The DCOM impersonation level to be used for this connection</param> /// <param name=' authentication'>The DCOM authentication level to be used for this connection</param> /// <param name=' enablePrivileges'>Specifies whether to enable special user privileges. This should only be used when performing an operation that requires special NT user privileges.</param> /// <param name=' context'>A provider-specific named value pairs object to be passed through to the provider.</param> /// <param name=' timeout'>Reserved for future use.</param> public ConnectionOptions(string locale, string username, string password, string authority, ImpersonationLevel impersonation, AuthenticationLevel authentication, bool enablePrivileges, ManagementNamedValueCollection context, TimeSpan timeout) : base(context, timeout) { if (locale != null) { this.locale = locale; } this.username = username; this.enablePrivileges = enablePrivileges; this.password = new EncryptedData(password); if (authority != null) { this.authority = authority; } if (impersonation != 0) { this.impersonation = impersonation; } if (authentication != 0) { this.authentication = authentication; } }
public ManagementNamedValueCollection Clone() { ManagementNamedValueCollection managementNamedValueCollection = new ManagementNamedValueCollection(); foreach (string str in this) { object obj = base.BaseGet(str); if (obj == null) { managementNamedValueCollection.Add(str, null); } else { Type type = obj.GetType(); if (!type.IsByRef) { managementNamedValueCollection.Add(str, obj); } else { try { object obj1 = ((ICloneable)obj).Clone(); managementNamedValueCollection.Add(str, obj1); } catch { throw new NotSupportedException(); } } } } return managementNamedValueCollection; }
public ManagementNamedValueCollection Clone() { ManagementNamedValueCollection result = new ManagementNamedValueCollection(); foreach (string key in Keys) { object value = BaseGet(key); if (value == null) { result.Add(key, value); continue; } if (value is ICloneable) { result.Add(key, ((ICloneable)value).Clone()); } else { result.Add(key, value); } } return(result); }
public ManagementNamedValueCollection Clone() { ManagementNamedValueCollection values = new ManagementNamedValueCollection(); foreach (string str in this) { object obj2 = base.BaseGet(str); if (obj2 != null) { if (obj2.GetType().IsByRef) { try { object obj3 = ((ICloneable)obj2).Clone(); values.Add(str, obj3); continue; } catch { throw new NotSupportedException(); } } values.Add(str, obj2); } else { values.Add(str, null); } } return(values); }
public ManagementNamedValueCollection Clone() { ManagementNamedValueCollection managementNamedValueCollection = new ManagementNamedValueCollection(); foreach (string str in this) { object obj = base.BaseGet(str); if (obj == null) { managementNamedValueCollection.Add(str, null); } else { Type type = obj.GetType(); if (!type.IsByRef) { managementNamedValueCollection.Add(str, obj); } else { try { object obj1 = ((ICloneable)obj).Clone(); managementNamedValueCollection.Add(str, obj1); } catch { throw new NotSupportedException(); } } } } return(managementNamedValueCollection); }
public ManagementNamedValueCollection Clone() { ManagementNamedValueCollection values = new ManagementNamedValueCollection(); foreach (string str in this) { object obj2 = base.BaseGet(str); if (obj2 != null) { if (obj2.GetType().IsByRef) { try { object obj3 = ((ICloneable) obj2).Clone(); values.Add(str, obj3); continue; } catch { throw new NotSupportedException(); } } values.Add(str, obj2); } else { values.Add(str, null); } } return values; }
public ConnectionOptions(string locale, string username, string password, string authority, ImpersonationLevel impersonation, AuthenticationLevel authentication, bool enablePrivileges, ManagementNamedValueCollection context, TimeSpan timeout) : base(context, timeout) { if (locale != null) { this.locale = locale; } this.username = username; this.enablePrivileges = enablePrivileges; if (password != null) { this.securePassword = new SecureString(); for (int i = 0; i < password.Length; i++) { this.securePassword.AppendChar(password[i]); } } if (authority != null) { this.authority = authority; } if (impersonation != ImpersonationLevel.Default) { this.impersonation = impersonation; } if (authentication != AuthenticationLevel.Default) { this.authentication = authentication; } }
public override object Clone() { ManagementNamedValueCollection context = null; if (base.Context != null) { context = base.Context.Clone(); } return(new ObjectGetOptions(context, base.Timeout, this.UseAmendedQualifiers)); }
public override object Clone() { ManagementNamedValueCollection context = null; if (base.Context != null) { context = base.Context.Clone(); } return(new InvokeMethodOptions(context, base.Timeout)); }
public override object Clone() { ManagementNamedValueCollection context = null; if (base.Context != null) { context = base.Context.Clone(); } return(new EnumerationOptions(context, base.Timeout, this.blockSize, this.Rewindable, this.ReturnImmediately, this.UseAmendedQualifiers, this.EnsureLocatable, this.PrototypeOnly, this.DirectRead, this.EnumerateDeep)); }
public override object Clone() { ManagementNamedValueCollection managementNamedValueCollection = null; if (base.Context != null) { managementNamedValueCollection = base.Context.Clone(); } return(new PutOptions(managementNamedValueCollection, base.Timeout, this.UseAmendedQualifiers, this.Type)); }
public override object Clone() { ManagementNamedValueCollection managementNamedValueCollection = null; if (base.Context != null) { managementNamedValueCollection = base.Context.Clone(); } return(new ConnectionOptions(this.locale, this.username, this.GetSecurePassword(), this.authority, this.impersonation, this.authentication, this.enablePrivileges, managementNamedValueCollection, base.Timeout)); }
public override object Clone() { ManagementNamedValueCollection managementNamedValueCollection = null; if (base.Context != null) { managementNamedValueCollection = base.Context.Clone(); } return(new EventWatcherOptions(managementNamedValueCollection, base.Timeout, this.blockSize)); }
public override object Clone() { ManagementNamedValueCollection managementNamedValueCollection = null; if (base.Context != null) { managementNamedValueCollection = base.Context.Clone(); } return(new DeleteOptions(managementNamedValueCollection, base.Timeout)); }
public EnumerationOptions(ManagementNamedValueCollection context, TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep) : base(context, timeout) { this.BlockSize = blockSize; this.Rewindable = rewindable; this.ReturnImmediately = returnImmediatley; this.UseAmendedQualifiers = useAmendedQualifiers; this.EnsureLocatable = ensureLocatable; this.PrototypeOnly = prototypeOnly; this.DirectRead = directRead; this.EnumerateDeep = enumerateDeep; }
/// <summary> /// Creates a copy of this options object. /// </summary> public override object Clone() { ManagementNamedValueCollection newContext = null; if (null != Context) { newContext = (ManagementNamedValueCollection)Context.Clone(); } return(new EventWatcherOptions(newContext, Timeout, blockSize)); }
/// <summary> /// <para>Creates a copy of this options object.</para> /// </summary> public override object Clone() { ManagementNamedValueCollection newContext = null; if (null != Context) { newContext = (ManagementNamedValueCollection)Context.Clone(); } return(new InvokeMethodOptions(newContext, Timeout)); }
/// <summary> /// Creates a copy of this options object. /// </summary> public override object Clone() { ManagementNamedValueCollection newContext = null; if (null != Context) { newContext = (ManagementNamedValueCollection)Context.Clone(); } return(new PutOptions(newContext, Timeout, UseAmendedQualifiers, Type)); }
public ConnectionOptions (string locale, string username, string password, string authority, ImpersonationLevel impersonation, AuthenticationLevel authentication, bool enablePrivileges, ManagementNamedValueCollection context, TimeSpan timeout) { }
public ConnectionOptions(string locale, string username, SecureString password, string authority, ImpersonationLevel impersonation, AuthenticationLevel authentication, bool enablePrivileges, ManagementNamedValueCollection context, TimeSpan timeout) { }
public EnumerationOptions (ManagementNamedValueCollection context, TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep) { }
public EnumerationOptions(ManagementNamedValueCollection context, TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep) { }
/// <summary> /// <para>Creates a copy of this options object.</para> /// </summary> /// <returns> /// The clone. /// </returns> public override object Clone() { ManagementNamedValueCollection newContext = null; if (null != Context) { newContext = (ManagementNamedValueCollection)Context.Clone(); } return(new EnumerationOptions(newContext, Timeout, blockSize, Rewindable, ReturnImmediately, UseAmendedQualifiers, EnsureLocatable, PrototypeOnly, DirectRead, EnumerateDeep)); }
/// <summary> /// Creates a copy of this options object. /// </summary> public override object Clone() { ManagementNamedValueCollection newContext = null; if (null != Context) { newContext = (ManagementNamedValueCollection)Context.Clone(); } return(new ConnectionOptions(locale, username, GetPassword(), authority, impersonation, authentication, enablePrivileges, newContext, Timeout)); }
public int GetCount (string username, string password, string nameSpace, string filter) { var context = new ManagementNamedValueCollection(); ManagementScope scope = new ManagementScope(GetScopeString("localhost", nameSpace), new ConnectionOptions("en-US", username, password, "", ImpersonationLevel.Default, AuthenticationLevel.Default, true, context, TimeSpan.FromSeconds (60))); { ObjectQuery query = new ObjectQuery(filter); using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query, new EnumerationOptions(context, TimeSpan.FromSeconds (60), 4096, true, true, true, false, false, true, true))) { return searcher.Get ().Count; } } }
internal ManagementOptions(ManagementNamedValueCollection context, TimeSpan timeout, int flags) { this.flags = flags; if (context != null) { this.Context = context; } else { this.context = null; } this.Timeout = timeout; }
public IEnumerable<object> Get (string username, string password, string nameSpace, string filter) { var context = new ManagementNamedValueCollection(); ManagementScope scope = new ManagementScope(GetScopeString("localhost", nameSpace), new ConnectionOptions("en-US", username, password, "", ImpersonationLevel.Default, AuthenticationLevel.Default, true, context, TimeSpan.FromSeconds (60))); { ObjectQuery query = new ObjectQuery(filter); using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query, new EnumerationOptions(context, TimeSpan.FromSeconds (60), 4096, true, true, true, false, false, true, true))) { foreach(ManagementBaseObject obj in searcher.Get()) { yield return ToEndointAddress(obj, _isLocal); } } } }
public ManagementNamedValueCollection Clone () { ManagementNamedValueCollection result = new ManagementNamedValueCollection (); foreach (string key in Keys) { object value = BaseGet (key); if (value == null) { result.Add (key, value); continue; } if (value is ICloneable) { result.Add (key, ((ICloneable) value).Clone ()); } else { result.Add (key, value); } } return result; }
/// <summary> /// <para>Creates a clone of the collection. Individual values /// are cloned. If a value does not support cloning, then a <see cref='System.NotSupportedException'/> /// is thrown. </para> /// </summary> /// <returns> /// The new copy of the collection. /// </returns> public ManagementNamedValueCollection Clone() { ManagementNamedValueCollection nvc = new ManagementNamedValueCollection(); foreach (string name in this) { // If we can clone the value, do so. Otherwise throw. object val = base.BaseGet(name); if (null != val) { Type valueType = val.GetType(); if (valueType.IsByRef) { try { object clonedValue = ((ICloneable)val).Clone(); nvc.Add(name, clonedValue); } catch { throw new NotSupportedException(); } } else { nvc.Add(name, val); } } else { nvc.Add(name, null); } } return(nvc); }
public DeleteOptions (ManagementNamedValueCollection context, TimeSpan timeout) { }
public ObjectGetOptions (ManagementNamedValueCollection context) { }
public PutOptions(ManagementNamedValueCollection context, TimeSpan timeout, bool useAmendedQualifiers, PutType putType) : base(context, timeout) { this.UseAmendedQualifiers = useAmendedQualifiers; this.Type = putType; }
public InvokeMethodOptions(ManagementNamedValueCollection context, TimeSpan timeout) : base(context, timeout) { }
internal ConnectionOptions(ManagementNamedValueCollection context, TimeSpan timeout, int flags) : base(context, timeout, flags) {}
/// <summary> /// <para>Initializes a new instance of the <see cref='System.Management.ObjectGetOptions'/> class for getting a WMI object, /// using the given options values.</para> /// </summary> /// <param name='context'>A provider-specific, named-value pairs context object to be passed through to the provider.</param> /// <param name=' timeout'>The length of time to let the operation perform before it times out. The default is <see cref='System.Management.ManagementOptions.InfiniteTimeout'/> .</param> /// <param name=' useAmendedQualifiers'><see langword='true'/> if the returned objects should contain amended (locale-aware) qualifiers; otherwise, <see langword='false'/>. </param> public ObjectGetOptions(ManagementNamedValueCollection context, TimeSpan timeout, bool useAmendedQualifiers) : base(context, timeout) { UseAmendedQualifiers = useAmendedQualifiers; }
public PutOptions(ManagementNamedValueCollection context) : this(context, ManagementOptions.InfiniteTimeout, false, (PutType)3) { }
public PutOptions (ManagementNamedValueCollection context, TimeSpan timeout, bool useAmendedQualifiers, PutType putType) { }
internal ConnectionOptions(ManagementNamedValueCollection context, TimeSpan timeout, int flags) : base(context, timeout, flags) { }
internal ConnectionOptions(ManagementNamedValueCollection context) : base(context, InfiniteTimeout) {}
internal ManagementOptions(ManagementNamedValueCollection context, TimeSpan timeout) : this(context, timeout, 0) {}
/// <summary> /// <para> Initializes a new instance of the <see cref='System.Management.EventWatcherOptions'/> class with the given /// values.</para> /// </summary> /// <param name='context'>The options context object containing provider-specific information to be passed through to the provider. </param> /// <param name=' timeout'>The timeout to wait for the next events.</param> /// <param name=' blockSize'>The number of events to wait for in each block.</param> public EventWatcherOptions(ManagementNamedValueCollection context, TimeSpan timeout, int blockSize) : base(context, timeout) { Flags = (int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_RETURN_IMMEDIATELY|(int)tag_WBEM_GENERIC_FLAG_TYPE.WBEM_FLAG_FORWARD_ONLY; BlockSize = blockSize; }
/// <summary> /// <para>Initializes a new instance of the <see cref='System.Management.ObjectGetOptions'/> class for getting a WMI object, using the /// specified provider-specific context.</para> /// </summary> /// <param name='context'>A provider-specific, named-value pairs context object to be passed through to the provider.</param> public ObjectGetOptions(ManagementNamedValueCollection context) : this(context, InfiniteTimeout, false) {}
public PutOptions(ManagementNamedValueCollection context, TimeSpan timeout, bool useAmendedQualifiers, PutType putType) { }
public PutOptions (ManagementNamedValueCollection context) { }
//parameterized /// <summary> /// <para> Initializes a new instance of the <see cref='System.Management.ConnectionOptions'/> class to be used for a WMI /// connection, using the specified values.</para> /// </summary> /// <param name='locale'>The locale to be used for the connection.</param> /// <param name=' username'>The user name to be used for the connection. If null, the credentials of the currently logged-on user are used.</param> /// <param name=' securepassword'>The secure password for the given user name. If the user name is also null, the credentials used will be those of the currently logged-on user.</param> /// <param name=' authority'><para>The authority to be used to authenticate the specified user.</para></param> /// <param name=' impersonation'>The COM impersonation level to be used for the connection.</param> /// <param name=' authentication'>The COM authentication level to be used for the connection.</param> /// <param name=' enablePrivileges'><see langword='true'/>to enable special user privileges; otherwise, <see langword='false'/> . This parameter should only be used when performing an operation that requires special Windows NT user privileges.</param> /// <param name=' context'>A provider-specific, named value pairs object to be passed through to the provider.</param> /// <param name=' timeout'>Reserved for future use.</param> public ConnectionOptions (string locale, string username, SecureString password, string authority, ImpersonationLevel impersonation, AuthenticationLevel authentication, bool enablePrivileges, ManagementNamedValueCollection context, TimeSpan timeout) : base (context, timeout) { if (locale != null) this.locale = locale; this.username = username; this.enablePrivileges = enablePrivileges; if (password != null) { this.securePassword = password.Copy(); } if (authority != null) this.authority = authority; if (impersonation != 0) this.impersonation = impersonation; if (authentication != 0) this.authentication = authentication; }
public PutOptions(ManagementNamedValueCollection context) : this(context, ManagementOptions.InfiniteTimeout, false, PutType.UpdateOrCreate) { }
internal ManagementOptions (ManagementNamedValueCollection context, TimeSpan timeout) { this.context = context; this.timeout = timeout; }
public ConnectionOptions(string locale, string username, SecureString password, string authority, ImpersonationLevel impersonation, AuthenticationLevel authentication, bool enablePrivileges, ManagementNamedValueCollection context, TimeSpan timeout) : base(context, timeout) { if (locale != null) { this.locale = locale; } this.username = username; this.enablePrivileges = enablePrivileges; if (password != null) { this.securePassword = password.Copy(); } if (authority != null) { this.authority = authority; } if (impersonation != ImpersonationLevel.Default) { this.impersonation = impersonation; } if (authentication != AuthenticationLevel.Default) { this.authentication = authentication; } }
public ObjectGetOptions(ManagementNamedValueCollection context, TimeSpan timeout, bool useAmendedQualifiers) : base(context, timeout) { this.UseAmendedQualifiers = useAmendedQualifiers; }
internal ConnectionOptions(ManagementNamedValueCollection context) : base(context, ManagementOptions.InfiniteTimeout) { }
internal ManagementOptions(ManagementNamedValueCollection context, TimeSpan timeout) : this(context, timeout, 0) { }
public PutOptions(ManagementNamedValueCollection context) { }
/// <summary> /// <para>Creates a clone of the collection. Individual values /// are cloned. If a value does not support cloning, then a <see cref='System.NotSupportedException'/> /// is thrown. </para> /// </summary> /// <returns> /// The new copy of the collection. /// </returns> public ManagementNamedValueCollection Clone () { ManagementNamedValueCollection nvc = new ManagementNamedValueCollection(); foreach (string name in this) { // If we can clone the value, do so. Otherwise throw. object val = base.BaseGet (name); if (null != val) { Type valueType = val.GetType (); if (valueType.IsByRef) { try { object clonedValue = ((ICloneable)val).Clone (); nvc.Add (name, clonedValue); } catch { throw new NotSupportedException (); } } else { nvc.Add (name, val); } } else nvc.Add (name, null); } return nvc; }
public EventWatcherOptions(ManagementNamedValueCollection context, TimeSpan timeout, int blockSize) : base(context, timeout) { this.blockSize = 1; base.Flags = 48; this.BlockSize = blockSize; }