themeconfig.cs
来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 102 行
CS
102 行
//------------------------------------------------------------------------------
// <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 + =
减小字号Ctrl + -
显示快捷键?