예제 #1
0
 // Token: 0x06001C6F RID: 7279 RVA: 0x00071990 File Offset: 0x0006FB90
 public override void RecognizeAsync(byte[] audioBytes, SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ValidateArgument.NotNull(audioBytes, "audioBytes");
     ValidateArgument.NotNull(callback, "callback");
     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, MobileSpeechRecoRequestType, string>((long)this.GetHashCode(), "LocalSpeechRecognition.RecognizeAsync - Request Id='{0}', Request Type='{1}', UM server FQDN for RPC='{2}'", base.Parameters.RequestId, base.Parameters.RequestType, this.rpcServerFqdn);
     base.CollectAndLogStatisticsInformation(MobileSpeechRecoRequestStepLogId.Recognize, audioBytes.Length);
     try
     {
         MobileSpeechRecoRpcClient mobileSpeechRecoRpcClient = new MobileSpeechRecoRpcClient(base.Parameters.RequestId, this.rpcServerFqdn, callback);
         mobileSpeechRecoRpcClient.BeginRecognize(audioBytes, new AsyncCallback(this.OnRecognizeCompleted), mobileSpeechRecoRpcClient);
         ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid>((long)this.GetHashCode(), "LocalSpeechRecognition.RecognizeAsync - Request Id='{0}', Called BeginRecognize", base.Parameters.RequestId);
     }
     catch (Exception e)
     {
         this.HandleUnexpectedException(e, callback);
     }
 }
예제 #2
0
        // Token: 0x06001C72 RID: 7282 RVA: 0x00071B3C File Offset: 0x0006FD3C
        private void OnRecognizeCompleted(IAsyncResult asyncResult)
        {
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "LocalSpeechRecognition.OnRecognizeCompleted - RequestId='{0}' RequestType='{1}'", base.Parameters.RequestId, base.Parameters.RequestType.ToString());
            base.CollectAndLogStatisticsInformation(MobileSpeechRecoRequestStepLogId.RecognizeCompleted, -1);
            MobileSpeechRecoRpcClient mobileSpeechRecoRpcClient = (MobileSpeechRecoRpcClient)asyncResult.AsyncState;

            SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate speechProcessorAsyncCompletedDelegate = mobileSpeechRecoRpcClient.State as SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate;
            try
            {
                MobileRecoRPCAsyncCompletedArgs             mobileRecoRPCAsyncCompletedArgs = mobileSpeechRecoRpcClient.EndRecognize(asyncResult);
                SpeechRecognitionProcessor.SpeechHttpStatus httpStatus            = LocalSpeechRecognition.MapRpcErrorCodeToHttpErrorCode(mobileRecoRPCAsyncCompletedArgs.ErrorCode);
                SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs args = new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(mobileRecoRPCAsyncCompletedArgs.Result, httpStatus);
                speechProcessorAsyncCompletedDelegate(args);
            }
            catch (Exception e)
            {
                this.HandleUnexpectedException(e, speechProcessorAsyncCompletedDelegate);
            }
        }
예제 #3
0
 // Token: 0x06001C6E RID: 7278 RVA: 0x00071838 File Offset: 0x0006FA38
 public override void AddRecoRequestAsync(SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ValidateArgument.NotNull(callback, "callback");
     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "LocalSpeechRecognition.AddRecoRequestAsync - RequestId='{0}' RequestType='{1}'", base.Parameters.RequestId, base.Parameters.RequestType.ToString());
     base.CollectAndLogStatisticsInformation(MobileSpeechRecoRequestStepLogId.AddRecoRequest, -1);
     try
     {
         ADTopologyLookup adtopologyLookup = ADTopologyLookup.CreateLocalResourceForestLookup();
         Server           localServer      = adtopologyLookup.GetLocalServer();
         this.rpcServerFqdn = localServer.Fqdn;
         ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "LocalSpeechRecognition.AddRecoRequestAsync - Request Id='{0}', UM server FQDN for RPC='{1}'", base.Parameters.RequestId, this.rpcServerFqdn);
         MobileSpeechRecoRpcClient mobileSpeechRecoRpcClient = new MobileSpeechRecoRpcClient(base.Parameters.RequestId, this.rpcServerFqdn, callback);
         mobileSpeechRecoRpcClient.BeginAddRecoRequest(base.Parameters.RequestType, base.Parameters.UserObjectGuid, base.Parameters.TenantGuid, base.Parameters.Culture, base.Parameters.TimeZone, new AsyncCallback(this.OnAddRecoRequestCompleted), mobileSpeechRecoRpcClient);
         ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid>((long)this.GetHashCode(), "LocalSpeechRecognition.AddRecoRequestAsync - Request Id='{0}', Called BeginAddRecoRequest", base.Parameters.RequestId);
     }
     catch (ArgumentOutOfRangeException e)
     {
         this.HandleException(e, -2147466750, callback);
     }
     catch (Exception e2)
     {
         this.HandleUnexpectedException(e2, callback);
     }
 }