prosze o wyjasnienie fragmentu kodu C#

0

witam, prosze o wyjasnienie o co chodzi w kodzie ponizej, Jestem slaba w programowaniu i probuje zrozumiec o co chodzi: Z gory dziekuje

private string SendCommand(string commandName, Dictionary<string, string="string"> arguments = null)   //
         {
             using (HttpClient client = new HttpClient())
             {
                 string Url = String.Format("http://{0}:{1}/set.cmd?user={2}+pass={3}+cmd={4}",
                     Server,
                     Port,
                     Login,
                     Password,
                     commandName);

                 if (arguments != null)
                     foreach (KeyValuePair<string, string="string"> entry in arguments)
                     {
                         Url += "+" + entry.Key + "=" + entry.Value;
                     }

                 return client.GetStringAsync(Url).Result;
 public Dictionary<string, bool> GetPower()
        {
            string result = SendCommand("getpower");
            var startIndex = "<html>".Length;
            var endIndex = result.LastIndexOf("</html>");
            var arr = result.Substring(startIndex, endIndex - startIndex).Split(new char[] { ',' });
 
            Dictionary<string, bool> dict = new Dictionary<string, bool>();
            foreach (string cell in arr)
            {
                var temp = cell.Split(new char[] { '=' });
                dict.Add(temp[0], "1" == temp[1]);
            }
            return dict;
        }
0

Po nazwie metody wnioskuję, że chodzi o zdobycie władzy.

A tak na serio, wysyłasz żądanie do serwera (według metody w poprzedniego wątku) i przetwarzasz wynik (w bardzo pokraczny sposób).

1 użytkowników online, w tym zalogowanych: 0, gości: 1