Пример #1
0
 public void Run()
 {
     try
     {
         var sysinfoJsonSerializer = new DataContractJsonSerializer(typeof(sysinfo));
         var sysinfoJsonStream     = new MemoryStream();
         var systeminfo            = new sysinfo();
         sysinfoJsonSerializer.WriteObject(sysinfoJsonStream, systeminfo);
         sysinfoJsonStream.Position = 0;
         var    sysinfoJsonReader = new StreamReader(sysinfoJsonStream);
         string sysinfoJson       = sysinfoJsonReader.ReadToEnd();
         var    ht = new Hashtable
         {
             { "id", BmclCore.Config.Username },
             { "sysinfo", sysinfoJson },
             { "version", BmclCore.BmclVersion }
         };
         string postdata = ParsToString(ht);
         var    req      = (HttpWebRequest)WebRequest.Create("https://bmcl.bangbang93.com/usage");
         req.Method      = "POST";
         req.ContentType = "application/x-www-form-urlencoded";
         byte[] buffer = Encoding.UTF8.GetBytes(postdata);
         req.ContentLength = buffer.Length;
         var s = req.GetRequestStream();
         s.Write(buffer, 0, buffer.Length);
         s.Close();
         req.GetResponse();
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
     }
 }
Пример #2
0
 private void run()
 {
     try
     {
         var sysinfoJsonSerializer = new DataContractJsonSerializer(typeof(sysinfo));
         var sysinfoJsonStream = new MemoryStream();
         var systeminfo = new sysinfo();
         sysinfoJsonSerializer.WriteObject(sysinfoJsonStream, systeminfo);
         sysinfoJsonStream.Position = 0;
         var sysinfoJsonReader = new StreamReader(sysinfoJsonStream);
         string sysinfoJson = sysinfoJsonReader.ReadToEnd();
         var ht = new Hashtable
         {
             {"id", BmclCore.Config.Username},
             {"sysinfo", sysinfoJson},
             {"version", BmclCore.BmclVersion}
         };
         string postdata = ParsToString(ht);
         var req = (HttpWebRequest)WebRequest.Create("http://www.bangbang93.com/bmcl/bmcllog.php");
         req.Method = "POST";
         req.ContentType = "application/x-www-form-urlencoded";
         byte[] buffer = Encoding.UTF8.GetBytes(postdata);
         req.ContentLength = buffer.Length;
         var s = req.GetRequestStream();
         s.Write(buffer, 0, buffer.Length);
         s.Close();
         req.GetResponse();
     }
     catch (Exception ex)
     {
         Logger.log(ex);
     }
 }