예제 #1
0
        private static bool ParseJsonResponse(RequestState Request)
        {
            string json      = Request.jsonString;
            string offsetVar = Regex.Match(Request.urlCalled, "\\A?offset=[^&]*").ToString();
            int    offset    = Convert.ToInt32(offsetVar.Replace("offset=", ""));

            Helper.Log("Streamlabs Request: " + json + " offset: " + offset);
            var v = JSON.Parse(json);

            for (int i = 0; i < 25; i++)
            {
                if (i > v["_total"].AsInt - offset - 1)
                {
                    continue;
                }

                Viewer viewer = Viewers.GetViewer(v["users"][i]["username"]);
                viewer.SetViewerCoins(v["users"][i]["points"].AsInt);
            }
            if (offset + 25 < v["_total"].AsInt)
            {
                offset += 25;
                WebRequest_BeginGetResponse.Main($"https://api.streamelements.com/kappa/v2/points/{ToolkitSettings.AccountID}/alltime?offset={offset}&page=1", new Func <RequestState, bool>(ParseJsonResponse));
            }
            return(true);
        }
예제 #2
0
 public void ImportPoints()
 {
     Helper.Log($"https://api.streamelements.com/kappa/v2/points/{AccountID}/alltime?offset=0&page=1");
     WebRequest_BeginGetResponse.Main($"https://api.streamelements.com/kappa/v2/points/{AccountID}/alltime?offset=0&page=1", new Func <RequestState, bool>(ParseJsonResponse));
 }