Exemple #1
0
        public static byte[] GetJs(RenderContext context)
        {
            string lang = LanguageSetting.GetCmsLangCode(context);

            if (!jsCache.ContainsKey(lang))
            {
                return(null);
            }
            return(jsCache[lang]);
        }
Exemple #2
0
        public static string GetHtml(RenderContext context, Guid Key)
        {
            var lang  = LanguageSetting.GetCmsLangCode(context);
            var cache = GetLangHtmlCache(lang);

            if (cache.ContainsKey(Key))
            {
                return(cache[Key]);
            }
            return(null);
        }
Exemple #3
0
        public static byte[] SetGetJs(RenderContext context, byte[] binary)
        {
            string lang = LanguageSetting.GetCmsLangCode(context);

            if (!jsCache.ContainsKey(lang))
            {
                lock (_jscachelock)
                {
                    if (!jsCache.ContainsKey(lang))
                    {
                        string text   = System.Text.Encoding.UTF8.GetString(binary);
                        var    tasks  = LanguageTaskHelper.ParseJs(text);
                        string langjs = LanguageTaskHelper.Render(tasks, lang);
                        jsCache[lang] = System.Text.Encoding.UTF8.GetBytes(langjs);
                    }
                }
            }
            return(jsCache[lang]);
        }
Exemple #4
0
        public static string SetGetHtml(RenderContext context, Guid Key, string source)
        {
            var lang  = LanguageSetting.GetCmsLangCode(context);
            var cache = GetLangHtmlCache(lang);

            string langhtml = null;

            if (!cache.ContainsKey(Key))
            {
                lock (_locker)
                {
                    var tasks = LanguageTaskHelper.ParseDom(source);
                    langhtml   = LanguageTaskHelper.Render(tasks, lang);
                    cache[Key] = langhtml;
                }
            }
            else
            {
                langhtml = cache[Key];
            }
            return(langhtml);
        }