public static redditAbout GetMe(redditLogin session)
 {
     redditAbout rAbbout = null;
     var request = new redditRequest
     {
         Method = "GET",
         Cookie = session.Data.Storage.cookie,
         User = session.UserHandle,
         Url = "http://www.reddit.com/api/me.json"
     };
     var json = string.Empty;
     if (request.Execute(out json) != HttpStatusCode.OK)
         throw new Exception(json);
     rAbbout = JsonConvert.DeserializeObject<redditAbout>(json);
     return rAbbout;
 }
 public static redditMessage Inbox(redditLogin session)
 {
     redditMessage msg = null;
     try
     {
         var request = new redditRequest
         {
             Method = "GET",
             Cookie = session.Data.Storage.cookie,
             User = session.UserHandle,
             Url = "http://www.reddit.com/message/inbox/.json"
         };
         var json = string.Empty;
         if (request.Execute(out json) != HttpStatusCode.OK)
             throw new Exception(json);
         msg = JsonConvert.DeserializeObject<redditMessage>(json);
     }
     catch
     {
         throw new Exception("Unable To Reach Inbox");
     }
     return msg;
 }
 public static bool HasMail(redditLogin session)
 {
     redditAbout a = GetMe(session);
     return a.data.has_mail;
 }
        public static string SendVote(string Full_ID, Vote vote, redditLogin session)
        {
            string buffer = string.Empty;
            try
            {
                var request = new redditRequest
                {
                    Method = "GET",
                    Cookie = session.Data.Storage.cookie,
                    User = session.UserHandle,
                    Url = "http://www.reddit.com/api/me.json"
                };
                var xml = string.Empty;
                if (request.Execute(out xml) != HttpStatusCode.OK)
                    throw new Exception(xml);
            }
            catch (Exception exp)
            {

            }
            return buffer;
        }
 public static redditMessageChild ReadMessage(redditLogin session, string id, redditMessage msg)
 {
     redditMessage mail = null;
     if (msg != null)
     {
         mail = msg;
     }
     else
     {
         mail = Inbox(session);
     }
     if (mail.data.children.Capacity > 0)
     {
         foreach (redditMessageChild child in mail.data.children)
         {
             if (child.data.id == id)
             {
                 return child;
             }
         }
     }
     return null;
 }
 public static void Logout(redditLogin login)
 {
     redditRequest request;
     string json = string.Empty;
     try
     {
         if (login.Data.Storage == null)
         {
             throw new Exception("Login Data Null");
         }
         if (String.IsNullOrEmpty(login.Data.Storage.modhash) || String.IsNullOrEmpty(login.Data.Storage.cookie))
         {
             throw new Exception("Login Data NULL");
         }
         request = new redditRequest
         {
             Url = "http://www.reddit.com/logout?uh=" + login.Data.Storage.modhash,
             Method = "POST",
             User = login.UserHandle,
             Cookie = login.Data.Storage.cookie,
             Content = "uh=" + login.Data.Storage.modhash + "&top=off"
         };
         if (request.Execute(out json) != HttpStatusCode.OK)
         {
             throw new Exception(json);
         }
     }
     catch (Exception exp)
     {
         throw exp;
     }
 }