Author: thomasvm
Date: 2007-05-16 01:53:23 -0400 (Wed, 16 May 2007)
New Revision: 77448

Added:
   trunk/facebook-sharp/examples/GetUser.cs
Modified:
   trunk/facebook-sharp/ChangeLog
   trunk/facebook-sharp/examples/Makefile.am
   trunk/facebook-sharp/src/Mono.Facebook/Location.cs
   trunk/facebook-sharp/src/Mono.Facebook/User.cs
Log:
2007-05-16 Thomas Van Machelen <[EMAIL PROTECTED]>
        * src/Mono.Facebook/Location.cs:
        * src/Mono.Facebook/User.cs: 
                fix some problems with deserialization, the generic Nullable 
                fields didn't behave as expected when no data was available 
                in the xml
        * examples/GetUser.cs: add an example to easily keep testing this
                in the future


Modified: trunk/facebook-sharp/ChangeLog
===================================================================
--- trunk/facebook-sharp/ChangeLog      2007-05-16 00:28:35 UTC (rev 77447)
+++ trunk/facebook-sharp/ChangeLog      2007-05-16 05:53:23 UTC (rev 77448)
@@ -1,3 +1,12 @@
+2007-05-16 Thomas Van Machelen <[EMAIL PROTECTED]>
+       * src/Mono.Facebook/Location.cs:
+       * src/Mono.Facebook/User.cs: 
+               fix some problems with deserialization, the generic Nullable 
+               fields didn't behave as expected when no data was available 
+               in the xml
+       * examples/GetUser.cs: add an example to easily keep testing this
+               in the future
+
 2007-04-27 Thomas Van Machelen <[EMAIL PROTECTED]>
        * src/Mono.Facebook/FacebookSession:
                add an extra constructor to restart an infinite session and

Added: trunk/facebook-sharp/examples/GetUser.cs
===================================================================
--- trunk/facebook-sharp/examples/GetUser.cs    2007-05-16 00:28:35 UTC (rev 
77447)
+++ trunk/facebook-sharp/examples/GetUser.cs    2007-05-16 05:53:23 UTC (rev 
77448)
@@ -0,0 +1,28 @@
+using System;
+using Mono.Facebook;
+
+namespace Mono.Facebook.Test
+{
+       class GetUser
+       {
+               static void Main(string[] args)
+               {
+                       // create session
+                       FacebookSession session = new 
FacebookSession("ca9511b32569d823f1d3a942b31c6c84", 
"61f4712317fb7a2d12581f523c01fe71");
+
+                       // create token and login with it
+                       Uri login = session.CreateToken();
+
+                       System.Diagnostics.Process.Start("firefox", 
login.AbsoluteUri);
+                       Console.WriteLine ("Press enter after you've logged 
in.");
+                       Console.ReadLine ();
+
+                       // get session key
+                       session.GetSession();
+
+                       // print out user's name
+                       Console.WriteLine (session.GetLoggedInUser 
().GetUserInfo ().Name);
+               }
+       }
+}
+

Modified: trunk/facebook-sharp/examples/Makefile.am
===================================================================
--- trunk/facebook-sharp/examples/Makefile.am   2007-05-16 00:28:35 UTC (rev 
77447)
+++ trunk/facebook-sharp/examples/Makefile.am   2007-05-16 05:53:23 UTC (rev 
77448)
@@ -1,4 +1,4 @@
-SAMPLES=GetAlbums.cs GetFriends.cs GetEvents.cs InfiniteSession.cs
+SAMPLES=GetAlbums.cs GetFriends.cs GetEvents.cs GetUser.cs InfiniteSession.cs
 MCSFLAGS= -debug -nologo -r:Mono.Facebook.dll
 
 EXTRA_DIST=$(SAMPLES)

Modified: trunk/facebook-sharp/src/Mono.Facebook/Location.cs
===================================================================
--- trunk/facebook-sharp/src/Mono.Facebook/Location.cs  2007-05-16 00:28:35 UTC 
(rev 77447)
+++ trunk/facebook-sharp/src/Mono.Facebook/Location.cs  2007-05-16 05:53:23 UTC 
(rev 77448)
@@ -42,7 +42,7 @@
                [XmlElement ("country")]
                public string Country;
 
-               [XmlElement ("zip", IsNullable = true)]
-               public System.Nullable<int> Zip;
+               [XmlElement ("zip")]
+               public string Zip;
        }
 }

Modified: trunk/facebook-sharp/src/Mono.Facebook/User.cs
===================================================================
--- trunk/facebook-sharp/src/Mono.Facebook/User.cs      2007-05-16 00:28:35 UTC 
(rev 77447)
+++ trunk/facebook-sharp/src/Mono.Facebook/User.cs      2007-05-16 05:53:23 UTC 
(rev 77448)
@@ -245,8 +245,18 @@
                [XmlElement ("interests")]
                public string Interests;
 
-               [XmlElement ("is_app_user", IsNullable = true)]
-               public System.Nullable<bool> IsAppUser;
+               [XmlElement ("is_app_user")]
+               public string is_app_user;
+               
+               public bool IsAppUser {
+                       get {
+                               try {
+                                       return bool.Parse(is_app_user);
+                               } catch {
+                                       return false; 
+                               }
+                       } 
+               }
 
                [XmlElement ("last_name")]
                public string LastName;
@@ -266,8 +276,8 @@
                [XmlElement ("name")]
                public string Name;
 
-               [XmlElement ("notes_count", IsNullable = true)]
-               public System.Nullable<int> NotesCount;
+               [XmlElement ("notes_count")]
+               public int NotesCount;
 
                [XmlElement ("pic")]
                public string Pic;
@@ -299,8 +309,8 @@
                [XmlElement ("political")]
                public string Political;
 
-               [XmlElement ("profile_update_time", IsNullable = true)]
-               public System.Nullable<long> ProfileUpdateTime;
+               [XmlElement ("profile_update_time")]
+               public long ProfileUpdateTime;
 
                [XmlElement ("quotes")]
                public string Quotes;
@@ -314,20 +324,42 @@
                [XmlElement ("sex")]
                public string Sex;
 
-               [XmlElement ("significant_other_id", IsNullable = true)]
-               public System.Nullable<long> SignificantOtherId;
+               [XmlElement ("significant_other_id")]
+               public string significant_other_id;
 
+               [XmlIgnore ()]
+               public long SignificantOtherId
+               {
+                       get { 
+                               try {
+                                       return long.Parse 
(significant_other_id); 
+                               } catch {
+                                       return 0; 
+                               }
+                       } 
+               }
+
                [XmlElement ("status")]
                public Status Status;
 
-               [XmlElement ("timezone", IsNullable = true)]
-               public System.Nullable<int> TimeZone;
+               [XmlElement ("timezone")]
+               public string timezone;
+               
+               public int TimeZone {
+                       get {
+                               try {
+                                       return int.Parse(timezone);
+                               } catch {
+                                       return 0; 
+                               }
+                       }
+               }
 
                [XmlElement ("tv")]
                public string Tv;
 
-               [XmlElement ("wall_count", IsNullable = true)]
-               public System.Nullable<int> WallCount;
+               [XmlElement ("wall_count")]
+               public int WallCount;
 
                [XmlElement ("work_history")]
                public WorkHistory WorkHistory;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to