Exemple #1
0
		public CimMethodResult InvokeMethod(CimInstance instance, string methodName, CimMethodParametersCollection methodParameters)
		{
			if (instance != null)
			{
				if (instance.CimSystemProperties.Namespace != null)
				{
					return this.InvokeMethod(instance.CimSystemProperties.Namespace, instance, methodName, methodParameters);
				}
				else
				{
					throw new ArgumentNullException("instance", System.Management.Automation.Strings.CimInstanceNamespaceIsNull);
				}
			}
			else
			{
				throw new ArgumentNullException("instance");
			}
		}
Exemple #2
0
 internal CimMethodResult(CimInstance backingInstance)
 {
     Debug.Assert(backingInstance != null, "Caller should verify backingInstance != null");
     this._backingMethodParametersCollection = new CimMethodParametersCollection(backingInstance);
 }
 internal CimMethodResult(CimInstance backingInstance)
 {
     this._backingMethodParametersCollection = new CimMethodParametersCollection(backingInstance);
 }
Exemple #4
0
		private OperationHandle InvokeMethodCore(string namespaceName, string className, CimInstance instance, string methodName, CimMethodParametersCollection methodParameters, CimOperationOptions options, CimAsyncCallbacksReceiverBase asyncCallbacksReceiver)
		{
			OperationHandle operationHandle = null;
			InstanceHandle instanceHandle;
			InstanceHandle instanceHandleForMethodInvocation;
			SessionHandle sessionHandle = this._handle;
			MiOperationFlags operationFlags = options.GetOperationFlags();
			OperationOptionsHandle operationOptionsHandle = options.GetOperationOptionsHandle();
			string str = namespaceName;
			string str1 = className;
			string str2 = methodName;
			if (instance != null)
			{
				instanceHandle = instance.InstanceHandle;
			}
			else
			{
				instanceHandle = null;
			}
			if (methodParameters != null)
			{
				instanceHandleForMethodInvocation = methodParameters.InstanceHandleForMethodInvocation;
			}
			else
			{
				instanceHandleForMethodInvocation = null;
			}
			SessionMethods.Invoke(sessionHandle, operationFlags, operationOptionsHandle, str, str1, str2, instanceHandle, instanceHandleForMethodInvocation, options.GetOperationCallbacks(asyncCallbacksReceiver), out operationHandle);
			return operationHandle;
		}
Exemple #5
0
		public CimAsyncMultipleResults<CimMethodResultBase> InvokeMethodAsync(string namespaceName, string className, string methodName, CimMethodParametersCollection methodParameters, CimOperationOptions options)
		{
			this.AssertNotDisposed();
			if (!string.IsNullOrWhiteSpace(methodName))
			{
				IObservable<CimMethodResultBase> cimAsyncMethodResultObservable = new CimAsyncMethodResultObservable(options, this.InstanceId, this.ComputerName, (CimAsyncCallbacksReceiverBase asyncCallbacksReceiver) => this.InvokeMethodCore(namespaceName, className, null, methodName, methodParameters, options, asyncCallbacksReceiver));
				return new CimAsyncMultipleResults<CimMethodResultBase>(cimAsyncMethodResultObservable);
			}
			else
			{
				throw new ArgumentNullException("methodName");
			}
		}
Exemple #6
0
		public CimAsyncResult<CimMethodResult> InvokeMethodAsync(string namespaceName, string className, string methodName, CimMethodParametersCollection methodParameters)
		{
			IObservable<CimMethodResultBase> observable = this.InvokeMethodAsync(namespaceName, className, methodName, methodParameters, null);
			IObservable<CimMethodResult> convertingObservable = new ConvertingObservable<CimMethodResultBase, CimMethodResult>(observable);
			return new CimAsyncResult<CimMethodResult>(convertingObservable);
		}
Exemple #7
0
		public CimMethodResult InvokeMethod(string namespaceName, string className, string methodName, CimMethodParametersCollection methodParameters, CimOperationOptions options)
		{
			this.AssertNotDisposed();
			if (!string.IsNullOrWhiteSpace(methodName))
			{
				IEnumerable<CimInstance> cimSyncInstanceEnumerable = new CimSyncInstanceEnumerable(options, this.InstanceId, this.ComputerName, (CimAsyncCallbacksReceiverBase asyncCallbacksReceiver) => this.InvokeMethodCore(namespaceName, className, null, methodName, methodParameters, options, asyncCallbacksReceiver));
				CimInstance cimInstance = cimSyncInstanceEnumerable.SingleOrDefault<CimInstance>();
				if (cimInstance == null)
				{
					return null;
				}
				else
				{
					return new CimMethodResult(cimInstance);
				}
			}
			else
			{
				throw new ArgumentNullException("methodName");
			}
		}
Exemple #8
0
		public CimMethodResult InvokeMethod(string namespaceName, string className, string methodName, CimMethodParametersCollection methodParameters)
		{
			return this.InvokeMethod(namespaceName, className, methodName, methodParameters, null);
		}