Esempio n. 1
0
 public void setXml(string xml)
 {
     try
     {
         this.c = new Code(0);
         this.xml = xml;
     }
     catch (JsonReaderException)
     {
         this.c = new Code(3);
     }
     catch (System.ArgumentNullException)
     {
     }
 }
Esempio n. 2
0
 public void getFromJson(string json)
 {
     try
     {
         JObject o = JObject.Parse(json);
         this.c = new Code((int)o.SelectToken("code"));
         this.xml = (string)o.SelectToken("xml");
     }
     catch (JsonReaderException)
     {
         this.c = new Code(3);
     }
     catch (System.ArgumentNullException)
     {
     }
 }
Esempio n. 3
0
 public void getFromJson(string json)
 {
     try
     {
         JObject o = JObject.Parse(json);
         this.crt = (string)o.SelectToken("crt");
         try
         {
             this.c = new Code((int)o.SelectToken("code"));
         }
         catch (JsonReaderException)
         {
             if (this.crt != null && this.crt != "")
             {
                 this.c = new Code(0);
             }
             else
             {
                 this.c = new Code(3);
             }
         }
         catch (System.ArgumentNullException)
         {
             if (this.crt != null && this.crt != "")
             {
                 this.c = new Code(0);
             }
             else
             {
                 this.c = new Code(3);
             }
         }
     }
     catch (JsonReaderException)
     {
         this.c = new Code(3);
     }
     catch (System.ArgumentNullException)
     {
     }
 }
Esempio n. 4
0
 public IsLicense()
 {
     this.c = new Code();
     this.crt = "";
 }
Esempio n. 5
0
 public Code postReq(string uri, string post, int i)
 {
     Code result3;
     try
     {
         if (i < this.servers.Length)
         {
             byte[] rv = System.Text.Encoding.UTF8.GetBytes(post);
             System.Uri target = new System.Uri(this.servers[i] + uri);
             System.Net.WebRequest req = System.Net.WebRequest.Create(target);
             req.Timeout = this.timeout;
             req.Method = "POST";
             req.PreAuthenticate = true;
             req.ContentType = "application/x-www-form-urlencoded";
             req.ContentLength = (long)rv.Length;
             System.IO.Stream os = req.GetRequestStream();
             os.Write(rv, 0, rv.Length);
             os.Close();
             try
             {
                 System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)req.GetResponse();
                 string a = "";
                 if (response == null)
                 {
                     i++;
                     result3 = this.postReq(uri, post, i);
                     return result3;
                 }
                 System.IO.Stream receiveStream = response.GetResponseStream();
                 System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
                 System.IO.StreamReader readStream = new System.IO.StreamReader(receiveStream, encode);
                 char[] read = new char[256];
                 for (int count = readStream.Read(read, 0, 256); count > 0; count = readStream.Read(read, 0, 256))
                 {
                     string str = new string(read, 0, count);
                     a += str;
                 }
                 if (a != "")
                 {
                     ResponseData result = new ResponseData();
                     result.getFromJson(a);
                     Code result2 = new Code(result.getCode().getcode());
                     result3 = result2;
                     return result3;
                 }
                 response.Close();
                 result3 = new Code();
                 return result3;
             }
             catch (System.Net.WebException e_190)
             {
                 i++;
                 result3 = this.postReq(uri, post, i);
                 return result3;
             }
         }
     }
     catch (System.Net.WebException e_190)
     {
         i++;
         result3 = this.postReq(uri, post, i);
         return result3;
     }
     result3 = new Code();
     return result3;
 }
Esempio n. 6
0
 public ResponseData()
 {
     this.c = new Code();
     this.xml = "";
 }
Esempio n. 7
0
 public void setCode(Code code)
 {
     this.c = code;
 }
Esempio n. 8
0
 public KLKresponse()
 {
     this.saved = false;
     this.c = new Code();
     this.e = new System.Exception();
 }