private static string ReadResourceContent(Resource resource, bool useCache) { if (Log.IsDebugEnabled) { Log.Debug("Reading content of " + resource.Path + "..."); } return(useCache ? resource.ReadFromCache(true) : resource.ReadNewContent()); }
/// <summary> /// If remote resource, return the URL as-is. /// If local resource (static or dynamic), append the URL with a content hash /// to make sure the browser always requests the latest contents. /// /// Per http://combres.codeplex.com/discussions/348659#post810556, /// retain only the first 32 chars to avoid being too long /// </summary> private static string GetResourceUrl(Resource resource) { if (!resource.IsInSameApplication) { return(resource.Path.ToAbsoluteUrl()); } var url = resource.Mode == ResourceMode.Dynamic ? resource.Path.ToAbsoluteUrl() : resource.Path.ResolveUrl(); var contentHash = resource.ReadFromCache(true).GetHash(); contentHash = contentHash.Length > 32 ? contentHash.Substring(0, 32) : contentHash; return((url + (url.Contains("?") ? "&" : "?") + contentHash) .AppendHost(resource.ParentSet.Settings)); }
/// <summary> /// If remote resource, return the URL as-is. /// If local resource (static or dynamic), append the URL with a content hash /// to make sure the browser always requests the latest contents. /// /// Per http://combres.codeplex.com/discussions/348659#post810556, /// retain only the first 32 chars to avoid being too long /// </summary> private static string GetResourceUrl(Resource resource) { if (!resource.IsInSameApplication) return resource.Path.ToAbsoluteUrl(); var url = resource.Mode == ResourceMode.Dynamic ? resource.Path.ToAbsoluteUrl() : resource.Path.ResolveUrl(); var contentHash = resource.ReadFromCache(true).GetHash(); contentHash = contentHash.Length > 32 ? contentHash.Substring(0, 32) : contentHash; return (url + (url.Contains("?") ? "&" : "?") + contentHash) .AppendHost(resource.ParentSet.Settings); }
/// <summary> /// If remote resource, return the URL as-is. /// If local resource (static or dynamic), append the URL with a content hash /// to make sure the browser always requests the latest contents. /// </summary> private static string GetResourceUrl(Resource resource) { if (!resource.IsInSameApplication) return resource.Path.ToAbsoluteUrl(); var url = resource.Mode == ResourceMode.Dynamic ? resource.Path.ToAbsoluteUrl() : resource.Path.ResolveUrl(); var contentHash = resource.ReadFromCache(true).GetHash(); return url + (url.Contains("?") ? "&" : "?") + contentHash; }