示例#1
0
        /// <summary>
        /// BackgroundWorkerから呼び出されるサムネイル画像作成デリゲート
        /// </summary>
        /// <param name="args">CreateImageArgs</param>
        /// <returns>サムネイル画像作成に成功した場合はTrue,失敗した場合はFalse
        /// なお失敗した場合はargs.errmsgにエラーを表す文字列がセットされる</returns>
        /// <remarks></remarks>
        private static bool My365_CreateImage(CreateImageArgs args)
        {
            var src = string.Empty;

            if (!new HttpVarious().GetData(args.Url.Value, null, ref src, 0, ref args.Errmsg, MyCommon.GetUserAgentString()))
            {
                return(false);
            }

            var thummc = Regex.Match(src, "property=\"og:image\" content=\"([^\"]+)\"", RegexOptions.IgnoreCase);

            if (!thummc.Success)
            {
                return(false);
            }

            var thumburl = thummc.Result("$1");
            var img      = new HttpVarious().GetImage(thumburl, args.Url.Key, 10000, ref args.Errmsg);

            if (img == null)
            {
                return(false);
            }

            args.AddTooltipInfo(args.Url.Key, string.Empty, img);
            return(true);
        }