private static object GetEvidenceInfo(AppDomain appDomain, string exePath, out string typeName) {
ControlEvidencePermission.Assert();
Evidence evidence = appDomain.Evidence;
StrongName sn = null;
Url url = null;
if (evidence != null) {
IEnumerator e = evidence.GetHostEnumerator();
object temp = null;
while (e.MoveNext()) {
temp = e.Current;
if (temp is StrongName) {
sn = (StrongName) temp;
break;
}
else if (temp is Url) {
url = (Url) temp;
}
}
}
object o = null;
// The order of preference is StrongName, Url, ExePath.
if (sn != null) {
o = sn;
typeName = StrongNameDesc;
}
else if (url != null) {
// Extract the url string and normalize it to use as evidence
o = url.Value.ToUpperInvariant();
typeName = UrlDesc;
}
else if (exePath != null) {
o = exePath;
typeName = PathDesc;
}
else {
typeName = null;
}
return o;
}