Example #1
0
 private static void ParseOutput(HtmlNode node, OutputInfo info)
 {
     for (var i = 0; i < node.ChildNodes.Count; i++)
     {
         var child = node.ChildNodes[i];
         if (child.Name == "img")
         {
             var src = child.Attributes["src"].Value;
             if (src.IndexOf("[imageHost]") > -1)
             {
                 var imageHost = DomainUtil.GetDomain("image");
                 //重写地址
                 child.Attributes["src"].Value = src.Replace("[imageHost]", imageHost);
             }
         }
         ParseOutput(child, info);
     }
 }
Example #2
0
 private static void ParseInput(HtmlNode node, InputContent info)
 {
     for (var i = 0; i < node.ChildNodes.Count; i++)
     {
         var child = node.ChildNodes[i];
         if (child.Name == "img")
         {
             var src       = child.Attributes["src"].Value;
             var imageHost = DomainUtil.GetDomain("image");
             if (src.IndexOf(imageHost) > -1)
             {
                 //提取key
                 info.ImageKeys.Push(ImageUtil.ParseKey(src));
                 //重写地址
                 child.Attributes["src"].Value = src.Replace(imageHost, "[imageHost]");
             }
             //(?<=http://)[\w\.]+[^/]
         }
         ParseInput(child, info);
     }
 }
Example #3
0
 public static string GetCoverUrl(Guid coverId, int width, int height)
 {
     return(DomainUtil.GetUrl("file", string.Format("/cover-{0}-{1}-{2}", coverId.ToString("N"), width, height)));
 }