private bool AttemptConnection(int pipe)
        {
            if (IsConnected)
            {
                Logger.Error("Cannot connect as the pipe is already connected");
                throw new InvalidPipeException("Cannot connect as the pipe is already connected");
            }

            //Prepare the pipe name
            string pipename = string.Format(PIPE_NAME, pipe);

            Logger.Info("Attempting to connect to " + pipename);

            uint err = NativePipe.Open(pipename);

            if (err == 0 && IsConnected)
            {
                Logger.Info("Succesfully connected to " + pipename);
                _connectedPipe = pipe;
                return(true);
            }
            else
            {
                Logger.Error("Failed to connect to native pipe. Err: {0}", err);
                return(false);
            }
        }
        private bool AttemptConnection(int pipe)
        {
            if (this.IsConnected)
            {
                this.Logger.Error("Cannot connect as the pipe is already connected");
                throw new InvalidPipeException("Cannot connect as the pipe is already connected");
            }
            string pipename = string.Format("\\\\?\\pipe\\discord-ipc-{0}", (object)pipe);

            this.Logger.Info("Attempting to connect to " + pipename);
            uint num = NativePipe.Open(pipename);

            if (num == 0U && this.IsConnected)
            {
                this.Logger.Info("Succesfully connected to " + pipename);
                this._connectedPipe = pipe;
                return(true);
            }
            this.Logger.Error("Failed to connect to native pipe. Err: {0}", (object)num);
            return(false);
        }