// Methods
public bool Check (Evidence evidence)
{
if (evidence == null)
return false;
string codebase = Assembly.GetCallingAssembly ().CodeBase;
Uri local = new Uri (codebase);
Url ucode = new Url (codebase);
// *both* ApplicationDirectory and Url must be in *Host* evidences
bool adir = false;
bool url = false;
IEnumerator e = evidence.GetHostEnumerator ();
while (e.MoveNext ()) {
object o = e.Current;
if (!adir && (o is ApplicationDirectory)) {
ApplicationDirectory ad = (o as ApplicationDirectory);
string s = ad.Directory;
adir = (String.Compare (s, 0, local.ToString (), 0, s.Length, true, CultureInfo.InvariantCulture) == 0);
}
else if (!url && (o is Url)) {
url = ucode.Equals (o);
}
// got both ?
if (adir && url)
return true;
}
return false;
}