Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of the RPC.
        /// </summary>
        /// <param name="applicationID">The ID of the Discord App</param>
        /// <param name="processID">The ID of the currently running process</param>
        /// <param name="targetPipe">The target pipe to connect too</param>
        /// <param name="client">The pipe client we shall use.</param>
        /// <param name="maxRxQueueSize">The maximum size of the out queue</param>
        /// <param name="maxRtQueueSize">The maximum size of the in queue</param>
        public RpcConnection(
            string applicationID,
            int processID,
            int targetPipe,
            INamedPipeClient client,
            uint maxRxQueueSize = 128,
            uint maxRtQueueSize = 512)
        {
            this._discordApplicationId        = applicationID;
            this._discordApplicationProcessId = processID;
            this._currentTargetPipeNumber     = targetPipe;
            this._namedPipe   = client;
            this.ShutdownOnly = true;

            //Assign a default logger
            Logger = new ConsoleLogger();

            _delay          = new BackoffDelay(500, 60 * 1000);
            _maxRtQueueSize = maxRtQueueSize;
            _rtQueue        = new Queue <ICommand>((int)_maxRtQueueSize + 1);

            _maxRxQueueSize = maxRxQueueSize;
            _rxQueue        = new Queue <IMessage>((int)_maxRxQueueSize + 1);

            _currentNonce = 0;
        }
Ejemplo n.º 2
0
        private BackoffDelay delay;                             //The backoff delay before reconnecting.
        #endregion

        /// <summary>
        /// Creates a new instance of the RPC.
        /// </summary>
        /// <param name="applicationID">The ID of the Discord App</param>
        /// <param name="processID">The ID of the currently running process</param>
        /// <param name="targetPipe">The target pipe to connect too</param>
        /// <param name="client">The pipe client we shall use.</param>
        public RpcConnection(string applicationID, int processID, int targetPipe, INamedPipeClient client)
        {
            this.applicationID = applicationID;
            this.processID     = processID;
            this.targetPipe    = targetPipe;
            this.namedPipe     = client;
            this.ShutdownOnly  = true;

            delay    = new BackoffDelay(500, 60 * 1000);
            _rtqueue = new Queue <ICommand>();
            _rxqueue = new Queue <IMessage>();

            nonce = 0;
        }
        private BackoffDelay delay;                             //The backoff delay before reconnecting.
        #endregion

        /// <summary>
        /// Creates a new instance of the RPC.
        /// </summary>
        /// <param name="applicationID">The ID of the Discord App</param>
        /// <param name="processID">The ID of the currently running process</param>
        /// <param name="targetPipe">The target pipe to connect too</param>
        public RpcConnection(string applicationID, int processID, int targetPipe, INamedPipeClient client)
        {
            this.applicationID = applicationID;
            this.processID     = processID;
            this.targetPipe    = targetPipe;
            this.namedPipe     = client;

            //Assign a default logger
            Logger = new ConsoleLogger();

            delay    = new BackoffDelay(500, 60 * 1000);
            _rtqueue = new Queue <ICommand>();
            _rxqueue = new Queue <IMessage>();

            nonce = 0;
        }
Ejemplo n.º 4
0
        private BackoffDelay delay;                             //The backoff delay before reconnecting.
        #endregion

        /// <summary>
        /// Creates a new instance of the RPC.
        /// </summary>
        /// <param name="applicationID">The ID of the Discord App</param>
        /// <param name="processID">The ID of the currently running process</param>
        /// <param name="targetPipe">The target pipe to connect too</param>
        /// <param name="client">The pipe client we shall use.</param>
        /// <param name="maxRxQueueSize">The maximum size of the out queue</param>
        public RpcConnection(string applicationID, int processID, int targetPipe, INamedPipeClient client, uint maxRxQueueSize = 128)
        {
            this.applicationID = applicationID;
            this.processID     = processID;
            this.targetPipe    = targetPipe;
            this.namedPipe     = client;
            this.ShutdownOnly  = true;

            //Assign a default logger
            Logger = new ConsoleLogger();

            delay    = new BackoffDelay(500, 60 * 1000);
            _rtqueue = new Queue <ICommand>();

            _maxRxQueueSize = maxRxQueueSize;
            _rxqueue        = new Queue <IMessage>((int)_maxRxQueueSize + 1);

            nonce = 0;
        }