Beispiel #1
0
        /// <summary>
        /// Loads the HTML for the named view.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public async Task <string> LoadAsync(string name)
        {
            var value = cache.Read(name);

            if (value == null)
            {
                value = await inner.LoadAsync(name);

                cache.Write(name, value);
            }
            return(value);
        }
Beispiel #2
0
        static string LoadResourceString(string name)
        {
            string value = cache.Read(name);

            if (value == null)
            {
                var assembly = typeof(AssetManager).Assembly;
                var s        = assembly.GetManifestResourceStream(name);
                if (s != null)
                {
                    using (var sr = new StreamReader(s))
                    {
                        value = sr.ReadToEnd();
                        cache.Write(name, value);
                    }
                }
            }
            return(value);
        }