Exemplo n.º 1
0
        public void Write(TProtocol oprot)
        {
            TStruct struc = new TStruct("TFetchResultsReq");

            oprot.WriteStructBegin(struc);
            TField field = new TField();

            field.Name = "operationHandle";
            field.Type = TType.Struct;
            field.ID   = 1;
            oprot.WriteFieldBegin(field);
            OperationHandle.Write(oprot);
            oprot.WriteFieldEnd();
            field.Name = "orientation";
            field.Type = TType.I32;
            field.ID   = 2;
            oprot.WriteFieldBegin(field);
            oprot.WriteI32((int)Orientation);
            oprot.WriteFieldEnd();
            field.Name = "maxRows";
            field.Type = TType.I64;
            field.ID   = 3;
            oprot.WriteFieldBegin(field);
            oprot.WriteI64(MaxRows);
            oprot.WriteFieldEnd();
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Exemplo n.º 2
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;
		}
Exemplo n.º 3
0
 private void Close()
 {
     lock (this._cancelVsCloseLock)
     {
         this._handle.Close();
         this._handle = null;
     }
 }
Exemplo n.º 4
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("TFetchResultsReq");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                field.Name = "operationHandle";
                field.Type = TType.Struct;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await OperationHandle.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);

                field.Name = "orientation";
                field.Type = TType.I32;
                field.ID   = 2;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteI32Async((int)Orientation, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);

                field.Name = "maxRows";
                field.Type = TType.I64;
                field.ID   = 3;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteI64Async(MaxRows, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);

                if (__isset.fetchType)
                {
                    field.Name = "fetchType";
                    field.Type = TType.I16;
                    field.ID   = 4;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await oprot.WriteI16Async(FetchType, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
 void ReleaseHandleWhenPlaymodeStateChanged(PlayModeStateChange state)
 {
     if (EditorSettings.enterPlayModeOptionsEnabled && Addressables.reinitializeAddressables)
     {
         while (OperationHandle.IsValid())
         {
             OperationHandle.Release();
         }
     }
 }
Exemplo n.º 6
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                hashcode = (hashcode * 397) + OperationHandle.GetHashCode();
                if (__isset.getProgressUpdate)
                {
                    hashcode = (hashcode * 397) + GetProgressUpdate.GetHashCode();
                }
            }
            return(hashcode);
        }
Exemplo n.º 7
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("TFetchResultsReq(");

            sb.Append("OperationHandle: ");
            sb.Append(OperationHandle == null ? "<null>" : OperationHandle.ToString());
            sb.Append(",Orientation: ");
            sb.Append(Orientation);
            sb.Append(",MaxRows: ");
            sb.Append(MaxRows);
            sb.Append(")");
            return(sb.ToString());
        }
Exemplo n.º 8
0
        public override string ToString()
        {
            var sb = new StringBuilder("TGetOperationStatusReq(");

            sb.Append(", OperationHandle: ");
            sb.Append(OperationHandle == null ? "<null>" : OperationHandle.ToString());
            if (__isset.getProgressUpdate)
            {
                sb.Append(", GetProgressUpdate: ");
                sb.Append(GetProgressUpdate);
            }
            sb.Append(")");
            return(sb.ToString());
        }
Exemplo n.º 9
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                hashcode = (hashcode * 397) + OperationHandle.GetHashCode();
                hashcode = (hashcode * 397) + Orientation.GetHashCode();
                hashcode = (hashcode * 397) + MaxRows.GetHashCode();
                if (__isset.fetchType)
                {
                    hashcode = (hashcode * 397) + FetchType.GetHashCode();
                }
            }
            return(hashcode);
        }
Exemplo n.º 10
0
        public IEnumerator <TItem> GetEnumerator()
        {
            CimOperation cimOperation;
            TEnumerator  tEnumerator = this.CreateEnumerator();
            IDisposable  disposable  = CimApplication.AssertNoPendingShutdown();

            using (disposable)
            {
                OperationHandle operationHandle = this._operationStarter(tEnumerator);
                operationHandle.SetExtraFinalizationAction(new Action(tEnumerator.InternalFinalizationHelper));
                cimOperation = new CimOperation(operationHandle, this._cancellationToken);
            }
            tEnumerator.SetOperation(cimOperation);
            return(tEnumerator);
        }
Exemplo n.º 11
0
        public async Task ExecuteAsync(string statement)
        {
            await CloseOperationAsync();

            var execReq = new ExecuteStatementReq()
            {
                SessionHandle = _session,
                Statement     = statement,
            };

            _lastSchema = null;
            var execResp = await _client.ExecuteStatementAsync(execReq);

            execResp.Status.CheckStatus();
            _operation = execResp.OperationHandle;
        }
Exemplo n.º 12
0
        internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimClass currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle)
        {
            ClassHandle classHandle = null;

            currentItem = null;
            MiResult @class = OperationMethods.GetClass(operationHandle, out classHandle, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle);

            if (classHandle != null && !classHandle.IsInvalid)
            {
                if (!base.ShortenLifetimeOfResults)
                {
                    classHandle = classHandle.Clone();
                }
                currentItem = new CimClass(classHandle);
            }
            return(@class);
        }
Exemplo n.º 13
0
        public override string ToString()
        {
            var sb = new StringBuilder("TFetchResultsReq(");

            sb.Append(", OperationHandle: ");
            sb.Append(OperationHandle == null ? "<null>" : OperationHandle.ToString());
            sb.Append(", Orientation: ");
            sb.Append(Orientation);
            sb.Append(", MaxRows: ");
            sb.Append(MaxRows);
            if (__isset.fetchType)
            {
                sb.Append(", FetchType: ");
                sb.Append(FetchType);
            }
            sb.Append(")");
            return(sb.ToString());
        }
Exemplo n.º 14
0
        public async Task ReadAsync(TProtocol protocol, CancellationToken cancellationToken)
        {
            bool   isset_operationHandle = false;
            TField field;
            await protocol.ReadStructBeginAsync(cancellationToken);

            while (true)
            {
                field = await protocol.ReadFieldBeginAsync(cancellationToken);

                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.Struct)
                    {
                        OperationHandle = new OperationHandle();
                        await OperationHandle.ReadAsync(protocol);

                        isset_operationHandle = true;
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(protocol, field.Type, cancellationToken);
                    }
                    break;

                default:
                    await TProtocolUtil.SkipAsync(protocol, field.Type, cancellationToken);

                    break;
                }
                await protocol.ReadFieldEndAsync(cancellationToken);
            }
            await protocol.ReadStructEndAsync(cancellationToken);

            if (!isset_operationHandle)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
Exemplo n.º 15
0
        internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimInstance currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle)
        {
            InstanceHandle instanceHandle = null;

            currentItem = null;
            MiResult instance = OperationMethods.GetInstance(operationHandle, out instanceHandle, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle);

            if (instanceHandle != null && !instanceHandle.IsInvalid)
            {
                if (!base.ShortenLifetimeOfResults)
                {
                    instanceHandle = instanceHandle.Clone();
                }
                currentItem = new CimInstance(instanceHandle, null);
                currentItem.SetCimSessionComputerName(this._CimSessionComputerName);
                currentItem.SetCimSessionInstanceId(this._CimSessionInstanceID);
            }
            return(instance);
        }
Exemplo n.º 16
0
        internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimSubscriptionResult currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle)
        {
            InstanceHandle instanceHandle = null;
            string         str            = null;
            string         str1           = null;

            currentItem = null;
            MiResult indication = OperationMethods.GetIndication(operationHandle, out instanceHandle, out str, out str1, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle);

            if (instanceHandle != null && !instanceHandle.IsInvalid)
            {
                if (!base.ShortenLifetimeOfResults)
                {
                    instanceHandle = instanceHandle.Clone();
                }
                currentItem = new CimSubscriptionResult(instanceHandle, str, str1);
            }
            return(indication);
        }
Exemplo n.º 17
0
        internal CimOperation(OperationHandle handle, CancellationToken?cancellationToken)
        {
            Action action = null;

            this._cancellationModeLock = new object();
            this._cancelVsCloseLock    = new object();
            this._handle = handle;
            if (cancellationToken.HasValue)
            {
                CimOperation      cimOperation             = this;
                CancellationToken value                    = cancellationToken.Value;
                CancellationToken cancellationTokenPointer = value;
                if (action == null)
                {
                    action = () => this.Cancel(CancellationMode.ThrowOperationCancelledException);
                }
                cimOperation._cancellationTokenRegistration = cancellationTokenPointer.Register(action);
            }
            CimApplication.AddTracking(this);
        }
Exemplo n.º 18
0
        public async AudioPlayerTask LoadAudioPlayer()
        {
            AudioPlayer player;

            if (IsValid())
            {
#if UNITASK
                await OperationHandle.ToUniTask();
#else
                await OperationHandle.Task;
#endif

                player = (AudioPlayer)OperationHandle.Result;
            }
            else
            {
                player = await LoadAssetAsync();
            }

            return(player);
        }
Exemplo n.º 19
0
        public IDisposable Subscribe(IObserver <TResult> observer)
        {
            CimOperation cimOperation;

            if (observer != null)
            {
                TObserverProxy tObserverProxy = this.CreateObserverProxy(observer);
                tObserverProxy.SetReportOperationStarted(this._reportOperationStarted);
                IDisposable disposable = CimApplication.AssertNoPendingShutdown();
                using (disposable)
                {
                    OperationHandle operationHandle = this._operationStarter(tObserverProxy);
                    cimOperation = new CimOperation(operationHandle, this._cancellationToken);
                }
                tObserverProxy.SetOperation(cimOperation);
                return(new CimAsyncCancellationDisposable(cimOperation));
            }
            else
            {
                throw new ArgumentNullException("observer");
            }
        }
Exemplo n.º 20
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("TGetOperationStatusReq");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                field.Name = "operationHandle";
                field.Type = TType.Struct;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await OperationHandle.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);

                if (__isset.getProgressUpdate)
                {
                    field.Name = "getProgressUpdate";
                    field.Type = TType.Bool;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await oprot.WriteBoolAsync(GetProgressUpdate, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Exemplo n.º 21
0
        public async Task WriteAsync(TProtocol protocol, CancellationToken cancellationToken)
        {
            TStruct struc = new TStruct("TFetchResultsReq");
            await protocol.WriteStructBeginAsync(struc, cancellationToken);

            TField field = new TField {
                Name = "operationHandle", Type = TType.Struct, ID = 1
            };
            await protocol.WriteFieldBeginAsync(field, cancellationToken);

            await OperationHandle.WriteAsync(protocol);

            await protocol.WriteFieldEndAsync(cancellationToken);

            field.Name = "orientation";
            field.Type = TType.I32;
            field.ID   = 2;
            await protocol.WriteFieldBeginAsync(field, cancellationToken);

            await protocol.WriteI32Async((int)Orientation, cancellationToken);

            await protocol.WriteFieldEndAsync(cancellationToken);

            field.Name = "maxRows";
            field.Type = TType.I64;
            field.ID   = 3;
            await protocol.WriteFieldBeginAsync(field, cancellationToken);

            await protocol.WriteI64Async(MaxRows, cancellationToken);

            await protocol.WriteFieldEndAsync(cancellationToken);

            await protocol.WriteFieldStopAsync(cancellationToken);

            await protocol.WriteStructEndAsync(cancellationToken);
        }
Exemplo n.º 22
0
 public FetchResultsReq(OperationHandle operationHandle, FetchOrientation orientation, long maxRows) : this()
 {
     this.OperationHandle = operationHandle;
     this.Orientation     = orientation;
     this.MaxRows         = maxRows;
 }
Exemplo n.º 23
0
 internal void WriteErrorCallbackInternal(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, InstanceHandle instanceHandle, out MIResponseType response)
 {
     response = MIResponseType.MIResponseTypeYes;
     if (this._writeErrorCallback != null)
     {
         CimInstance cimInstance = null;
         using (cimInstance)
         {
             if (instanceHandle != null)
             {
                 cimInstance = new CimInstance(instanceHandle, null);
                 //CimAsyncCallbacksReceiverBase managedOperationContext = (CimAsyncCallbacksReceiverBase)callbackProcessingContext.ManagedOperationContext;
                 CimResponseType userResponse = CimResponseType.None;
                 //managedOperationContext.CallIntoUserCallback(callbackProcessingContext, () => userResponse = this._writeErrorCallback(cimInstance), false, false);
                 response = (MIResponseType)userResponse;
             }
         }
     }
 }
Exemplo n.º 24
0
        private void WriteProgressCallbackInternal(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, string activity, string currentOperation, string statusDescription, int percentageCompleted, int secondsRemaining)
        {
            Action userCallback = null;

            if (this._writeProgressCallback != null)
            {
                //CimAsyncCallbacksReceiverBase managedOperationContext = (CimAsyncCallbacksReceiverBase)callbackProcessingContext.ManagedOperationContext;
                if (userCallback == null)
                {
                    userCallback = () => this._writeProgressCallback(activity, currentOperation, statusDescription, percentageCompleted, secondsRemaining);
                }
                //managedOperationContext.CallIntoUserCallback(callbackProcessingContext, userCallback, false, false);
            }
        }
Exemplo n.º 25
0
        internal void WriteMessageCallbackInternal(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, uint channel, string message)
        {
            Action userCallback = null;

            if (this._writeMessageCallback != null)
            {
                //CimAsyncCallbacksReceiverBase managedOperationContext = (CimAsyncCallbacksReceiverBase)callbackProcessingContext.ManagedOperationContext;
                if (userCallback == null)
                {
                    userCallback = () => this._writeMessageCallback(channel, message);
                }
                //managedOperationContext.CallIntoUserCallback(callbackProcessingContext, userCallback, false, false);
            }
        }
Exemplo n.º 26
0
 internal void PromptUserCallbackInternal(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, string message, MiPromptType promptType, out MIResponseType response)
 {
     response = MIResponseType.MIResponseTypeYes;
     if (this._promptUserCallback != null)
     {
         //CimAsyncCallbacksReceiverBase managedOperationContext = (CimAsyncCallbacksReceiverBase)callbackProcessingContext.ManagedOperationContext;
         CimResponseType userResponse = CimResponseType.None;
         //managedOperationContext.CallIntoUserCallback(callbackProcessingContext, () => userResponse = this._promptUserCallback(message, (CimPromptType)promptType), false, false);
         response = (MIResponseType)userResponse;
     }
 }
        internal void IndicationResultCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, InstanceHandle instanceHandle, string bookMark, string machineID, bool moreResults, MiResult operationResult, string errorMessage, InstanceHandle errorDetailsHandle)
        {
            CimSubscriptionResult cimSubscriptionResult = null;

            if (instanceHandle != null && !instanceHandle.IsInvalid)
            {
                if (!this._shortenLifetimeOfResults)
                {
                    instanceHandle = instanceHandle.Clone();
                }
                cimSubscriptionResult = new CimSubscriptionResult(instanceHandle, bookMark, machineID);
            }
            using (cimSubscriptionResult)
            {
                if (!this._shortenLifetimeOfResults || cimSubscriptionResult == null)
                {
                    base.ProcessNativeCallback(callbackProcessingContext, cimSubscriptionResult, moreResults, operationResult, errorMessage, errorDetailsHandle);
                }
            }
        }
        internal void InstanceResultCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, InstanceHandle instanceHandle, bool moreResults, MiResult operationResult, string errorMessage, InstanceHandle errorDetailsHandle)
        {
            CimMethodResult cimMethodResult = null;

            if (instanceHandle != null && !instanceHandle.IsInvalid)
            {
                if (!this._shortenLifetimeOfResults)
                {
                    instanceHandle = instanceHandle.Clone();
                }
                CimInstance cimInstance = new CimInstance(instanceHandle, null);
                cimInstance.SetCimSessionComputerName(this._CimSessionComputerName);
                cimInstance.SetCimSessionInstanceId(this._CimSessionInstanceID);
                cimMethodResult = new CimMethodResult(cimInstance);
            }
            using (cimMethodResult)
            {
                if (!this._shortenLifetimeOfResults || cimMethodResult == null)
                {
                    base.ProcessNativeCallback(callbackProcessingContext, cimMethodResult, moreResults, operationResult, errorMessage, errorDetailsHandle);
                }
            }
        }
Exemplo n.º 29
0
        internal void ClassCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, ClassHandle ClassHandle, bool moreResults, MiResult operationResult, string errorMessage, InstanceHandle errorDetailsHandle)
        {
            CimClass cimClass = null;

            if (ClassHandle != null && !ClassHandle.IsInvalid)
            {
                if (!this._shortenLifetimeOfResults)
                {
                    ClassHandle = ClassHandle.Clone();
                }
                cimClass = new CimClass(ClassHandle);
            }
            //using (cimClass)
            {
                if (!this._shortenLifetimeOfResults || cimClass == null)
                {
                    base.ProcessNativeCallback(callbackProcessingContext, cimClass, moreResults, operationResult, errorMessage, errorDetailsHandle);
                }
            }
        }
        internal void StreamedParameterCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, string parameterName, object parameterValue, MiType parameterType)
        {
            parameterValue = CimInstance.ConvertFromNativeLayer(parameterValue, null, null, !this._shortenLifetimeOfResults);
            CimInstance cimInstance = parameterValue as CimInstance;

            if (cimInstance != null)
            {
                cimInstance.SetCimSessionComputerName(this._CimSessionComputerName);
                cimInstance.SetCimSessionInstanceId(this._CimSessionInstanceID);
            }
            CimInstance[] cimInstanceArray = parameterValue as CimInstance[];
            if (cimInstanceArray != null)
            {
                CimInstance[] cimInstanceArray1 = cimInstanceArray;
                for (int i = 0; i < (int)cimInstanceArray1.Length; i++)
                {
                    CimInstance cimInstance1 = cimInstanceArray1[i];
                    if (cimInstance1 != null)
                    {
                        cimInstance1.SetCimSessionComputerName(this._CimSessionComputerName);
                        cimInstance1.SetCimSessionInstanceId(this._CimSessionInstanceID);
                    }
                }
            }
            try
            {
                CimMethodResultBase cimMethodStreamedResult = new CimMethodStreamedResult(parameterName, parameterValue, parameterType.ToCimType());
                base.ProcessNativeCallback(callbackProcessingContext, cimMethodStreamedResult, true, MiResult.OK, null, null);
            }
            finally
            {
                if (this._shortenLifetimeOfResults)
                {
                    CimInstance cimInstance2 = parameterValue as CimInstance;
                    if (cimInstance2 != null)
                    {
                        cimInstance2.Dispose();
                    }
                    CimInstance[] cimInstanceArray2 = parameterValue as CimInstance[];
                    if (cimInstanceArray2 != null)
                    {
                        CimInstance[] cimInstanceArray3 = cimInstanceArray2;
                        for (int j = 0; j < (int)cimInstanceArray3.Length; j++)
                        {
                            CimInstance cimInstance3 = cimInstanceArray3[j];
                            if (cimInstance3 != null)
                            {
                                cimInstance3.Dispose();
                            }
                        }
                    }
                }
            }
        }