コード例 #1
0
ファイル: RavenClient.cs プロジェクト: alex347/raven-csharp
 public RavenClient(DSN dsn)
 {
     CurrentDSN = dsn;
     Compression = true;
     Logger = "root";
     AllowHttpAuthentication = false;
 }
コード例 #2
0
ファイル: RavenClient.cs プロジェクト: alex347/raven-csharp
 public RavenClient(string dsn)
 {
     CurrentDSN = new DSN(dsn);
     Compression = true;
     Logger = "root";
     AllowHttpAuthentication = false;
 }
コード例 #3
0
        public RavenClient(DSN dsn)
        {
            WebRequest.RegisterPrefix("http", new HttpRequestCreator());

            CurrentDSN  = dsn;
            Compression = true;
            Logger      = "root";
        }
コード例 #4
0
ファイル: RavenClient.cs プロジェクト: kimsama/Unity3D-Raven
        public RavenClient(DSN dsn)
        {
            WebRequest.RegisterPrefix("http", new HttpRequestCreator());

            CurrentDSN = dsn;
            Compression = true;
            Logger = "root";
        }
コード例 #5
0
        public bool Send(JsonPacket jp, DSN dsn)
        {
            //try
            {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(dsn.SentryURI);
                request.Method      = "POST";
                request.Accept      = "application/json";
                request.ContentType = "application/json; charset=utf-8";
                request.Headers.Add("X-Sentry-Auth", PacketBuilder.CreateAuthenticationHeader(dsn));
                request.UserAgent = "RavenSharp/1.0";
                request.Timeout   = 2000;

                //Console.WriteLine("Header: " + PacketBuilder.CreateAuthenticationHeader(dsn));
                //Console.WriteLine("Packet: " + jp.Serialize());

                // Write the messagebody.
                using (Stream s = request.GetRequestStream())
                {
                    string data = jp.Serialize();
                    if (LogScrubber != null)
                    {
                        data = LogScrubber.Scrub(data);
                    }
                    byte[] byteArray = Encoding.UTF8.GetBytes(data);

                    s.Write(byteArray, 0, byteArray.Length);
                }

                using (HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse())
                {
                }
            }            /*
                          * catch (WebException e)
                          * {
                          *     Console.ForegroundColor = ConsoleColor.Red;
                          *     Console.Write("[ERROR] ");
                          *     Console.ForegroundColor = ConsoleColor.Gray;
                          *     Console.WriteLine(e.Message);
                          *
                          *     if (e.Response != null)
                          *     {
                          *             string messageBody = String.Empty;
                          *             using (StreamReader sw = new StreamReader(e.Response.GetResponseStream()))
                          *             {
                          *                     messageBody = sw.ReadToEnd();
                          *             }
                          *             Console.WriteLine("[MESSAGE BODY] " + messageBody);
                          *     }
                          *
                          *     return false;
                          * }*/

            return(true);
        }
コード例 #6
0
ファイル: RavenClient.cs プロジェクト: striglone/raven-csharp
 public RavenClient(DSN dsn)
 {
     CurrentDSN = dsn;
     Compression = true;
 }
コード例 #7
0
ファイル: RavenClient.cs プロジェクト: striglone/raven-csharp
 public RavenClient(string dsn)
 {
     CurrentDSN = new DSN(dsn);
     Compression = true;
 }
コード例 #8
0
ファイル: RavenClient.cs プロジェクト: striglone/raven-csharp
        public bool Send(JsonPacket jp, DSN dsn)
        {
            try {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(dsn.SentryURI);
                request.Method = "POST";
                request.Accept = "application/json";
                request.ContentType = "application/json; charset=utf-8";
                request.Headers.Add("X-Sentry-Auth", PacketBuilder.CreateAuthenticationHeader(dsn));
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

                request.UserAgent = "RavenSharp/1.0";

                Console.WriteLine("Header: " + PacketBuilder.CreateAuthenticationHeader(dsn));
                Console.WriteLine("Packet: " + jp.Serialize());

                // Write the messagebody.
                using (Stream s = request.GetRequestStream()) {
                    using (StreamWriter sw = new StreamWriter(s)) {
                        // Compress and encode.
                        //string data = Utilities.GzipUtil.CompressEncode(jp.Serialize());
                        //Console.WriteLine("Writing: " + data);
                        // Write to the JSON script when ready.
                        sw.Write(jp.Serialize());
                        // Close streams.
                        sw.Flush();
                        sw.Close();
                    }
                    s.Flush();
                    s.Close();
                }

                HttpWebResponse wr = (HttpWebResponse)request.GetResponse();
            } catch (WebException e) {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("[ERROR] ");
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine(e.Message);

                string messageBody = String.Empty;
                using (StreamReader sw = new StreamReader(e.Response.GetResponseStream())) {
                    messageBody = sw.ReadToEnd();
                }
                Console.WriteLine("[MESSAGE BODY] " + messageBody);

                return false;
            }

            return true;
        }
コード例 #9
0
        public bool Send(JsonPacket packet, DSN dsn)
        {
            packet.Logger = Logger;

            try {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(dsn.SentryURI);
                request.Method      = "POST";
                request.Accept      = "application/json";
                request.ContentType = "application/json; charset=utf-8";
                request.Headers.Add("X-Sentry-Auth", PacketBuilder.CreateAuthenticationHeader(dsn));
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
                request.UserAgent = "RavenSharp/1.0";

                Debug.Log("Header: " + PacketBuilder.CreateAuthenticationHeader(dsn));
                Debug.Log("Packet: " + packet.Serialize());

                // Write the messagebody.
                using (Stream s = request.GetRequestStream()) {
                    using (StreamWriter sw = new StreamWriter(s)) {
                        // Compress and encode.
                        //string data = Utilities.GzipUtil.CompressEncode(packet.Serialize());
                        //Console.WriteLine("Writing: " + data);
                        // Write to the JSON script when ready.
                        string data = packet.Serialize();
                        if (LogScrubber != null)
                        {
                            data = LogScrubber.Scrub(data);
                        }

                        sw.Write(data);
                        // Close streams.
                        sw.Flush();
                        sw.Close();
                    }
                    s.Flush();
                    s.Close();
                }

                using (HttpWebResponse wr = (HttpWebResponse)request.GetResponse())
                {
                    wr.Close();
                }
            } catch (WebException e) {
                /*
                 * Console.ForegroundColor = ConsoleColor.Red;
                 * Console.Write("[ERROR] ");
                 * Console.ForegroundColor = ConsoleColor.Gray;
                 */
                Debug.Log("[ERROR] " + e.Message);

                string messageBody = String.Empty;
                if (e.Response != null)
                {
                    using (StreamReader sw = new StreamReader(e.Response.GetResponseStream()))
                    {
                        messageBody = sw.ReadToEnd();
                    }
                    Debug.Log("[MESSAGE BODY] " + messageBody);
                }

                return(false);
            }

            return(true);
        }
コード例 #10
0
ファイル: RavenClient.cs プロジェクト: jalaziz/raven-csharp
 public RavenClient(DSN dsn)
 {
     CurrentDSN = dsn;
     Compression = true;
     Logger = "root";
 }
コード例 #11
0
ファイル: RavenClient.cs プロジェクト: jalaziz/raven-csharp
 public RavenClient(string dsn)
 {
     CurrentDSN = new DSN(dsn);
     Compression = true;
     Logger = "root";
 }
コード例 #12
0
ファイル: RavenClient.cs プロジェクト: ivelum/SharpRaven
        public bool Send(JsonPacket jp, DSN dsn)
        {
            //try
            {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(dsn.SentryURI);
                request.Method = "POST";
                request.Accept = "application/json";
                request.ContentType = "application/json; charset=utf-8";
                request.Headers.Add("X-Sentry-Auth", PacketBuilder.CreateAuthenticationHeader(dsn));
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
                request.UserAgent = "RavenSharp/1.0";
                request.Timeout = 2000;

                //Console.WriteLine("Header: " + PacketBuilder.CreateAuthenticationHeader(dsn));
                //Console.WriteLine("Packet: " + jp.Serialize());

                // Write the messagebody.
                using (Stream s = request.GetRequestStream())
                {
                    string data = jp.Serialize();
                    if (LogScrubber != null)
                        data = LogScrubber.Scrub(data);
                    byte[] byteArray = Encoding.UTF8.GetBytes(data);

                    s.Write(byteArray, 0, byteArray.Length);
                }

                using (HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse())
                {
                }

            }/*
            catch (WebException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("[ERROR] ");
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine(e.Message);

                if (e.Response != null)
                {
                    string messageBody = String.Empty;
                    using (StreamReader sw = new StreamReader(e.Response.GetResponseStream()))
                    {
                        messageBody = sw.ReadToEnd();
                    }
                    Console.WriteLine("[MESSAGE BODY] " + messageBody);
                }

                return false;
            }*/

            return true;
        }
コード例 #13
0
 public RavenClient(DSN dsn)
 {
     CurrentDSN  = dsn;
     Compression = true;
     Logger      = "root";
 }
コード例 #14
0
 public RavenClient(string dsn)
 {
     CurrentDSN  = new DSN(dsn);
     Compression = true;
     Logger      = "root";
 }