Author: siwuzzz
Date: Wed May 30 15:46:05 2007
New Revision: 182

Modified:
   trunk/clients/cs/src/core/gauthrequest.cs
   trunk/clients/cs/src/core/service.cs
   trunk/clients/cs/src/core/tracing.cs

Log:
core/tracing.cs:
- calls to Tracing.TraceMsg() are now timestamped
- calls to Tracing.TraceCall() works and handle callee depth
- removed Tracing.Timestamp()

core/gauthrequest.cs:
- changed a bug in GDataGAuthRequest.EnsureWebRequest() that was causing Mono 
to complain.

core/service.cs:
- replaced the calls to Tracing.Timestamp() with Tracing.TraceCall()

Modified: trunk/clients/cs/src/core/gauthrequest.cs
==============================================================================
--- trunk/clients/cs/src/core/gauthrequest.cs   (original)
+++ trunk/clients/cs/src/core/gauthrequest.cs   Wed May 30 15:46:05 2007
@@ -377,17 +377,22 @@
                     http.Method != HttpMethods.Get &&
                     http.Method != HttpMethods.Post)
                 {
+                    // cache the method, because Mono will complain if we try
+                    // to open the request stream with a DELETE method.
+                    string currentMethod = http.Method;
+
+                    http.Headers.Add(GoogleAuthentication.Override, 
currentMethod);
+                    http.Method = HttpMethods.Post;
+
                     // not put and delete, all is post
-                    if (http.Method == HttpMethods.Delete)
+                    if (currentMethod == HttpMethods.Delete)
                     {
                         http.ContentLength = 0;
-                        // to make this NOT crash under .NET CF, get the 
request stream
-                        // and close it again
+                        // .NET CF won't send the ContentLength parameter if 
no stream
+                        // was opened. So open a dummy one, and close it right 
after.
                         Stream req = http.GetRequestStream(); 
                         req.Close(); 
                     }
-                    http.Headers.Add(GoogleAuthentication.Override, 
http.Method);
-                    http.Method = HttpMethods.Post; 
                 }
             }
         }
@@ -641,7 +646,7 @@
             }
             catch (Exception e)
             {
-                Tracing.TraceMsg("we caught an unknown exception");
+                Tracing.TraceCall("*** EXCEPTION " + e.GetType().Name + " 
CAUGTH ***");
                 throw e; 
             }
             finally

Modified: trunk/clients/cs/src/core/service.cs
==============================================================================
--- trunk/clients/cs/src/core/service.cs        (original)
+++ trunk/clients/cs/src/core/service.cs        Wed May 30 15:46:05 2007
@@ -186,7 +186,7 @@
         //////////////////////////////////////////////////////////////////////
         public Stream Query(Uri queryUri)
         {
-            Tracing.Timestamp("Service.Query - Stream - Enter"); 
+            Tracing.TraceCall("Enter");
             if (queryUri == null)
             {
                 throw new System.ArgumentNullException("queryUri");
@@ -196,7 +196,7 @@
 
             request.Execute();
             // return the response
-            Tracing.Timestamp("Service.Query - Stream - Exit"); 
+            Tracing.TraceCall("Exit");
             return request.GetResponseStream();
         }
         
/////////////////////////////////////////////////////////////////////////////
@@ -225,7 +225,7 @@
         public AtomFeed Query(FeedQuery feedQuery)
         {
             AtomFeed feed = null;
-            Tracing.Timestamp("Service.Query - Feed - Enter"); 
+            Tracing.TraceCall("Enter");
 
             if (feedQuery == null)
             {
@@ -259,7 +259,7 @@
                 feed.Parse(responseStream, AlternativeFormat.Atom); 
                 responseStream.Close();
             }
-            Tracing.Timestamp("Service.Query - Feed - Exit"); 
+            Tracing.TraceCall("Exit");
             return feed;
         }
         
/////////////////////////////////////////////////////////////////////////////

Modified: trunk/clients/cs/src/core/tracing.cs
==============================================================================
--- trunk/clients/cs/src/core/tracing.cs        (original)
+++ trunk/clients/cs/src/core/tracing.cs        Wed May 30 15:46:05 2007
@@ -120,11 +120,11 @@
                     if (msg != "")
                         outMsg += ": " + msg;
 
-                    Trace.WriteLine(outMsg);
+                    Tracing.TraceMsg(outMsg);
                 }
                 else
                 {
-                    Trace.WriteLine("Method Unknown: " + msg);
+                    Tracing.TraceMsg("Method Unknown: " + msg);
                 }
                 Trace.Flush();
             }
@@ -177,18 +177,6 @@
         }
 
         //////////////////////////////////////////////////////////////////////
-        /// <summary>Method to trace the a message with timestamping</summary> 
-        /// <param name="msg"> msg string to display</param>
-        //////////////////////////////////////////////////////////////////////
-        [Conditional("TRACE")] static public void Timestamp(string msg)
-        {
-            DateTime now = DateTime.Now;
-            msg = now.ToString("HH:mm:ss:ffff") + " - " + msg; 
-            Tracing.TraceMsg(msg);
-        }
-
-
-        //////////////////////////////////////////////////////////////////////
         /// <summary>Method to trace a message</summary> 
         /// <param name="msg"> msg string to display</param>
         //////////////////////////////////////////////////////////////////////
@@ -196,9 +184,10 @@
         {
             try
             {
-                Trace.WriteLine(msg); 
+                Trace.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss:ffff") + 
"] - " + msg);
                 Trace.Flush();
-            } catch 
+            } 
+            catch
             {
             }
         }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to