Example #1
0
        private string GetManifestFile(UrlHelper url, out string newChecksum)
        {
            string leadComment = $"App Version: {GetType().Assembly.GetName().Version}", cachePart = "", networkPart = "*", fallbackPart = "";

            leadComment = $"{leadComment}, Timestamp: {DateTime.Now.ToString("MMMM dd, yyyy H:mm:ss")}";

            var imgFolder = new DirectoryInfo(Server.MapPath("~/Content/Images"));

            var imgNames = GetFileNames(imgFolder);

            cachePart = string.Join(Environment.NewLine, imgNames.Select(img => url.Content($"~/Content/Images/{img}")));

            //cachePart = $"{cachePart}\n" + "http://cdtssql353d:8000/t/Horizon/views/CopaycardSuite_NIAD/2_CopaysandCostImpact?&isdebug=true";

            var manifestContent = $"CACHE:\n{cachePart}\n\nNETWORK:\n{networkPart}\n\nFALLBACK:\n{fallbackPart}";
            var checksum        = ChecksumHelper.GetMD5Checksum(manifestContent);

            newChecksum = checksum;

            var manifestFile = $"CACHE MANIFEST\n# {leadComment}, Checksum: {ChecksumHelper.GetMD5Checksum(manifestContent)}\n\n{manifestContent}";

            return(manifestFile);
        }