thememanager.cs

来自「community server 源码」· CS 代码 · 共 66 行

CS
66
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Web.Caching;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.Configuration;
using CommunityServer.Controls;

namespace CommunityServer.Blogs.Controls
{
	/// <summary>
	/// Summary description for ThemeManager.
	/// </summary>
    public class ThemeManager : BaseThemeManager
    {
        private NameValueCollection SkinList = new NameValueCollection();
        private Hashtable ThemeList = new Hashtable();
        public static string CacheKey = "WeblogThemeManager";
        private ThemeManager()
        {

        }

        public static ThemeManager Instance()
        {
            ThemeManager tm = CSCache.Get(CacheKey) as ThemeManager;
            if (tm == null)
            {
                tm = new ThemeManager();
                CacheDependency dep = new CacheDependency(null, new string[] { CSConfiguration.CacheKey });
                CSCache.Insert(CacheKey, tm, dep);
            }

            return tm;
        }

        protected override ThemedApplicationKeyApplicationConfiguration Config
        {
            get { return WeblogConfiguration.Instance(); }
        }


        public static string SkinPath()
        {
            CSContext cntx = CSContext.Current;
            if (cntx.IsWebRequest)
            {
                Weblog blog = Weblogs.GetWeblog(cntx.ApplicationKey);
                string path = WeblogConfiguration.Instance().ThemeLocation + blog.Theme + "/";
                if (path.EndsWith("/"))
                    path = path.Substring(0, path.Length - 1);
                return path.Replace("~", Globals.ApplicationPath);
            }
            else
                return string.Empty;
        }
    }		
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?