예제 #1
0
파일: Form1.cs 프로젝트: GeNeRaLHaCk/public
 public List <DriverClass.ListItem> returnAllListOfCardsBASMAP
     (string ip, string port, string token) //Вернуть список всех карт BASMAP
 {
     try
     {
         int i;
         List <DriverClass.ListItem> listOfCards = new List <DriverClass.ListItem>();
         listOfCards.Clear();
         progressBar1.Maximum = int.Parse(driver.countPagesOfCards);
         for (i = 0; i < int.Parse(driver.countPagesOfCards); i++)
         {
             backgroundWorker1.ReportProgress(i);
             int    page = i + 1;
             string Uri  = "http://" + ip + ":" + port +
                           "/api/v0/access/identifiers/items/list?page_number=" + page + "&limit=50";
             string receiveData = driver.SendQuery(Uri, token, "GET", null);
             var    jsonDes     = JsonConvert.DeserializeObject <DriverClass.ListJSON>(receiveData);
             IEnumerable <DriverClass.ListItem> listItems = jsonDes.list_items;
             int ii;
             for (ii = 0; ii < listItems.Count(); ii++)
             {
                 listOfCards.Add(listItems.ToList()[ii]);
             }
         }
         progressBar1.Value   = 0;
         textBox5.Text        = "";
         progressBar1.Maximum = listOfCards.Count();
         driver.AddDebugRow("", false, "_cards");
         int iii;
         for (iii = 0; iii < listOfCards.Count(); iii++)
         {
             driver.AddDebugRow(listOfCards[iii].identifier_uid + " | " +
                                listOfCards[iii][email protected]_owner.name + " | " +
                                listOfCards[iii][email protected]_number + " | " +
                                listOfCards[iii].@base.@lock + ";",
                                true, "_cards");
             backgroundWorker1.ReportProgress(i);
             textBox5.Text += listOfCards[iii].identifier_uid + " | " +
                              listOfCards[iii][email protected]_owner.name + " | " +
                              listOfCards[iii][email protected]_number + " | " +
                              listOfCards[iii].@base.@lock + ";\r\n";
         }
         textBox5.Text     += "Количество карт:" + driver.countItemsOfCardsBASMAP + Environment.NewLine;
         progressBar1.Value = 0;
         return(listOfCards);
     }
     catch (WebException ex)
     {
         MessageBox.Show(ex.Message, "Ошибка");
         return(null);
     }
 }