Beispiel #1
0
        public void setSamune(string url)
        {
            //if (string.IsNullOrEmpty(url)) return;
            if (isTest)
            {
                thumbnailPictureBox.Image = new Bitmap(Image.FromFile(ri.thumbnailUrl), thumbnailPictureBox.Size);
                return;
            }
            var img         = ThumbnailManager.getImageId(ri.comId);
            var isSaveCache = bool.Parse(config.get("alartCacheIcon"));

            if (img != null && isSaveCache)
            {
                ThumbnailManager.saveImage(img, ri.comId);
            }
            if (img == null && !string.IsNullOrEmpty(url))
            {
                img = ThumbnailManager.getThumbnailRssUrl(url, isSaveCache, true);
            }
            thumbnailPictureBox.Image = img;

            /*
             * if (!util.isShowWindow) return;
             * if (IsDisposed) return;
             * WebClient cl = new WebClient();
             * cl.Proxy = null;
             *
             * System.Drawing.Icon icon =  null;
             * try {
             * byte[] pic = cl.DownloadData(url);
             *
             *
             *      var  st = new System.IO.MemoryStream(pic);
             *      icon = Icon.FromHandle(new System.Drawing.Bitmap(st).GetHicon());
             *      st.Close();
             *
             *
             * } catch (Exception e) {
             *      util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
             *      util.debugWriteLine("set samune url error " + url);
             *      return;
             * }
             *
             * try {
             * Invoke((MethodInvoker)delegate() {
             *      try {
             *                          thumbnailPictureBox.Image = icon.ToBitmap();
             *
             *      } catch (Exception e) {
             *              util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
             *      }
             * });
             * } catch (Exception e) {
             * util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
             * }
             *
             *
             * //                   Icon = new System.Drawing.Icon(url);
             */
        }
Beispiel #2
0
        public Image getThumbnail(string url, bool isSaveCache)
        {
            //return ThumbnailManager.getThumbnailRssUrl(url, isSaveCache);
            var img = ThumbnailManager.getThumbnailRssUrl(url, isSaveCache);

            if (img == null)
            {
                return(null);
            }
            return(new Bitmap(img, 50, 50));
            //return null;
        }
Beispiel #3
0
        public Image getThumbnail(string url, config.config config)
        {
            var isSaveCache = bool.Parse(config.get("liveListCacheIcon"));
            var isGetIcon   = bool.Parse(config.get("liveListGetIcon"));
            //return ThumbnailManager.getThumbnailRssUrl(url, isSaveCache);
            var img = ThumbnailManager.getThumbnailRssUrl(url, isSaveCache, isGetIcon);

            if (img == null)
            {
                return(null);
            }
            return(new Bitmap(img, 50, 50));
            //return null;
        }
Beispiel #4
0
        public void setSamune(string url)
        {
            //if (string.IsNullOrEmpty(url)) return;
            if (isTest)
            {
                thumbnailPictureBox.Image = new Bitmap(Image.FromFile(ri.thumbnailUrl), thumbnailPictureBox.Size);
                return;
            }
            Image img;
            var   dt0 = DateTime.Now;

            if (!ThumbnailManager.isExist(ri.comId, out img))
            {
                util.debugWriteLine("is not exist thumbnail time " + (DateTime.Now - dt0) + " " + ri.comName);

                img = ThumbnailManager.getImageId(ri.comId);
                if (img != null)
                {
                    ThumbnailManager.saveImage(img, ri.comId);
                }
                if (img == null && !string.IsNullOrEmpty(url))
                {
                    img = ThumbnailManager.getThumbnailRssUrl(url, true);
                }
            }
            else
            {
                util.debugWriteLine("is exist thumbnail time " + (DateTime.Now - dt0) + " " + ri.comName);
            }
            thumbnailPictureBox.Image = img;

            util.debugWriteLine("is set thumbnail time " + (DateTime.Now - dt0) + " " + ri.comName);

            /*
             * if (!util.isShowWindow) return;
             * if (IsDisposed) return;
             * WebClient cl = new WebClient();
             * cl.Proxy = null;
             *
             * System.Drawing.Icon icon =  null;
             * try {
             * byte[] pic = cl.DownloadData(url);
             *
             *
             *      var  st = new System.IO.MemoryStream(pic);
             *      icon = Icon.FromHandle(new System.Drawing.Bitmap(st).GetHicon());
             *      st.Close();
             *
             *
             * } catch (Exception e) {
             *      util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
             *      util.debugWriteLine("set samune error " + url);
             *      return;
             * }
             *
             * try {
             * Invoke((MethodInvoker)delegate() {
             *      try {
             *                          thumbnailPictureBox.Image = icon.ToBitmap();
             *
             *      } catch (Exception e) {
             *              util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
             *      }
             * });
             * } catch (Exception e) {
             * util.debugWriteLine(e.Message + " " + e.StackTrace + " " + e.Source + " " + e.TargetSite);
             * }
             *
             *
             * //                   Icon = new System.Drawing.Icon(url);
             */
        }