Esempio n. 1
0
 private string toJson(Message message)
 {
     MemoryStream stream = new MemoryStream();
     serializer.WriteObject(stream, message);
     stream.Position = 0;
     return new StreamReader(stream).ReadToEnd();
 }
Esempio n. 2
0
 private Boolean send(Message message)
 {
     string base64Output = toBase64(toJson(message));
     //System.Diagnostics.Debug.WriteLine(base64Output);
     WebRequest request = WebRequest.Create("http://api.mixpanel.com/track/?data=" + base64Output);
     HttpWebResponse response = (HttpWebResponse)request.GetResponse();
     response.Close();
     return response.StatusCode == HttpStatusCode.OK;
 }