使用WebCacheTool项目中的WinInetAPI.cs和Win32API.cs两个类
class="brush:csharp;gutter:true;"> /// <summary> /// 获取IE缓存文件 /// </summary> /// <param name="domain">域名</param> private void GetFileByIECache(string domain) { string path = String.Empty; try { //获取.cfg后缀的文件 ArrayList results = WinInetAPI.FindUrlCacheEntries("\\.cfg"); foreach (WinInetAPI.INTERNET_CACHE_ENTRY_INFO entry in results) { //最后访问时间 DateTime accessTime = Convert.ToDateTime(Win32API.ToStringFromFileTime(entry.LastAccessTime)); if (entry.lpszSourceUrlName == null) continue; if (!entry.lpszSourceUrlName.Contains(domain)) { continue; } //entry.lpszSourceUrlName; path = entry.lpszLocalFileName; /* * 逻辑处理 */ // 删除 // WinInetAPI.DeleteFromUrlCache(localPath); } } catch (Exception ex) { TxtLog.InsertLog(ex, "BLL NewsPapers GetNewCFGFile() 提取缓存文件失败"); } }