コード例 #1
0
        // Token: 0x0600286E RID: 10350 RVA: 0x00095A18 File Offset: 0x00093C18
        public static string GetResourcesHash(ResourceBase[] resources, IPageContext context, bool bootResources, string owaVersion)
        {
            List <byte[]> list = new List <byte[]>();

            foreach (ResourceBase resourceBase in resources)
            {
                list.Add(Encoding.ASCII.GetBytes(resourceBase.GetResourcePath(context, bootResources).Replace(owaVersion, string.Empty)));
            }
            return(Convert.ToBase64String(AppCacheManifestHandlerBase.CalculateHashOnHashes(list)));
        }
コード例 #2
0
        // Token: 0x06002654 RID: 9812 RVA: 0x0008A9C8 File Offset: 0x00088BC8
        private void WriteManifest(bool isOffline)
        {
            StringBuilder stringBuilder = new StringBuilder(this.ManifestTemplate);

            if (string.IsNullOrWhiteSpace(stringBuilder.ToString()))
            {
                string text = string.Format("User {0} request for {1} manifest fetched null or empty manifest", AppCacheManifestHandler.GetUserContextId(this.Context), this.UserAgent.Layout);
                ExTraceGlobals.AppcacheManifestHandlerTracer.TraceError((long)this.GetHashCode(), text);
                throw new ArgumentNullException(text);
            }
            bool generateBootResourcesAppcache = !isOffline;

            stringBuilder = this.AddTemplatedParameters(stringBuilder, generateBootResourcesAppcache);
            string text2 = stringBuilder.ToString();

            this.Response.Write(text2);
            string[] array = text2.Split(new char[]
            {
                '\r',
                '\n',
                ' ',
                '\t'
            }, StringSplitOptions.RemoveEmptyEntries);
            string        resourceDirectory = this.ResourceDirectory;
            List <byte[]> list = new List <byte[]>();

            foreach (string text3 in array)
            {
                if (text3.StartsWith(resourceDirectory))
                {
                    list.Add(AppCacheManifestHandlerBase.GetHash(text3.Substring(3), this.VersionString));
                }
            }
            IOrderedEnumerable <string> orderedEnumerable = from id in this.GetEnabledFeatures()
                                                            orderby id
                                                            select id;

            foreach (string s in orderedEnumerable)
            {
                list.Add(Encoding.ASCII.GetBytes(s));
            }
            this.Response.Write("# ComputedHash: ");
            this.Response.Write(Convert.ToBase64String(AppCacheManifestHandlerBase.CalculateHashOnHashes(list)));
            this.Response.Write("\r\n");
            this.Response.Write("# Offline: ");
            this.Response.Write(isOffline.ToString().ToLower());
            this.Response.Write("\r\n");
        }
コード例 #3
0
 protected override void OnPreInit(EventArgs e)
 {
     this.UserAgent = OwaUserAgentUtilities.CreateUserAgentWithLayoutOverride(this.Context);
     this.IsAppCacheEnabledClient        = this.GetIsClientAppCacheEnabled(this.Context);
     this.IsOfflineAppCacheEnabledClient = (this.IsAppCacheEnabledClient && this.IsClientInOfflineMode);
     this.CompositeSessionData           = this.CalculateCompositeSessionDataEnabled();
     base.Response.AddHeader("pragma", "no-cache");
     base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
     base.Response.Cache.SetExpires(DateTime.UtcNow.AddYears(-1));
     if (UrlUtilities.IsAuthRedirectRequest(this.Context.Request) || AppCacheManifestHandlerBase.DoesBrowserSupportAppCache(this.UserAgent))
     {
         string url = null;
         if (this.ShouldRedirectWithoutUnnecessaryParams(out url))
         {
             base.Response.Redirect(url);
         }
     }
 }
コード例 #4
0
 // Token: 0x0600264F RID: 9807 RVA: 0x0008A78C File Offset: 0x0008898C
 private static byte[] GetHash(string fileName, string fileVersion)
 {
     try
     {
         FileInfo fileInfo            = new FileInfo(HttpContext.Current.Request.ServerVariables["APPL_PHYSICAL_PATH"] + fileName);
         Tuple <string, string>   key = Tuple.Create <string, string>(fileName, fileVersion);
         Tuple <DateTime, byte[]> tuple;
         if (!AppCacheManifestHandlerBase.hashMap.TryGetValue(key, out tuple))
         {
             tuple = Tuple.Create <DateTime, byte[]>(fileInfo.LastWriteTimeUtc, AppCacheManifestHandlerBase.CalculateFileHash(fileInfo));
         }
         else
         {
             if (!(tuple.Item1 != fileInfo.LastWriteTimeUtc))
             {
                 return(tuple.Item2);
             }
             tuple = Tuple.Create <DateTime, byte[]>(fileInfo.LastWriteTimeUtc, AppCacheManifestHandlerBase.CalculateFileHash(fileInfo));
         }
         Dictionary <Tuple <string, string>, Tuple <DateTime, byte[]> > dictionary = new Dictionary <Tuple <string, string>, Tuple <DateTime, byte[]> >(AppCacheManifestHandlerBase.hashMap);
         dictionary[key] = tuple;
         AppCacheManifestHandlerBase.hashMap = dictionary;
         return(tuple.Item2);
     }
     catch (FileNotFoundException)
     {
     }
     return(null);
 }