public override void HandleGetRequest(HttpProcessor p) { var noPrefix = p.HttpUrl.Substring(p.HttpUrl.IndexOf("?", StringComparison.Ordinal) + 1); var queryElements = noPrefix.Split('&').Select(x => x.Split('=')).ToDictionary(x => x[0], x => x[1]); if(OAuthCodeRecived != null) OAuthCodeRecived(this, new StringEventArg(queryElements["code"])); p.WriteSuccess(); p.OutputStream.WriteLine(File.ReadAllText(_successUri)); }
public void Listen() { Listener = new TcpListener(IPAddress.Any, _port); Listener.Start(); while (IsActive) { try { TcpClient s = Listener.AcceptTcpClient(); var processor = new HttpProcessor(s, this); var thread = new Thread(processor.Process); thread.Start(); Thread.Sleep(1); } catch (Exception) { // ignored } } }
public abstract void HandleGetRequest(HttpProcessor p);