本文整理汇总了C#中IKVM.Reflection.Assembly类的典型用法代码示例。如果您正苦于以下问题:C# Assembly类的具体用法?C# Assembly怎么用?C# Assembly使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Assembly类属于IKVM.Reflection命名空间,在下文中一共展示了Assembly类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public static void Init(string baseCorlibDir)
{
if (baseCorlibDir == null)
baseCorlibDir = typeof(int).Assembly.Location;
mscorlib = universe.LoadFile(baseCorlibDir);
if (mscorlib == null)
{
Report.Error($"Could not load mscorlib from {baseCorlibDir}");
}
AttributeType = mscorlib.GetType("System.Attribute");
VoidType = mscorlib.GetType("System.Void");
IntPtrType = mscorlib.GetType("System.IntPtr");
UIntPtrType = mscorlib.GetType("System.UIntPtr");
StringType = mscorlib.GetType("System.String");
ObjectType = mscorlib.GetType("System.Object");
TypeType = mscorlib.GetType("System.Type");
MethodInfoType = mscorlib.GetType("System.Reflection.MethodInfo");
FieldInfoType = mscorlib.GetType("System.Reflection.FieldInfo");
PropertyInfoType = mscorlib.GetType("System.Reflection.PropertyInfo");
AssemblyType = mscorlib.GetType("System.Reflection.Assembly");
ModuleType = mscorlib.GetType("System.Reflection.Module");
}
示例2: __GetDeclarativeSecurity
public static IList<CustomAttributeData> __GetDeclarativeSecurity(Assembly assembly)
{
return assembly.ManifestModule.GetDeclarativeSecurity(0x20000001);
}
示例3: MissingModule
internal MissingModule(Assembly assembly, int index)
: base(assembly.universe)
{
this.assembly = assembly;
this.index = index;
}
示例4: IsSigned
private static bool IsSigned(Assembly asm)
{
byte[] key = asm.GetName().GetPublicKey();
return key != null && key.Length != 0;
}
示例5: __ResolveReferencedAssemblies
public virtual void __ResolveReferencedAssemblies(Assembly[] assemblies)
{
throw new NotSupportedException();
}
示例6: __GetCustomAttributes
public static IList<CustomAttributeData> __GetCustomAttributes(Assembly assembly, Type attributeType, bool inherit)
{
return assembly.GetCustomAttributesData(attributeType);
}
示例7: CustomAttributeData
// 5) Unresolved declarative security
internal CustomAttributeData(Assembly asm, ConstructorInfo constructor, int securityAction, byte[] blob, int index)
{
this.module = asm.ManifestModule;
this.customAttributeIndex = -1;
this.declSecurityIndex = index;
Universe u = constructor.Module.universe;
this.lazyConstructor = constructor;
List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>();
list.Add(new CustomAttributeTypedArgument(u.System_Security_Permissions_SecurityAction, securityAction));
this.lazyConstructorArguments = list.AsReadOnly();
this.declSecurityBlob = blob;
}
示例8: RenameAssembly
internal void RenameAssembly(Assembly assembly, AssemblyName oldName)
{
List<string> remove = new List<string>();
foreach (KeyValuePair<string, Assembly> kv in assembliesByName)
{
if (kv.Value == assembly)
{
remove.Add(kv.Key);
}
}
foreach (string key in remove)
{
assembliesByName.Remove(key);
}
}
示例9: GetType
// note that context is slightly different from the calling assembly (System.Type.GetType),
// because context is passed to the AssemblyResolve event as the RequestingAssembly
public Type GetType(Assembly context, string assemblyQualifiedTypeName, bool throwOnError)
{
TypeNameParser parser = TypeNameParser.Parse(assemblyQualifiedTypeName, throwOnError);
if (parser.Error)
{
return null;
}
return parser.GetType(this, context, throwOnError, assemblyQualifiedTypeName);
}
示例10: Load
internal Assembly Load(string refname, Assembly requestingAssembly, bool throwOnError)
{
Assembly asm = GetLoadedAssembly(refname);
if (asm != null)
{
return asm;
}
if (resolvers.Count == 0)
{
asm = DefaultResolver(refname, throwOnError);
}
else
{
ResolveEventArgs args = new ResolveEventArgs(refname, requestingAssembly);
foreach (ResolveEventHandler evt in resolvers)
{
asm = evt(this, args);
if (asm != null)
{
break;
}
}
}
if (asm != null)
{
string defname = asm.FullName;
if (refname != defname)
{
assembliesByName.Add(refname, asm);
}
return asm;
}
if (throwOnError)
{
throw new FileNotFoundException(refname);
}
return null;
}
示例11: ResolveEventArgs
public ResolveEventArgs(string name, Assembly requestingAssembly)
{
this.name = name;
this.requestingAssembly = requestingAssembly;
}
示例12: 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();
//.........这里部分代码省略.........
示例13: ReadDeclarativeSecurity
internal static void ReadDeclarativeSecurity(Assembly asm, List<CustomAttributeData> list, int action, ByteReader br)
{
Universe u = asm.universe;
if (br.PeekByte() == '.')
{
br.ReadByte();
int count = br.ReadCompressedInt();
for (int j = 0; j < count; j++)
{
Type type = ReadType(asm, br);
ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
// LAMESPEC there is an additional length here (probably of the named argument list)
byte[] blob = br.ReadBytes(br.ReadCompressedInt());
list.Add(new CustomAttributeData(asm, constructor, action, blob));
}
}
else
{
// .NET 1.x format (xml)
char[] buf = new char[br.Length / 2];
for (int i = 0; i < buf.Length; i++)
{
buf[i] = br.ReadChar();
}
string xml = new String(buf);
ConstructorInfo constructor = u.System_Security_Permissions_PermissionSetAttribute.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
List<CustomAttributeNamedArgument> args = new List<CustomAttributeNamedArgument>();
args.Add(new CustomAttributeNamedArgument(GetProperty(u.System_Security_Permissions_PermissionSetAttribute, "XML", u.System_String),
new CustomAttributeTypedArgument(u.System_String, xml)));
list.Add(new CustomAttributeData(asm.ManifestModule, constructor, new object[] { action }, args));
}
}
示例14: GetAssemblyReference
IAssemblyReference GetAssemblyReference(Assembly scope)
{
if (scope == null || scope == currentAssemblyDefinition)
return DefaultAssemblyReference.CurrentAssembly;
return interningProvider.Intern (new DefaultAssemblyReference (scope.FullName));
}
示例15: AssemblyLocationProvider
public AssemblyLocationProvider (Assembly assembly, MonoSymbolFile symbolFile, string seqPointDataPath)
{
this.assembly = assembly;
this.symbolFile = symbolFile;
this.seqPointDataPath = seqPointDataPath;
}