/*
*
* http://mvcresourceloader.codeplex.com/license
*
* */
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Security.Permissions;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace InteSoft.Web.ExternalResourceLoader{
[AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class FileInfo : ConfigurationElement
{
private static ConfigurationProperty _propFilename;
private static ConfigurationProperty _propAction;
private static ConfigurationProperty _propIf;
private static ConfigurationPropertyCollection _properties;
internal FileInfo()
{
EnsureStaticPropertyBag();
}
private static ConfigurationPropertyCollection EnsureStaticPropertyBag()
{
if (_properties == null)
{
_propFilename = new ConfigurationProperty("filename", typeof (string), null, null, new StringValidator(1), ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
_propAction = new ConfigurationProperty("action", typeof(Action), Action.Show, ConfigurationPropertyOptions.None);
_propIf = new ConfigurationProperty("if", typeof(string), string.Empty, ConfigurationPropertyOptions.None);
_properties = new ConfigurationPropertyCollection
{
_propFilename,
_propAction,
_propIf
};
}
return _properties;
}
public FileInfo(string filename, Action action, string @if)
: this()
{
Filename = filename;
Action = action;
If = @if;
}
public override bool Equals(object namespaceInformation)
{
FileInfo info = namespaceInformation as FileInfo;
return ((info != null) && (Filename == info.Filename));
}
public override int GetHashCode()
{
return Filename.GetHashCode();
}
[StringValidator(MinLength = 1), ConfigurationProperty("filename", IsRequired = true, IsKey = true)]
public string Filename
{
get { return (string)base[_propFilename]; }
set { base[_propFilename] = value; }
}
[ConfigurationProperty("action", DefaultValue = Action.Show)]
public Action Action
{
get { return (Action)base[_propAction]; }
set { base[_propAction] = value; }
}
[ConfigurationProperty("if", DefaultValue = "")]
public string If
{
get { return (string)base[_propIf]; }
set { base[_propIf] = value; }
}
protected override ConfigurationPropertyCollection Properties
{
get { return EnsureStaticPropertyBag(); }
}
}
}
|