protected override void HandleRequest() { DbAccount acc; var status = Database.Verify(Query["guid"], Query["password"], out acc); if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists) { if (status == LoginStatus.AccountNotExists) { acc = Database.CreateGuestAccount(Query["guid"]); } var ca = new DbClassAvailability(acc); if (ca.IsNull) { ca.Init(GameData); } ca.Flush(); var list = CharList.FromDb(Database, acc); list.Servers = GetServerList(); WriteLine(list.ToXml(Program.GameData, acc)); } else { WriteErrorLine(status.GetInfo()); } }
public override void HandleRequest(RequestContext context, NameValueCollection query) { DbAccount acc; var status = Database.Verify(query["guid"], query["password"], out acc); if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists) { if (status == LoginStatus.AccountNotExists) { acc = Database.CreateGuestAccount(query["guid"]); } if (acc.Admin && acc.AccountIdOverride != 0) { var accOverride = Database.GetAccount(acc.AccountIdOverride); if (accOverride != null) { acc = accOverride; } } var list = CharList.FromDb(Database, acc); list.Servers = GetServerList(); WriteXml(context, list.ToXml().ToString()); } else { Write(context, "<Error>" + status.GetInfo() + "</Error>"); } }
public override void HandleRequest(HttpListenerContext context) { NameValueCollection query; using (StreamReader rdr = new StreamReader(context.Request.InputStream)) query = HttpUtility.ParseQueryString(rdr.ReadToEnd()); DbAccount acc; var status = Database.Verify(query["guid"], query["password"], out acc); if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists) { if (status == LoginStatus.AccountNotExists) { acc = Database.CreateGuestAccount(query["guid"]); } var list = CharList.FromDb(Database, acc); list.Servers = GetServerList(); Write(context, list.ToXml().ToString()); } else { Write(context, "<Error>" + status.GetInfo() + "</Error>"); } }
protected override void HandleRequest() { DbAccount acc; var status = Database.Verify(Query["guid"], Query["password"], out acc); if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists) { if (status == LoginStatus.AccountNotExists) { acc = Database.CreateGuestAccount(Query["guid"]); } if (acc.Banned) { using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream)) wtr.WriteLine("<Error>Account under maintenance</Error>"); Context.Response.Close(); } var ca = new DbClassAvailability(acc); if (ca.IsNull) { ca.Init(GameData); } ca.Flush(); var list = CharList.FromDb(Database, acc); list.Servers = GetServerList(); WriteLine(list.ToXml(Program.GameData, acc)); } else { WriteErrorLine(status.GetInfo()); } }