public async Task ConnectAsync(string token, string channelId, CancellationToken cancellationToken)
        {
            await _webSocketClient.ConnectAsync(_webSocketServerUri, cancellationToken);

            if (_webSocketClient.State == WebSocketState.Open)
            {
                ListenRequest     lr  = new ListenRequest();
                ListenRequestData lrd = new ListenRequestData
                {
                    auth_token = token,
                    topics     = new string[] { "channel-points-channel-v1." + channelId, "channel-bits-events-v2." + channelId, "channel-subscribe-events-v1." + channelId, "hype-train-events-v1." + channelId }
                };
                lr.data  = lrd;
                lr.nonce = "lkjsdhfiusdagf";
                lr.type  = "LISTEN";
                StringBuilder stringBuilder = new StringBuilder();
                JsonMapper.ToJson(lr, new JsonWriter(stringBuilder));
                string jlr = stringBuilder.ToString();
                //Controller._instance._log.LogMessage(jlr);
                await SendMessageAsync(jlr, cancellationToken);

                Timer timer = new Timer(async(e) =>
                {
                    Controller._instance._log.LogMessage("Sending PubSub Ping");
                    await SendMessageAsync("{\"type\":  \"PING\"}", cancellationToken);
                }, null, TimeSpan.Zero, TimeSpan.FromMinutes(5));

                // start receiving messages in separeted thread
                System.Runtime.CompilerServices.ConfiguredTaskAwaitable receive = ReceiveAsync(cancellationToken).ConfigureAwait(false);
            }
        }
        public async Task ConnectAsync(string oauth, string nick, CancellationToken cancellationToken)
        {
            await _webSocketClient.ConnectAsync(_webSocketServerUri, cancellationToken);

            if (_webSocketClient.State == WebSocketState.Open)
            {
                await SendMessageAsync($"PASS {oauth}", cancellationToken);
                await SendMessageAsync($"NICK {nick}", cancellationToken);

                // start receiving messages in separeted thread
                System.Runtime.CompilerServices.ConfiguredTaskAwaitable receive = ReceiveAsync(cancellationToken).ConfigureAwait(false);
            }
        }
Пример #3
0
        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref System.Runtime.CompilerServices.ConfiguredTaskAwaitable instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.Object:
            {
                __mStack[ptr_of_this_method->Value] = instance_of_this_method;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Runtime.CompilerServices.ConfiguredTaskAwaitable[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
Пример #4
0
        static StackObject *GetAwaiter_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Runtime.CompilerServices.ConfiguredTaskAwaitable instance_of_this_method = (System.Runtime.CompilerServices.ConfiguredTaskAwaitable) typeof(System.Runtime.CompilerServices.ConfiguredTaskAwaitable).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.GetAwaiter();

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Пример #5
0
        public override void PreprocessMouseUp(MouseButtonEventArgs e)
        {
            if (Settings.Default.AsmDoc_On)
            {
                try
                {
                    if (this.mouseDownAnchorPoint_.HasValue && this.state_.Enabled)
                    {
                        Point currentMousePosition = this.RelativeToView(e.GetPosition(this.view_.VisualElement));

                        if (!this.InDragOperation(this.mouseDownAnchorPoint_.Value, currentMousePosition))
                        {
                            this.state_.Enabled = false;

                            ITextViewLine line           = this.view_.TextViewLines.GetTextViewLineContainingYCoordinate(currentMousePosition.Y);
                            SnapshotPoint?bufferPosition = line.GetBufferPositionFromXCoordinate(currentMousePosition.X);
                            string        keyword        = AsmDudeToolsStatic.Get_Keyword_Str(bufferPosition);
                            if (keyword != null)
                            {
                                (Mnemonic mnemonic, AttType type) = AsmSourceTools.ParseMnemonic_Att(keyword, false);
                                System.Runtime.CompilerServices.ConfiguredTaskAwaitable <bool> result = this.Dispatch_Goto_DocAsync(mnemonic).ConfigureAwait(false); // use .ConfigureAwait(false) to signal your intention for continuation.
                            }
                            this.Set_Highlight_Span(null);
                            this.view_.Selection.Clear();
                            e.Handled = true;
                        }
                    }
                    this.mouseDownAnchorPoint_ = null;
                }
                catch (Exception ex)
                {
                    AsmDudeToolsStatic.Output_ERROR(string.Format(AsmDudeToolsStatic.CultureUI, "{0} PreprocessMouseUp; e={1}", this.ToString(), ex.ToString()));
                }
            }
        }
Пример #6
0
        private async Task ValidateOperationCancelledAsync(string redirectUri, CancellationTokenSource cts, System.Runtime.CompilerServices.ConfiguredTaskAwaitable <AuthenticationResult> tokenTask)
        {
            // Assert
            var ex = await AssertException.TaskThrowsAsync <OperationCanceledException>(async() =>
            {
                await tokenTask;
                return;
            }).ConfigureAwait(false);

            Assert.AreEqual(cts.Token, ex.CancellationToken, "Cancellation exceptions SHOULD expose the original cancellation token");
        }
Пример #7
0
 private static void System_Runtime()
 {
     // This is not used. Added to ensure System.Runtime dll is included when build
     var configuredTaskAwaitable = new System.Runtime.CompilerServices.ConfiguredTaskAwaitable();
 }
Пример #8
0
 public List <ProductResult> ProcessIntegrated(ProductSearch processRequest)
 {
     System.Runtime.CompilerServices.ConfiguredTaskAwaitable <List <ProductResult> > task = Task.Run(async() => await _conditionService.GetProduct(processRequest)).ConfigureAwait(false);
     return(task.GetAwaiter().GetResult());
 }
Пример #9
0
 public StrongAwaiter(Task <TResult> task, bool configureAwaitToContinueOnCapturedContext)
 {
     _task = task;
     _configuredAwaiter = _task.ConfigureAwait(configureAwaitToContinueOnCapturedContext).GetAwaiter();
 }
Пример #10
0
 private void System_Runtime()
 {
     var configuredTaskAwaitable = new System.Runtime.CompilerServices.ConfiguredTaskAwaitable();
 }