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(); }
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; }
private void Close() { lock (this._cancelVsCloseLock) { this._handle.Close(); this._handle = null; } }
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(); } } }
public override int GetHashCode() { int hashcode = 157; unchecked { hashcode = (hashcode * 397) + OperationHandle.GetHashCode(); if (__isset.getProgressUpdate) { hashcode = (hashcode * 397) + GetProgressUpdate.GetHashCode(); } } return(hashcode); }
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()); }
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()); }
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); }
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); }
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; }
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); }
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()); }
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); } }
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); }
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); }
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); }
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); }
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"); } }
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(); } }
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); }
public FetchResultsReq(OperationHandle operationHandle, FetchOrientation orientation, long maxRows) : this() { this.OperationHandle = operationHandle; this.Orientation = orientation; this.MaxRows = maxRows; }
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; } } } }
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); } }
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); } }
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); } } }
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(); } } } } } }