Exemplo n.º 1
0
        public static Bitmap Load(string url)
        {
            if (url == string.Empty || url.Remove(0, url.IndexOf("://") + 3) == string.Empty)
            {
                return(null);
            }
            Uri uri = null;

            try
            {
                uri = new Uri(url);
            }
            catch (Exception ex)
            {
                return(null);
            }
            string key = uri.Scheme + "://" + uri.Host;
            Dictionary <string, Bitmap> favicons = FileOptions.LoadFavicons();

            if (favicons.ContainsKey(key))
            {
                return(favicons[key]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public static void AddNew(string url, Bitmap bmp)
        {
            Uri    uri = new Uri(url);
            string key = uri.Scheme + "://" + uri.Host;
            Dictionary <string, Bitmap> favicons = FileOptions.LoadFavicons();

            if (!favicons.ContainsKey(key))
            {
                favicons.Add(key, bmp);
            }
            FileOptions.SaveFavicons(favicons);
        }