📄 themeconfig.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.IO;
using System.Web;
using System.Xml;
using CommunityServer.Components;
using CommunityServer.Galleries.Components;
namespace CommunityServer.Galleries.Controls
{
/// <summary>
/// Summary description for ThemeConfig.
/// </summary>
public class ThemeConfig
{
static GalleryConfiguration config = GalleryConfiguration.Instance();
public ThemeConfig(string name)
{
_name = name;
}
private string _name;
public string Name
{
get{ return _name;}
}
string _parent = null;
public string Parent
{
get{return _parent;}
}
private string[] _roles = null;
public string[] Roles
{
get{return _roles;}
}
public bool HasRoles
{
get{ return Roles != null && Roles.Length > 0 && Roles[0].Trim().Length > 0; }
}
public static ThemeConfig Create(string name)
{
ThemeConfig tc = new ThemeConfig(name);
string path = HttpContext.Current.Server.MapPath(config.ThemeLocation + name + "/skin.config");
if(File.Exists(path))
{
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlAttributeCollection atts = doc.SelectSingleNode("Skin").Attributes;
XmlAttribute parent = atts["parent"];
if(parent != null)
tc._parent = parent.Value;
XmlAttribute roles = atts["roles"];
if(roles != null)
tc._roles = roles.Value.Split(';');
}
else
tc._parent = config.DefaultTemplate;
return tc;
}
string dirPath = null;
public string ThemeDirectoryPath
{
get
{
if(dirPath == null)
dirPath = HttpContext.Current.Server.MapPath(config.ThemeLocation + Name) + "";
return dirPath;
}
}
public bool IsDefault
{
get { return string.Compare(Name, config.DefaultTemplate, true) == 0; }
}
public bool HasParent
{
get
{
return !IsDefault && !Globals.IsNullorEmpty(Parent);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -