Exemple #1
0
		public void Close()
		{
			lock (this._disposeThreadSafetyLock)
			{
				if (!this._disposed)
				{
					this._disposed = true;
				}
				else
				{
					return;
				}
			}
			MiResult miResult = this._handle.ReleaseHandleSynchronously();
			CimException.ThrowIfMiResultFailure(miResult);
		}
Exemple #2
0
		public bool TestConnection(out CimInstance instance, out CimException exception)
		{
			this.AssertNotDisposed();
			bool flag = true;
			instance = null;
			exception = null;
			IEnumerable<CimInstance> cimSyncInstanceEnumerable = new CimSyncInstanceEnumerable(null, this.InstanceId, this.ComputerName, (CimAsyncCallbacksReceiverBase asyncCallbacksReceiver) => this.TestConnectionCore(null, asyncCallbacksReceiver));
			try
			{
				instance = cimSyncInstanceEnumerable.SingleOrDefault<CimInstance>();
			}
			catch (CimException cimException1)
			{
				CimException cimException = cimException1;
				exception = cimException;
				flag = false;
			}
			return flag;
		}
Exemple #3
0
        /// <summary>
        /// Instantiates an empty <see cref="CimInstance"/>.
        /// </summary>
        /// <param name="cimClass"></param>
        /// <exception cref="ArgumentException">Thrown when <paramref name="cimClass"/> is null or when it doesn't follow the format specified by DSP0004</exception>
        public CimInstance(CimClass cimClass)
        {
            if (cimClass == null)
            {
                throw new ArgumentNullException("cimClass");
            }

            MI_Instance tmpHandle;
            MI_Result   result = CimApplication.Handle.NewInstanceFromClass(cimClass.CimSystemProperties.ClassName, cimClass.ClassHandle, out tmpHandle);

            if (result == MI_Result.MI_RESULT_INVALID_PARAMETER)
            {
                throw new ArgumentOutOfRangeException("cimClass");
            }
            CimException.ThrowIfMiResultFailure(result);

            result = tmpHandle.SetNameSpace(cimClass.CimSystemProperties.Namespace);
            CimException.ThrowIfMiResultFailure(result);
            result = tmpHandle.SetServerName(cimClass.CimSystemProperties.ServerName);
            CimException.ThrowIfMiResultFailure(result);

            this.nativeInstance = tmpHandle;
        }
Exemple #4
0
		public bool TestConnection()
		{
			CimInstance cimInstance = null;
			CimException cimException = null;
			return this.TestConnection(out cimInstance, out cimException);
		}