コード例 #1
0
        /// <nodoc />
        public ProgressReporter([NotNull] StreamJsonRpc.JsonRpc mainRpcChannel, TestContext?testContext)
        {
            Contract.Requires(mainRpcChannel != null);

            m_testContext    = testContext;
            m_mainRpcChannel = mainRpcChannel;
        }
コード例 #2
0
        //------------------------------------------------------------------------------------------------
        // construction
        //------------------------------------------------------------------------------------------------

        public DeribitAuthenticationService(DeribitService deribit, IMapper mapper,
                                            IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc)
        {
            this.deribit  = deribit;
            this.mapper   = mapper;
            this.rpcproxy = rpcproxy;
            this.jsonrpc  = jsonrpc;

            //---------------------------------------------------------------------
            // refresh auth token periodically
            {
                this.RefreshAuthTokenTimer = new System.Timers.Timer()
                {
                    Interval = TimeSpan.FromMinutes(this.RefreshAuthTokenLoopPeriodMins).TotalMilliseconds,
                    Enabled  = !this.deribit.deribitconfig.NoRefreshAuthToken,
                };
            }
            this.RefreshAuthTokenTimer.Elapsed += async(sender, e) =>
            {
                if (this.deribit.deribitconfig.NoRefreshAuthToken)
                {
                    return;
                }
                await this.RefreshAuthTokenLoop();
            };
            //---------------------------------------------------------------------
        }
コード例 #3
0
        //------------------------------------------------------------------------------------------------
        // construction
        //------------------------------------------------------------------------------------------------

        public DeribitSupportingService(DeribitService deribit, IMapper mapper,
                                        IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc)
        {
            this.deribit  = deribit;
            this.mapper   = mapper;
            this.rpcproxy = rpcproxy;
            this.jsonrpc  = jsonrpc;
        }
コード例 #4
0
        /// <summary>
        /// Creates the providers for project management and adds them as targets
        /// to the JSON-RPC layer.
        /// </summary>
        public ProjectManagementProvider(GetAppState getAppState, StreamJsonRpc.JsonRpc rpcChannel)
        {
            m_moduleInformationProvider = new ModuleInformationProvider(getAppState);
            rpcChannel.AddLocalRpcTarget(m_moduleInformationProvider);

            m_addSourceFileToProjectProvider = new AddSourceFileToProjectProvider(getAppState);
            rpcChannel.AddLocalRpcTarget(m_addSourceFileToProjectProvider);
        }
コード例 #5
0
        //------------------------------------------------------------------------------------------------
        // construction
        //------------------------------------------------------------------------------------------------

        public DeribitAccountManagementService(DeribitService deribit, IMapper mapper,
                                               IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc)
        {
            this.deribit  = deribit;
            this.mapper   = mapper;
            this.rpcproxy = rpcproxy;
            this.jsonrpc  = jsonrpc;
        }
コード例 #6
0
ファイル: IdeProviderBase.cs プロジェクト: plade/BuildXL
 /// <nodoc />
 protected IdeProviderBase(ProviderContext providerContext)
 {
     ProviderContext = providerContext;
     JsonRpc         = providerContext.JsonRpc;
     PathTable       = providerContext.PathTable;
     m_incrementalWorkspaceProvider = providerContext.IncrementalWorkspaceProvider;
     m_incrementalWorkspaceProvider.WorkspaceRecomputed += OnWorkspaceRecomputed;
     ChangedTextDocumentItems = new TextDocumentItem[0];
 }
コード例 #7
0
        //------------------------------------------------------------------------------------------------
        // construction
        //------------------------------------------------------------------------------------------------

        public DeribitSubscriptionManagementService(DeribitService deribit, IMapper mapper,
                                                    IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc)
        {
            this.deribit  = deribit;
            this.mapper   = mapper;
            this.rpcproxy = rpcproxy;
            this.jsonrpc  = jsonrpc;
            this.rpcproxy.subscription += this.handle_notification;
        }
コード例 #8
0
        //------------------------------------------------------------------------------------------------
        // construction
        //------------------------------------------------------------------------------------------------

        public DeribitSessionManagementService(DeribitService deribit, IMapper mapper,
                                               IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc)
        {
            this.deribit             = deribit;
            this.mapper              = mapper;
            this.rpcproxy            = rpcproxy;
            this.jsonrpc             = jsonrpc;
            this.rpcproxy.heartbeat += this.handle_heartbeat;
        }
コード例 #9
0
 /// <summary>
 /// Sends the window/showMessage notification to the LSP client.
 /// </summary>
 /// <returns>The task to send the window/showMessage notification.</returns>
 public static Task ShowMessageAsync(this StreamJsonRpc.JsonRpc jsonRpc, TestContext?testContext, MessageType messageType, string message)
 {
     return(Dispatch(jsonRpc, testContext, "window/showMessage",
                     new ShowMessageParams()
     {
         MessageType = messageType,
         Message = message,
     }));
 }
コード例 #10
0
 /// <summary>
 /// Sends the window/showMessageRequest request to the LSP client.
 /// </summary>
 /// <returns>A task to send the window/showMessageRequest request.</returns>
 public static Task <MessageActionItem> ShowMessageRequestAsync(this StreamJsonRpc.JsonRpc jsonRpc, MessageType messageType, string message, params MessageActionItem[] actionItems)
 {
     return(jsonRpc.InvokeWithParameterObjectAsync <MessageActionItem>(
                "window/showMessageRequest",
                new ShowMessageRequestParams
     {
         MessageType = messageType,
         Message = message,
         Actions = actionItems,
     }));
 }
コード例 #11
0
        /// <summary>
        /// Creates the providers for project management and adds them as targets
        /// to the JSON-RPC layer.
        /// </summary>
        public ProjectManagementProvider(GetAppState getAppState, StreamJsonRpc.JsonRpc rpcChannel)
        {
            m_moduleInformationProvider = new ModuleInformationProvider(getAppState);

            var options = new StreamJsonRpc.JsonRpcTargetOptions {
                AllowNonPublicInvocation = true
            };

            rpcChannel.AddLocalRpcTarget(m_moduleInformationProvider, options);

            m_addSourceFileToProjectProvider = new AddSourceFileToProjectProvider(getAppState);
            rpcChannel.AddLocalRpcTarget(m_addSourceFileToProjectProvider, options);
        }
コード例 #12
0
        public Tracer(StreamJsonRpc.JsonRpc pushRpc, string logFilePath, EventLevel logFileVerbosity, EventLevel outputPaneVerbosity)
        {
            Contract.Requires(pushRpc != null);
            Contract.Requires(!string.IsNullOrEmpty(logFilePath));
            Contract.Requires(logFileVerbosity > outputPaneVerbosity, $"Log file verbosity ('{logFileVerbosity}') should be more detailed than output pane verbosity '{outputPaneVerbosity}'.");

            m_logFilePath = logFilePath;
            var outputEventWriter = new OutputWindowEventWriter(
                new OutputWindowReporter(pushRpc),
                File.CreateText(logFilePath),
                outputPaneVerbosity);

            m_loggingListeners = SetupLogging(logFileVerbosity, outputEventWriter);
        }
コード例 #13
0
        private static Task Dispatch <T>(StreamJsonRpc.JsonRpc jsonRpc, TestContext?testContext, string message, T param)
        {
            if (testContext?.ForceSynchronousMessages == true)
            {
                // If we need to force messages to be synchronous, then we always
                // do 'invoke' instead of 'notify', and we always wait for the task
                // to finish
                jsonRpc.InvokeWithParameterObjectAsync <object>(message, param).GetAwaiter().GetResult();

                // Return a 'do nothing' task in this case
                return(Task.FromResult(0));
            }

            return(jsonRpc.NotifyWithParameterObjectAsync(message, param));
        }
コード例 #14
0
ファイル: ProviderContext.cs プロジェクト: kittinap/kunnjae
 /// <nodoc/>
 public ProviderContext(
     [NotNull] StreamJsonRpc.JsonRpc jsonRpc,
     [NotNull] IncrementalWorkspaceProvider incrementalWorkspaceProvider,
     [NotNull] PathTable pathTable,
     [NotNull] Logger logger,
     [NotNull] LoggingContext loggingContext,
     [NotNull] GetAppState getAppState,
     TestContext?testContext = null)
 {
     JsonRpc = jsonRpc;
     IncrementalWorkspaceProvider = incrementalWorkspaceProvider;
     PathTable      = pathTable;
     TestContext    = testContext;
     Logger         = logger;
     LoggingContext = loggingContext;
     GetAppState    = getAppState;
 }
コード例 #15
0
 public OutputWindowReporter(StreamJsonRpc.JsonRpc pushRpc)
 {
     m_pushRpc = pushRpc;
 }