Ejemplo n.º 1
0
 public userMapOverlay(IMapDrawable drawable, Geocode geocode, Library.User user)
 {
     _drawable = (userMapDrawable)drawable;
     _geocode = geocode;
     _user = user;
     _offset = new Point((ClientSettings.SmallArtSize + (ClientSettings.Margin * 2) / 2), (ClientSettings.SmallArtSize + (ClientSettings.Margin * 2)));
 }
Ejemplo n.º 2
0
        public static User FromId(string ID, Yedda.Twitter.Account Account)
        {
            Yedda.Twitter t = new Yedda.Twitter();
            t.AccountInfo = Account;
            string Response = null;
            try
            {
                Response = t.Show(ID, Yedda.Twitter.OutputFormatType.XML);
            }
            catch
            {
                User toReturn = new User();
                toReturn.screen_name = "PockeTwitUnknownUser";
                return toReturn;
            }

            try
            {
                XmlSerializer s = new XmlSerializer(typeof(User));
                if (string.IsNullOrEmpty(Response))
                {
                    User toReturn = new User();
                    toReturn.screen_name = "PockeTwitUnknownUser";
                    return toReturn;
                }
                using (System.IO.StringReader r = new System.IO.StringReader(Response))
                {
                    return (User)s.Deserialize(r);
                }
            }
            catch
            {
                User toReturn = new User();
                toReturn.screen_name = "PockeTwitUnknownUser";
                return toReturn;
            }
        }
Ejemplo n.º 3
0
        public static User FromId(string ID, Twitter.Account Account)
        {
            var t = new Twitter {AccountInfo = Account};
            string response = null;
            try
            {
                response = t.Show(ID, Twitter.OutputFormatType.XML);
            }
            catch
            {
                var toReturn = new User {screen_name = "PockeTwitUnknownUser"};
                return toReturn;
            }

            try
            {
                var s = new XmlSerializer(typeof (User));
                if (string.IsNullOrEmpty(response))
                {
                    var toReturn = new User {screen_name = "PockeTwitUnknownUser"};
                    return toReturn;
                }
                using (var r = new StringReader(response))
                {
                    User result = (User)s.Deserialize(r);
                    result._needsFetching = false;
                    return result;
                }
            }
            catch
            {
                var toReturn = new User {screen_name = "PockeTwitUnknownUser"};
                return toReturn;
            }
        }
Ejemplo n.º 4
0
        private static status DeserializeSingleJSONStatus(System.Collections.Hashtable jsonTable, StatusTypes TypeOfMessage)
        {
            
            var u = new User
                        {
                            id = jsonTable["from_user_id"].ToString(),
                            needsFetching = true,
                            screen_name = (string) jsonTable["from_user"],
                            profile_image_url = (string) jsonTable["profile_image_url"],
                            //Search results don't contain this info!
                            name = "",
                            description = ""
                        };

            var ret = new status
                          {
                              user = u,
                              text = (string) jsonTable["text"],
                              id = jsonTable["id"].ToString(),
                              created_at = (string) jsonTable["created_at"],
                              source = (string) jsonTable["source"],
                              TypeofMessage = TypeOfMessage,
                              //Search results don't contain this info!
                              in_reply_to_status_id = "",
                              favorited = ""
                          };
            
            return ret;
        }
Ejemplo n.º 5
0
        public static List<status> GetList(TimelineManagement.TimeLineType typeToGet, int Count, string Constraints)
        {
            var cache = new List<status>();
            using (SQLiteConnection conn = GetConnection())
            {
                string FetchQuery = SQLFetchFromCache;
                FetchQuery = FetchQuery + " WHERE " + AddTypeWhereClause(typeToGet) + Constraints + SQLOrder + SQLLimit;

                using (var comm = new SQLiteCommand(FetchQuery, conn))
                {
                    comm.Parameters.Add(new SQLiteParameter("@count", Count));
                    conn.Open();
                    using (SQLiteDataReader r = comm.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            var newStat = new status
                                              {
                                                  id = r.GetString(0),
                                                  text = r.GetString(1),
                                                  TypeofMessage = ((StatusTypes) r.GetInt32(14)),
                                                  createdAt = r.GetDateTime(3),
                                                  in_reply_to_status_id = r.GetString(4),
                                                  favorited = r.GetString(5),
                                                  source = r.GetString(6),
                                                  AccountSummary = r.GetString(7),
                                                  SearchTerm = r.GetString(10)
                                              };    

                            var u = new User
                                        {
                                            id = r.GetString(2),
                                            screen_name = r.GetString(10),
                                            name = r.GetString(11),
                                            description = r.GetString(12),
                                            profile_image_url = r.GetString(13)
                                        };
                            newStat.user = u;
                            cache.Add(newStat);
                        }
                    }
                    conn.Close();
                }
            }
            return cache;
        }