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); } }
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); } }