0

我正在使用 c# winform 编写桌面应用程序。

该应用程序需要在启动时显示一个网页。但是我不确定每次启动时 Internet 是否可用,所以我想在每次运行时缓存网页。

现在我将网页的源代码(仅限 html)保存到文件中。然而,可能有多个与网页相关的文件,例如 imgs 和 css。

有没有一种优雅的方式来缓存所有这些东西?

4

1 回答 1

2

There is no elegant way of doing it. For caching you need to download the object (imgs, css & js). Above all caching is a painful thing, many of it has certain expiry time after which it should be re downloaded from server.

You can parse images, css, and Js from html source the easy way using HtmlAgilityPack that can help you a lot with parsing the HTML and can make you work little easier.

于 2013-05-01T02:39:39.163 回答