Exemplo n.º 1
0
        public async Task <IActionResult> Get()
        {
            Uri serviceName  = Web1.GetBackendServiceName(this.serviceContext);
            Uri proxyAddress = this.GetProxyAddress(serviceName);

            ServicePartitionList partitions = await this.fabricClient.QueryManager.GetPartitionListAsync(serviceName);

            List <KeyValuePair <string, int> > result = new List <KeyValuePair <string, int> >();

            foreach (Partition partition in partitions)
            {
                string proxyUrl =
                    $"{proxyAddress}/api/staff?PartitionKey={((Int64RangePartitionInformation)partition.PartitionInformation).LowKey}&PartitionKind=Int64Range";

                using (HttpResponseMessage response = await this.httpClient.GetAsync(proxyUrl))
                {
                    if (response.StatusCode != System.Net.HttpStatusCode.OK)
                    {
                        continue;
                    }

                    result.AddRange(JsonConvert.DeserializeObject <List <KeyValuePair <string, int> > >(await response.Content.ReadAsStringAsync()));
                }
            }

            return(this.Json(result));
        }
Exemplo n.º 2
0
 private void bwurl1_TextChanged(object sender, EventArgs e)
 {
     try
     {
         Web1.Navigate(new Uri(bwurl1.Text));
     }
     catch
     {
     }
 }
Exemplo n.º 3
0
        private void cmGetAll_Click(object sender, EventArgs e)
        {
            var tCnt = default(int);

            lbStatus.BackColor = Color.FromArgb(255, 128, 255, 128);
            OBJ_Enable(false);

            // R4.30 Loop thru all URLs to get the LAST PAGE value from the redirected URL.
            for (int t = 1; t <= 7; t++)
            {
                for (int tt = 1; tt <= 4; tt++)
                {
                    tCnt += 1;
                    if (!string.IsNullOrEmpty(SearchURL[t, tt]) & SearchStop == false)
                    {
                        lbStatus.Text = "Searching " + tCnt + " of 28";
                        Web1.Navigate(SearchURL[t, tt]);
                        WAIT_Time(1);

                        // R4.30 Loop here while DOC COMPLETED task checks status of search.
                        while (SearchFound == false & SearchStop == false)
                        {
                            Application.DoEvents();
                        }

                        // R4.30 Calc APPROX # of players assuming 40 players per page.
                        _LVLs[t, tt] = (SearchPage * 40L).ToString();

                        // R4.30 Reset our search flags.
                        SearchFound = false;
                        SearchPage  = 0L;
                    }
                }
            }

            if (SearchStop == false)
            {
                lbStatus.Text = "Search Complete.";
                DATA_Show();
            }
            else
            {
                lbStatus.Text = "Search Aborted.";
                SearchStop    = false;
            }

            lbStatus.BackColor = Color.FromArgb(255, 128, 128, 128);
            OBJ_Enable(true);
        }
Exemplo n.º 4
0
 private void cmATAxis_Click(object sender, EventArgs e)
 {
     lbStatus.Text = "";
     Application.DoEvents();
     if (rb2v2.Checked)
     {
         Web1.Navigate("http://www.companyofheroes.com/leaderboards#global/team-of-2/axis/by-rank?page=10000");
     }
     if (rb3v3.Checked)
     {
         Web1.Navigate("http://www.companyofheroes.com/leaderboards#global/team-of-3/axis/by-rank?page=10000");
     }
     if (rb4v4.Checked)
     {
         Web1.Navigate("http://www.companyofheroes.com/leaderboards#global/team-of-4/axis/by-rank?page=10000");
     }
 }
Exemplo n.º 5
0
        public async Task <IActionResult> Delete(string staff)
        {
            Uri    serviceName  = Web1.GetBackendServiceName(this.serviceContext);
            Uri    proxyAddress = this.GetProxyAddress(serviceName);
            long   partitionKey = this.GetPartitionKey(staff);
            string proxyUrl     = $"{proxyAddress}/api/staff/{staff}?PartitionKey={partitionKey}&PartitionKind=Int64Range";

            using (HttpResponseMessage response = await this.httpClient.DeleteAsync(proxyUrl))
            {
                if (response.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    return(this.StatusCode((int)response.StatusCode));
                }
            }

            return(new OkResult());
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Put(string staff)
        {
            Uri    serviceName  = Web1.GetBackendServiceName(this.serviceContext);
            Uri    proxyAddress = this.GetProxyAddress(serviceName);
            long   partitionKey = this.GetPartitionKey(staff);
            string proxyUrl     = $"{proxyAddress}/api/staff/{staff}?PartitionKey={partitionKey}&PartitionKind=Int64Range";

            StringContent putContent = new StringContent($"{{ 'staff' : '{staff}' }}", Encoding.UTF8, "application/json");

            putContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            using (HttpResponseMessage response = await this.httpClient.PutAsync(proxyUrl, putContent))
            {
                return(new ContentResult()
                {
                    StatusCode = (int)response.StatusCode,
                    Content = await response.Content.ReadAsStringAsync()
                });
            }
        }
Exemplo n.º 7
0
 private void cm1v1Okw_Click(object sender, EventArgs e)
 {
     lbStatus.Text = "";
     Application.DoEvents();
     if (rb1v1.Checked)
     {
         Web1.Navigate("http://www.companyofheroes.com/leaderboards#global/1v1/wgerman/by-rank?page=10000");
     }
     if (rb2v2.Checked)
     {
         Web1.Navigate("http://www.companyofheroes.com/leaderboards#global/2v2/wgerman/by-rank?page=10000");
     }
     if (rb3v3.Checked)
     {
         Web1.Navigate("http://www.companyofheroes.com/leaderboards#global/3v3/wgerman/by-rank?page=10000");
     }
     if (rb4v4.Checked)
     {
         Web1.Navigate("http://www.companyofheroes.com/leaderboards#global/4v4/wgerman/by-rank?page=10000");
     }
 }
Exemplo n.º 8
0
        private void cmGetAllActual_Click(object sender, EventArgs e)
        {
            long TLast   = 0L;
            int  SameCnt = 0;
            int  tCnt    = 0;

            lbStatus.BackColor = Color.FromArgb(255, 128, 255, 128);
            OBJ_Enable(false);

            // R4.30 Loop thru all URLs to get the LAST PAGE value from the redirected URL.
            SearchActual = true;
            for (int t = 1; t <= 7; t++)
            {
                for (int tt = 1; tt <= 4; tt++)
                {
                    tCnt += 1;
                    if (!string.IsNullOrEmpty(SearchURL[t, tt]) & SearchStop == false)
                    {
                        lbStatus.Text = "Searching " + tCnt + " of 28";
                        SearchPage    = 0L;
                        Web1.Navigate(SearchURL[t, tt]);

                        // R4.30 Loop here while DOC COMPLETED task checks status of search.
                        while (SearchFound == false & SearchStop == false)
                        {
                            // WAIT_Time(1)
                            WAIT_TimeMS(500);
                            TLast      = SearchPage;
                            SearchPage = 0L;
                            HTML_Search();
                            if (TLast == SearchPage & 1000L < SearchPage)
                            {
                                SearchFound = true;
                                SameCnt     = 0;
                            }
                        }

                        // R4.30 # of players.
                        _LVLs[t, tt] = SearchPage.ToString();

                        // R4.30 Reset our search flags.
                        SearchFound = false;
                        SearchPage  = 0L;
                    }
                }
            }

            SearchActual = false;
            if (SearchStop == false)
            {
                lbStatus.Text = "Search Complete.";
                DATA_Show();
            }
            else
            {
                lbStatus.Text = "Search Aborted.";
                SearchStop    = false;
            }

            lbStatus.BackColor = Color.FromArgb(255, 128, 128, 128);
            OBJ_Enable(true);
        }