本文整理汇总了C#中Mono.Cecil.TypeReference.GetFullName方法的典型用法代码示例。如果您正苦于以下问题:C# TypeReference.GetFullName方法的具体用法?C# TypeReference.GetFullName怎么用?C# TypeReference.GetFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.TypeReference
的用法示例。
在下文中一共展示了TypeReference.GetFullName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTypeDefinition
public TypeDefinition GetTypeDefinition (TypeReference type)
{
if (type == null)
return null;
TypeDefinition typeDef = type as TypeDefinition;
if (typeDef != null)
return typeDef;
AssemblyNameReference name = type.Scope as AssemblyNameReference;
if (name == null) {
GenericInstanceType gi = type as GenericInstanceType;
return gi == null ? null : GetTypeDefinition (gi.ElementType);
}
AssemblyDefinition assmDef;
try {
assmDef = Resolve (name);
} catch (FileNotFoundException) {
throw new ObfuscarException ("Unable to resolve dependency: " + name.Name);
}
string fullName = type.GetFullName ();
typeDef = assmDef.MainModule.GetType (fullName);
return typeDef;
}
示例2: GetTypeDefinition
public TypeDefinition GetTypeDefinition (TypeReference type)
{
if (type == null)
return null;
TypeDefinition typeDef = type as TypeDefinition;
if (typeDef != null)
return typeDef;
AssemblyNameReference name = type.Scope as AssemblyNameReference;
if (name == null) {
GenericInstanceType gi = type as GenericInstanceType;
return gi == null ? null : GetTypeDefinition (gi.ElementType);
}
AssemblyDefinition assmDef;
try {
assmDef = Resolve (name);
} catch (FileNotFoundException) {
throw new ObfuscarException ("Unable to resolve dependency: " + name.Name);
}
string fullName = type.GetFullName ();
typeDef = assmDef.MainModule.GetType (fullName);
if (typeDef != null)
return typeDef;
// IMPORTANT: handle type forwarding
if (!assmDef.MainModule.HasExportedTypes)
return null;
foreach (var exported in assmDef.MainModule.ExportedTypes) {
if (exported.FullName == fullName)
return exported.Resolve ();
}
return null;
}
示例3: GetMethods
private void GetMethods (TypeReference type)
{
string full_name = type.GetFullName ();
args1 [0] = full_name;
AddMethod (type.GetMethod (MethodSignatures.Equals));
AddMethod (type.GetMethod ("Equals", "System.Boolean", args1));
AddMethod (type.GetMethod ("CompareTo", "System.Int32", args1)); // generic version
AddMethod (type.GetMethod (CompareTo)); // non-generic version
// Note that we don't want to use MethodSignatures for these
// because we don't want any weird overloads.
args2 [0] = full_name;
args2 [1] = full_name;
AddMethod (type.GetMethod ("op_Equality", "System.Boolean", args2));
AddMethod (type.GetMethod ("op_Inequality", "System.Boolean", args2));
AddMethod (type.GetMethod ("op_LessThan", "System.Boolean", args2));
AddMethod (type.GetMethod ("op_LessThanOrEqual", "System.Boolean", args2));
AddMethod (type.GetMethod ("op_GreaterThan", "System.Boolean", args2));
AddMethod (type.GetMethod ("op_GreaterThanOrEqual", "System.Boolean", args2));
clone.Method = type.GetMethod (MethodSignatures.Clone);
hash.Method = type.GetMethod (MethodSignatures.GetHashCode);
}
示例4: IsRule
private bool IsRule (TypeReference type)
{
var typeName = type.GetFullName ();
bool result;
if (!typeIsRule.TryGetValue (typeName, out result)) {
result = type.Implements ("Gendarme.Framework", "IRule");
typeIsRule [typeName] = result;
}
return result;
}
示例5: AppendPrettyTypeName
private static void AppendPrettyTypeName(StringBuilder sb, TypeReference type)
{
int nRemoveTrail;
IList<GenericParameter> gpc = type.GenericParameters;
int count = gpc.Count;
if (count == 0)
nRemoveTrail = 0;
else if (count < 10)
nRemoveTrail = 2;
else
nRemoveTrail = 3;
string fullname = type.GetFullName ();
sb.Append (fullname.Substring (0, fullname.Length - nRemoveTrail));
if (count > 0) {
int n = 0;
sb.Append ("<");
foreach (GenericParameter gp in gpc) {
if (n > 0)
sb.Append (",");
AppendPrettyTypeName (sb, gp);
n++;
}
sb.Append (">");
}
}
示例6: InheritFromWeakType
static string InheritFromWeakType (TypeReference type, string nameSpace, string name)
{
if (!type.Inherits (nameSpace, name))
return String.Empty;
return String.Format (CultureInfo.InvariantCulture, "'{0}' inherits from '{1}.{2}'.",
type.GetFullName (), nameSpace, name);
}