本文整理汇总了C#中IKVM.Reflection.Assembly.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# Assembly.GetName方法的具体用法?C# Assembly.GetName怎么用?C# Assembly.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Reflection.Assembly
的用法示例。
在下文中一共展示了Assembly.GetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAttributes
void AddAttributes(Assembly assembly, IList<IUnresolvedAttribute> outputList)
{
AddCustomAttributes(assembly.CustomAttributes, outputList);
AddSecurityAttributes(CustomAttributeData.__GetDeclarativeSecurity (assembly), outputList);
// AssemblyVersionAttribute
if (assembly.GetName ().Version != null) {
var assemblyVersion = new DefaultUnresolvedAttribute(assemblyVersionAttributeTypeRef, new[] { KnownTypeReference.String });
assemblyVersion.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.String, assembly.GetName ().Version.ToString()));
outputList.Add(interningProvider.Intern(assemblyVersion));
}
}
示例2: IsSigned
private static bool IsSigned(Assembly asm)
{
byte[] key = asm.GetName().GetPublicKey();
return key != null && key.Length != 0;
}
示例3: Process
static void Process(Assembly asm)
{
currentAssembly = asm;
string shortName = asm.GetName().Name;
string name = shortName.Replace(".", "_");
var typeList = new List<IKVM.Reflection.Type>();
headerWriter.WriteLine("/*");
headerWriter.WriteLine(" * Automatically generated by thunktool from {0}", shortName);
headerWriter.WriteLine(" */");
headerWriter.WriteLine();
headerWriter.WriteLine("#ifndef __{0}_THUNKTOOL__", name.ToUpperInvariant());
headerWriter.WriteLine("#define __{0}_THUNKTOOL__", name.ToUpperInvariant());
headerWriter.WriteLine();
headerWriter.WriteLine("#include <mono/utils/mono-publib.h>");
headerWriter.WriteLine("#include <mono/metadata/assembly.h>");
headerWriter.WriteLine("#include <mono/metadata/class.h>");
headerWriter.WriteLine("#include <mono/metadata/object.h>");
headerWriter.WriteLine();
headerWriter.WriteLine("MONO_BEGIN_DECLS");
headerWriter.WriteLine();
headerWriter.WriteLine("#ifdef WIN32");
headerWriter.WriteLine("#define THUNKCALL __stdcall");
headerWriter.WriteLine("#else");
headerWriter.WriteLine("#define THUNKCALL");
headerWriter.WriteLine("#endif");
headerWriter.WriteLine();
sourceWriter.WriteLine("/*");
sourceWriter.WriteLine(" * Automatically generated by thunktool from {0}", shortName);
sourceWriter.WriteLine(" */");
sourceWriter.WriteLine();
sourceWriter.WriteLine("#include <stdlib.h>");
sourceWriter.WriteLine("#include <string.h>");
sourceWriter.WriteLine("#include <assert.h>");
sourceWriter.WriteLine("#include <mono/jit/jit.h>");
sourceWriter.WriteLine("#include <mono/metadata/reflection.h>");
sourceWriter.WriteLine("#include \"{0}.h\"", outputPrefix ?? "thunks");
sourceWriter.WriteLine();
foreach (var typeInfo in asm.GetTypes ())
{
currentMethods = new List<ThunkMethodInfo>();
foreach (var ctor in typeInfo.GetConstructors ())
Process(ctor);
foreach (var method in typeInfo.GetMethods ())
Process(method);
foreach (var prop in typeInfo.GetProperties ())
Process(prop);
if (currentMethods.Count == 0)
continue;
headerWriter.WriteLine("MonoClass *{0}__Class;", typeInfo.Name);
foreach (var m in currentMethods) {
headerWriter.WriteLine();
if (wantComments)
headerWriter.WriteLine("/*\n * {0}\n */", m.Comments);
if (!m.IsGeneric)
headerWriter.WriteLine("{0}", m.QualMethodDecl);
else
headerWriter.WriteLine("MonoMethod *{0}__Method;", m.QualMethodName);
}
headerWriter.WriteLine();
sourceWriter.WriteLine("static void\n{0}_Init (MonoClass *klass)", typeInfo.Name);
sourceWriter.WriteLine("{");
sourceWriter.WriteLine("\tMonoMethod *method;\n");
sourceWriter.WriteLine("\tassert (klass && \"could not lookup class '{0}'\");", typeInfo.FullName);
sourceWriter.WriteLine("\t{0}__Class = klass;", typeInfo.Name);
foreach (var m in currentMethods)
{
sourceWriter.WriteLine();
sourceWriter.WriteLine("\tmethod = mono_class_get_method_from_name (klass, \"{0}\", -1);", m.ClrMethodName);
sourceWriter.WriteLine("\tassert (method && \"could not lookup method '{0}.{1}'\");", typeInfo.FullName, m.ClrMethodName);
if (!m.IsGeneric)
sourceWriter.WriteLine("\t{0} = mono_method_get_unmanaged_thunk (method);", m.QualMethodName);
else
sourceWriter.WriteLine("\t{0}__Method = method;", m.QualMethodName);
}
sourceWriter.WriteLine("}\n");
typeList.Add(typeInfo);
}
if (typeList.Count > 0)
{
headerWriter.WriteLine("MonoAssembly *{0}_Assembly;", name);
headerWriter.WriteLine("MonoImage *{0}_Image;", name);
headerWriter.WriteLine();
headerWriter.WriteLine("void\n{0}_Init (MonoAssembly *assembly);", name);
headerWriter.WriteLine();
//.........这里部分代码省略.........