Exemplo n.º 1
0
        /// <summary>
        /// 获取文件或目录最后的写入UTC时间。
        /// </summary>
        /// <param name="virtualPathProvider">虚拟路径提供者。</param>
        /// <param name="virtualPath">虚拟路径。</param>
        /// <returns>UTC时间。</returns>
        public static DateTime?GetLastWriteTimeUtc(this IVirtualPathProvider virtualPathProvider, string virtualPath)
        {
            virtualPathProvider.NotNull("virtualPathProvider");
            virtualPath.NotEmptyOrWhiteSpace("virtualPath");

            var dateTime = virtualPathProvider.GetFileLastWriteTimeUtc(virtualPath);

            return(dateTime.HasValue ? dateTime : virtualPathProvider.GetDirectoryLastWriteTimeUtc(virtualPath));
        }