private async void ReceiveThread() { try { logger.Debug($"{nameof(this.ReceiveThread)} started ({this.receiveThread.Name})"); await this.pipe.WaitForConnectionAsync(this.cts.Token).ConfigureAwait(false); if (this.cts.IsCancellationRequested) { return; } logger.Debug($"[{nameof(this.ReceiveThread)}] Pipe connection established!"); StringStream ss = new StringStream(this.pipe); string responseString = ss.ReadString(); var response = HttpUtility.ParseQueryString(responseString); string code = response.Get("code"); string state = response.Get("state"); string error = response.Get("error"); this.OnAuthorizationFinished(code, state, error); } finally { this.pipe.Close(); logger.Debug($"{nameof(this.ReceiveThread)} ended!"); } }
private async void ReceiveThread() { try { await this.pipe.WaitForConnectionAsync(this.cts.Token).ConfigureAwait(false); if (this.cts.IsCancellationRequested) { return; } StringStream ss = new StringStream(this.pipe); string responseString = ss.ReadString(); var response = HttpUtility.ParseQueryString(responseString); string code = response.Get("code"); string state = response.Get("state"); string error = response.Get("error"); this.OnAuthorizationFinished(code, state, error); } finally { this.pipe.Close(); } }
private void ReceiveThread() { try { this.pipe.WaitForConnection(); StringStream ss = new StringStream(this.pipe); string responseString = ss.ReadString(); var response = HttpUtility.ParseQueryString(responseString); string code = response.Get("code"); string state = response.Get("state"); string error = response.Get("error"); this.pipe.Close(); this.OnAuthorizationFinished(code, state, error); } catch { // ignore } }