Exemple #1
0
        /// <summary>
        /// Gets the modification date of a given path
        /// </summary>
        protected virtual DateTime GetModificationDateForPath(string path)
        {
            var fsPath   = HostingEnvironment.MapPath(path);
            var nodeHead = NodeHead.Get(path);

            if ((RepositoryPathProvider.DiskFSSupportMode == DiskFSSupportMode.Prefer || nodeHead == null) && System.IO.File.Exists(fsPath))
            {
                // If DiskFsSupportMode is Prefer and the file exists, or it's fallback but the node doesn't exist in the repo get the modification date from the file system
                return(System.IO.File.GetLastWriteTime(fsPath));
            }
            else if (path[0] == '/' && nodeHead != null)
            {
                // If the node exists, get it from the repo
                return(nodeHead.ModificationDate);
            }
            else if (path.Contains(ResourceHandler.UrlPart))
            {
                // Special case: resource script
                return(ResourceHandler.GetLastResourceModificationDate(null));
            }

            return(DateTime.MinValue);
        }