Exemple #1
0
        public async Task <AuthResult> Authenticate(string user, string pass, bool save)
        {
            string payload = "user="******",password="******"payload=" + payload;

            var url  = QuickHttp.Uri(Region.Current.LoginQueue, "/login-queue/rest/queue/authenticate");
            var json = await QuickHttp.Request("POST", url).Send(query).JSONObject();

            this.auth = new AuthResult(JSONDeserializer.Deserialize <LoginQueueDto>(json), user, pass);

            if (json.ContainsKey("lqt") || this.auth.Content.Token == null)
            {
                Debug.WriteLine(json.ToJSON());
            }

            switch (this.auth.Content.Status)
            {
            case "LOGIN":
                if (save)
                {
                    if (!settings.Accounts.ContainsKey(user))
                    {
                        settings.Accounts[user] = new Account();
                    }

                    settings.Accounts[user].SetPassword(pass);
                    settings.Save();
                }
                break;

            case "QUEUE":
                Debug.WriteLine("QUEUE: " + this.auth.Content.Backlog);
                break;
            }

            return(this.auth);
        }
Exemple #2
0
        public void Start(string host)
        {
            var args = $"--backend=\"http://{host}/ui/client/client.html\"";

#if BUILD_UI
            const int debuggingPort = 1337;
            args += $" --remote-debugging-port={debuggingPort}";
            Task.Run(async() => {
                JSONArray json;
                do
                {
                    json = await QuickHttp.Request("GET", $"http://localhost:{debuggingPort}/json/list").JSONArray();
                } while (json == null);

                var url = ((JSONObject)json[0])["devtoolsFrontendUrl"] as string;
                Process.Start($"http://localhost:{debuggingPort}{url}");
            });
#endif

            Process.Start(FrontEndExecutable, args);

            content.Load();
            assets.Load();
        }
Exemple #3
0
        private static ChunkInfo GetChunkInfo(long gameId)
        {
            var uri = new Uri(BaseUri, $"getLastChunkInfo/{Region.Current.Platform}/{gameId}/1/token");

            return(JSONDeserializer.Deserialize <ChunkInfo>(QuickHttp.Request("GET", uri.AbsoluteUri).JSONObject().Result));
        }
Exemple #4
0
        private static JSONObject GetMetaData(long gameId)
        {
            var uri = new Uri(BaseUri, $"getGameMetaData/{Region.Current.Platform}/{gameId}/1/token");

            return(QuickHttp.Request("GET", uri.AbsoluteUri).JSONObject().Result);
        }