internal static ObjectGetOptions _Clone(ObjectGetOptions options, IdentifierChangedEventHandler handler) { ObjectGetOptions objectGetOption; if (options == null) { objectGetOption = new ObjectGetOptions(); } else { objectGetOption = new ObjectGetOptions(options.context, options.timeout, options.UseAmendedQualifiers); } if (handler == null) { if (options != null) { objectGetOption.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); } } else { objectGetOption.IdentifierChanged += handler; } return(objectGetOption); }
internal static ManagementScope _Clone(ManagementScope scope, IdentifierChangedEventHandler handler) { ManagementScope scopeTmp = new ManagementScope(null, null, null, null); // Wire up change handler chain. Use supplied handler, if specified; // otherwise, default to that of the scope argument. if (handler != null) { scopeTmp.IdentifierChanged = handler; } else if (scope != null) { scopeTmp.IdentifierChanged = new IdentifierChangedEventHandler(scope.HandleIdentifierChange); } // Set scope path. if (scope == null) { // No path specified. Default. scopeTmp.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); scopeTmp.IsDefaulted = true; scopeTmp.wbemServices = null; scopeTmp.options = null; // scopeTmp.securityHelper = null; // BUGBUG : should this allocate a new object? } else { if (scope.prvpath == null) { // No path specified. Default. scopeTmp.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); scopeTmp.IsDefaulted = true; } else { // Use scope-supplied path. scopeTmp.prvpath = ManagementPath._Clone(scope.prvpath, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); scopeTmp.IsDefaulted = scope.IsDefaulted; } scopeTmp.wbemServices = scope.wbemServices; if (scope.options != null) { scopeTmp.options = ConnectionOptions._Clone(scope.options, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); } // scopeTmp.securityHelper = scope.securityHelper; // BUGBUG : should this allocate a new one? } return(scopeTmp); }
internal static ManagementPath _Clone(ManagementPath path, IdentifierChangedEventHandler handler) { ManagementPath path2 = new ManagementPath(); if (handler != null) { path2.IdentifierChanged = handler; } if ((path != null) && (path.wmiPath != null)) { path2.wmiPath = path.wmiPath; path2.isWbemPathShared = path.isWbemPathShared = true; } return path2; }
internal static ManagementPath _Clone(ManagementPath path, IdentifierChangedEventHandler handler) { ManagementPath path2 = new ManagementPath(); if (handler != null) { path2.IdentifierChanged = handler; } if ((path != null) && (path.wmiPath != null)) { path2.wmiPath = path.wmiPath; path2.isWbemPathShared = path.isWbemPathShared = true; } return(path2); }
internal static ConnectionOptions _Clone(ConnectionOptions options, IdentifierChangedEventHandler handler) { ConnectionOptions options2; if (options != null) { options2 = new ConnectionOptions(options.Context, options.Timeout, options.Flags) { locale = options.locale, username = options.username, enablePrivileges = options.enablePrivileges }; if (options.securePassword != null) { options2.securePassword = options.securePassword.Copy(); } else { options2.securePassword = null; } if (options.authority != null) { options2.authority = options.authority; } if (options.impersonation != ImpersonationLevel.Default) { options2.impersonation = options.impersonation; } if (options.authentication != AuthenticationLevel.Default) { options2.authentication = options.authentication; } } else { options2 = new ConnectionOptions(); } if (handler != null) { options2.IdentifierChanged += handler; return(options2); } if (options != null) { options2.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); } return(options2); }
internal static ConnectionOptions _Clone(ConnectionOptions options, IdentifierChangedEventHandler handler) { ConnectionOptions connectionOption; if (options == null) { connectionOption = new ConnectionOptions(); } else { connectionOption = new ConnectionOptions(options.Context, options.Timeout, options.Flags); connectionOption.locale = options.locale; connectionOption.username = options.username; connectionOption.enablePrivileges = options.enablePrivileges; if (options.securePassword == null) { connectionOption.securePassword = null; } else { connectionOption.securePassword = options.securePassword.Copy(); } if (options.authority != null) { connectionOption.authority = options.authority; } if (options.impersonation != ImpersonationLevel.Default) { connectionOption.impersonation = options.impersonation; } if (options.authentication != AuthenticationLevel.Default) { connectionOption.authentication = options.authentication; } } if (handler == null) { if (options != null) { connectionOption.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); } } else { connectionOption.IdentifierChanged += handler; } return(connectionOption); }
internal static ManagementPath _Clone(ManagementPath path, IdentifierChangedEventHandler handler) { ManagementPath managementPath = new ManagementPath(); if (handler != null) { managementPath.IdentifierChanged = handler; } if (path != null && path.wmiPath != null) { managementPath.wmiPath = path.wmiPath; bool flag = true; bool flag1 = flag; path.isWbemPathShared = flag; managementPath.isWbemPathShared = flag1; } return(managementPath); }
internal static ManagementScope _Clone(ManagementScope scope, IdentifierChangedEventHandler handler) { ManagementScope managementScope = new ManagementScope(null, null, null); if (handler == null) { if (scope != null) { managementScope.IdentifierChanged = new IdentifierChangedEventHandler(scope.HandleIdentifierChange); } } else { managementScope.IdentifierChanged = handler; } if (scope != null) { if (scope.prvpath != null) { managementScope.prvpath = ManagementPath._Clone(scope.prvpath, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); managementScope.IsDefaulted = scope.IsDefaulted; } else { managementScope.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); managementScope.IsDefaulted = true; } managementScope.wbemServices = scope.wbemServices; if (scope.options != null) { managementScope.options = ConnectionOptions._Clone(scope.options, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); } } else { managementScope.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); managementScope.IsDefaulted = true; managementScope.wbemServices = null; managementScope.options = null; } return(managementScope); }
internal static ManagementPath _Clone(ManagementPath path, IdentifierChangedEventHandler handler) { ManagementPath pathTmp = new ManagementPath(); // Wire up change handler chain. Use supplied handler, if specified; // otherwise, default to that of the path argument. if (handler != null) { pathTmp.IdentifierChanged = handler; } // Assign ManagementPath IWbemPath to this.wmiPath. // Optimization for performance : As long as the path is only read, we share this interface. // On the first write, a private copy will be needed; // isWbemPathShared signals ManagementPath to create such a copy at write-time. if (path != null && path.wmiPath != null) { pathTmp.wmiPath = path.wmiPath; pathTmp.isWbemPathShared = path.isWbemPathShared = true; } return(pathTmp); }
internal static ObjectGetOptions _Clone(ObjectGetOptions options, IdentifierChangedEventHandler handler) { ObjectGetOptions objectGetOption; if (options == null) { objectGetOption = new ObjectGetOptions(); } else { objectGetOption = new ObjectGetOptions(options.context, options.timeout, options.UseAmendedQualifiers); } if (handler == null) { if (options != null) { objectGetOption.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); } } else { objectGetOption.IdentifierChanged += handler; } return objectGetOption; }
internal static ManagementScope _Clone(ManagementScope scope, IdentifierChangedEventHandler handler) { ManagementScope scope2 = new ManagementScope(null, null, null); if (handler != null) { scope2.IdentifierChanged = handler; } else if (scope != null) { scope2.IdentifierChanged = new IdentifierChangedEventHandler(scope.HandleIdentifierChange); } if (scope == null) { scope2.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(scope2.HandleIdentifierChange)); scope2.IsDefaulted = true; scope2.wbemServices = null; scope2.options = null; return scope2; } if (scope.prvpath == null) { scope2.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(scope2.HandleIdentifierChange)); scope2.IsDefaulted = true; } else { scope2.prvpath = ManagementPath._Clone(scope.prvpath, new IdentifierChangedEventHandler(scope2.HandleIdentifierChange)); scope2.IsDefaulted = scope.IsDefaulted; } scope2.wbemServices = scope.wbemServices; if (scope.options != null) { scope2.options = ConnectionOptions._Clone(scope.options, new IdentifierChangedEventHandler(scope2.HandleIdentifierChange)); } return scope2; }
internal static ObjectGetOptions _Clone(ObjectGetOptions options, IdentifierChangedEventHandler handler) { ObjectGetOptions optionsTmp; if (options != null) optionsTmp = new ObjectGetOptions(options.context, options.timeout, options.UseAmendedQualifiers); else optionsTmp = new ObjectGetOptions(); // Wire up change handler chain. Use supplied handler, if specified; // otherwise, default to that of the path argument. if (handler != null) optionsTmp.IdentifierChanged += handler; else if (options != null) optionsTmp.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); return optionsTmp; }
void ManagementObjectCTOR(ManagementScope scope, ManagementPath path, ObjectGetOptions options) { // We may use this to set the scope path string nsPath = String.Empty; if ((null != path) && !path.IsEmpty) { //If this is a ManagementObject then the path has to be an instance, // and if this is a ManagementClass the path has to be a class. if (GetType() == typeof(ManagementObject) && path.IsClass) throw new ArgumentOutOfRangeException("path"); else if (GetType() == typeof(ManagementClass) && path.IsInstance) throw new ArgumentOutOfRangeException("path"); // Save the namespace path portion of the path (if any) in case // we don't have a scope nsPath = path.GetNamespacePath((int)tag_WBEM_GET_TEXT_FLAGS.WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY); if ((null != scope) && (scope.Path.NamespacePath.Length>0)) { // If the scope has a path too, the namespace portion of // scope.path takes precedence over what is specified in path path = new ManagementPath(path.RelativePath); path.NamespacePath = scope.Path.GetNamespacePath((int)tag_WBEM_GET_TEXT_FLAGS.WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY); } // If the supplied path is a class or instance use it, otherwise // leave it empty if (path.IsClass || path.IsInstance) this.path = ManagementPath._Clone(path, new IdentifierChangedEventHandler(HandleIdentifierChange)); else this.path = ManagementPath._Clone(null, new IdentifierChangedEventHandler(HandleIdentifierChange)); } if (null != options) this.options = ObjectGetOptions._Clone(options, new IdentifierChangedEventHandler(HandleIdentifierChange)); if (null != scope) this.scope = ManagementScope._Clone(scope, new IdentifierChangedEventHandler(HandleIdentifierChange)); else { // Use the path if possible, otherwise let it default if (nsPath.Length>0) { this.scope = new ManagementScope(nsPath); this.scope.IdentifierChanged += new IdentifierChangedEventHandler(HandleIdentifierChange); } } //register for identifier change events IdentifierChanged += new IdentifierChangedEventHandler(HandleIdentifierChange); // *** // * Changed isBound flag to wbemObject==null check. // * isBound = false; // *** putButNotGot = false; }
internal static ConnectionOptions _Clone(ConnectionOptions options, IdentifierChangedEventHandler handler) { ConnectionOptions optionsTmp; if (options != null) { optionsTmp = new ConnectionOptions(options.Context, options.Timeout, options.Flags); optionsTmp.locale = options.locale; optionsTmp.username = options.username; optionsTmp.enablePrivileges = options.enablePrivileges; if (options.securePassword != null) { optionsTmp.securePassword = options.securePassword.Copy(); } else optionsTmp.securePassword = null; if (options.authority != null) optionsTmp.authority = options.authority; if (options.impersonation != 0) optionsTmp.impersonation = options.impersonation; if (options.authentication != 0) optionsTmp.authentication = options.authentication; } else optionsTmp = new ConnectionOptions(); // Wire up change handler chain. Use supplied handler, if specified; // otherwise, default to that of the path argument. if (handler != null) optionsTmp.IdentifierChanged += handler; else if (options != null) optionsTmp.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); return optionsTmp; }
internal static ConnectionOptions _Clone(ConnectionOptions options, IdentifierChangedEventHandler handler) { ConnectionOptions connectionOption; if (options == null) { connectionOption = new ConnectionOptions(); } else { connectionOption = new ConnectionOptions(options.Context, options.Timeout, options.Flags); connectionOption.locale = options.locale; connectionOption.username = options.username; connectionOption.enablePrivileges = options.enablePrivileges; if (options.securePassword == null) { connectionOption.securePassword = null; } else { connectionOption.securePassword = options.securePassword.Copy(); } if (options.authority != null) { connectionOption.authority = options.authority; } if (options.impersonation != ImpersonationLevel.Default) { connectionOption.impersonation = options.impersonation; } if (options.authentication != AuthenticationLevel.Default) { connectionOption.authentication = options.authentication; } } if (handler == null) { if (options != null) { connectionOption.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); } } else { connectionOption.IdentifierChanged += handler; } return connectionOption; }
internal static ManagementScope _Clone(ManagementScope scope, IdentifierChangedEventHandler handler) { ManagementScope managementScope = new ManagementScope(null, null, null); if (handler == null) { if (scope != null) { managementScope.IdentifierChanged = new IdentifierChangedEventHandler(scope.HandleIdentifierChange); } } else { managementScope.IdentifierChanged = handler; } if (scope != null) { if (scope.prvpath != null) { managementScope.prvpath = ManagementPath._Clone(scope.prvpath, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); managementScope.IsDefaulted = scope.IsDefaulted; } else { managementScope.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); managementScope.IsDefaulted = true; } managementScope.wbemServices = scope.wbemServices; if (scope.options != null) { managementScope.options = ConnectionOptions._Clone(scope.options, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); } } else { managementScope.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(managementScope.HandleIdentifierChange)); managementScope.IsDefaulted = true; managementScope.wbemServices = null; managementScope.options = null; } return managementScope; }
internal static ManagementScope _Clone(ManagementScope scope, IdentifierChangedEventHandler handler) { ManagementScope scopeTmp = new ManagementScope(null, null, null); // Wire up change handler chain. Use supplied handler, if specified; // otherwise, default to that of the scope argument. if (handler != null) scopeTmp.IdentifierChanged = handler; else if (scope != null) scopeTmp.IdentifierChanged = new IdentifierChangedEventHandler(scope.HandleIdentifierChange); // Set scope path. if (scope == null) { // No path specified. Default. scopeTmp.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); scopeTmp.IsDefaulted = true; scopeTmp.wbemServices = null; scopeTmp.options = null; // scopeTmp.securityHelper = null; // } else { if (scope.prvpath == null) { // No path specified. Default. scopeTmp.prvpath = ManagementPath._Clone(ManagementPath.DefaultPath, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); scopeTmp.IsDefaulted = true; } else { // Use scope-supplied path. scopeTmp.prvpath = ManagementPath._Clone(scope.prvpath, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); scopeTmp.IsDefaulted = scope.IsDefaulted; } scopeTmp.wbemServices = scope.wbemServices; if (scope.options != null) scopeTmp.options = ConnectionOptions._Clone(scope.options, new IdentifierChangedEventHandler(scopeTmp.HandleIdentifierChange)); // scopeTmp.securityHelper = scope.securityHelper; // } return scopeTmp; }
internal static ManagementPath _Clone(ManagementPath path, IdentifierChangedEventHandler handler) { ManagementPath managementPath = new ManagementPath(); if (handler != null) { managementPath.IdentifierChanged = handler; } if (path != null && path.wmiPath != null) { managementPath.wmiPath = path.wmiPath; bool flag = true; bool flag1 = flag; path.isWbemPathShared = flag; managementPath.isWbemPathShared = flag1; } return managementPath; }
internal static ManagementPath _Clone(ManagementPath path, IdentifierChangedEventHandler handler) { ManagementPath pathTmp = new ManagementPath(); // Wire up change handler chain. Use supplied handler, if specified; // otherwise, default to that of the path argument. if (handler != null) pathTmp.IdentifierChanged = handler; // Assign ManagementPath IWbemPath to this.wmiPath. // Optimization for performance : As long as the path is only read, we share this interface. // On the first write, a private copy will be needed; // isWbemPathShared signals ManagementPath to create such a copy at write-time. if (path != null && path.wmiPath != null) { pathTmp.wmiPath = path.wmiPath; pathTmp.isWbemPathShared = path.isWbemPathShared = true; } return pathTmp; }
internal static ConnectionOptions _Clone(ConnectionOptions options, IdentifierChangedEventHandler handler) { ConnectionOptions options2; if (options != null) { options2 = new ConnectionOptions(options.Context, options.Timeout, options.Flags) { locale = options.locale, username = options.username, enablePrivileges = options.enablePrivileges }; if (options.securePassword != null) { options2.securePassword = options.securePassword.Copy(); } else { options2.securePassword = null; } if (options.authority != null) { options2.authority = options.authority; } if (options.impersonation != ImpersonationLevel.Default) { options2.impersonation = options.impersonation; } if (options.authentication != AuthenticationLevel.Default) { options2.authentication = options.authentication; } } else { options2 = new ConnectionOptions(); } if (handler != null) { options2.IdentifierChanged += handler; return options2; } if (options != null) { options2.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange); } return options2; }