private List Hardwares = new List();
private class CHardware
{
public string HardwareType;
public List HardwareIdentities = new List();
public List SubHardwares = new List();
public CHardware ParentHardware;
public string HtmlMetaInfo;
public class CHardwareSerial
{
public List Areas = new List();
public class CHardwareSerialArea
{
public CHardwareSerialArea(string AreaName, string Scope)
{
this.mAreaName = AreaName;
this.Scope = Scope;
this.Regex = new System.Text.RegularExpressions.Regex(Scope);
}
public string AreaName {
get { return this.mAreaName; }
}
private string mAreaName;
private string Scope;
public System.Text.RegularExpressions.Regex Regex;
}
}
public bool IsMatch(System.Web.HttpRequest Request)
{
if (this.HardwareIdentities.Count == 0) return false;
foreach (CHardwareSerial HardwareSerial in this.HardwareIdentities) {
if (HardwareSerial.Areas.Count == 0) continue;
bool bMatchedAllAreas = true;
foreach (CHardwareSerial.CHardwareSerialArea Area in HardwareSerial.Areas) {
string szAreaVal = Request.Headers.Item(Area.AreaName);
if (szAreaVal == null) {
szAreaVal = "";
}
bMatchedAllAreas = bMatchedAllAreas & Area.Regex.IsMatch(szAreaVal);
}
if (bMatchedAllAreas == true) {
return true;
}
}
return false;
}
}
|