コード例 #1
0
        protected override void HandleRequest()
        {
            DbAccount acc;

            if (Query["guid"] == null || Query["password"] == null)
            {
                WriteErrorLine("Error.incorrectEmailOrPassword");
            }
            else
            {
                LoginStatus status = Database.Verify(Query["guid"], Query["password"], out acc);
                if (status == LoginStatus.OK)
                {
                    if (acc.Admin)
                    {
                        var ca = new DbClassAvailability(acc);
                        ca.Init(GameData);
                        ca.FlushAsync();
                        WriteLine("<Success />");
                    }
                    else
                    {
                        WriteLine("<Failure />");
                    }
                }
                else
                {
                    WriteErrorLine("<Failure />");
                }
            }
        }
コード例 #2
0
        protected override void HandleRequest()
        {
            try
            {
                var status = Database.Verify(Query["guid"], Query["password"], out DbAccount acc);

                if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists)
                {
                    if (status == LoginStatus.AccountNotExists)
                    {
                        acc = Database.CreateGuestAccount(Query["guid"]);
                    }

                    if (acc.Banned)
                    {
                        using (var 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.FlushAsync();

                    var list = CharList.FromDb(Database, acc);
                    list.Servers = GetServerList();

                    WriteLine(list.ToXml(AppEngine.GameData, acc));
                }
                else
                {
                    WriteErrorLine(status.GetInfo());
                }
            }
            catch (Exception e) { Log.Error(e.ToString()); }
        }