C# Class Rhythm.Staticize.ResourcesDownloadBaseBehavior

提供对被爬行页面中引用资源的下载支持。
Inheritance: IBehavior
显示文件 Open project: darklx/Staticize

Public Methods

Method Description
Process ( HtmlAgilityPack document, HtmlStaticizeContext context ) : void
ResourcesDownloadBaseBehavior ( String outputBaseDirectory, String resourcesHtmlNodeSelectPath, IUriResourcesFromLocalFileSystemReslover resourceFileReslover = null ) : System

初始化 InterceptorForResourcesDownloadBase 的新实例。

Protected Methods

Method Description
GetSrcAttributes ( HtmlAgilityPack nodes ) : string[]

获取页面的Uri所在的目录名称。(仅支持页面)

获取资源 Html Node 的“src”属性。

OnResourceParsed ( Uri resourceUris, HtmlStaticizeContext context ) : void

当资源URL被正确解析,即将被下载时回调

Private Methods

Method Description
CreateAbsoluteUri ( Uri documentUri, string documenBaseDir, Uri uri ) : Uri
ParseResourcesUris ( Uri documentUri, string documenBaseDir, string srcAttributes ) : System.Uri[]

从“src”属性的值创建Uri对象。

Method Details

GetSrcAttributes() protected method

获取页面的Uri所在的目录名称。(仅支持页面) 获取资源 Html Node 的“src”属性。
protected GetSrcAttributes ( HtmlAgilityPack nodes ) : string[]
nodes HtmlAgilityPack Html Node集合
return string[]

OnResourceParsed() protected method

当资源URL被正确解析,即将被下载时回调
protected OnResourceParsed ( Uri resourceUris, HtmlStaticizeContext context ) : void
resourceUris System.Uri 当资源URL(集合)
context HtmlStaticizeContext
return void

Process() public method

public Process ( HtmlAgilityPack document, HtmlStaticizeContext context ) : void
document HtmlAgilityPack
context HtmlStaticizeContext
return void

ResourcesDownloadBaseBehavior() public method

初始化 InterceptorForResourcesDownloadBase 的新实例。
public ResourcesDownloadBaseBehavior ( String outputBaseDirectory, String resourcesHtmlNodeSelectPath, IUriResourcesFromLocalFileSystemReslover resourceFileReslover = null ) : System
outputBaseDirectory String 引用资源的输出文件夹。
resourcesHtmlNodeSelectPath String 引用资源的HTML标签XPath表达式。
resourceFileReslover IUriResourcesFromLocalFileSystemReslover 用于将Uri路径转换为本地路径。
return System