当前位置: 首页>>代码示例>>C#>>正文


C# IKVM类代码示例

本文整理汇总了C#中IKVM的典型用法代码示例。如果您正苦于以下问题:C# IKVM类的具体用法?C# IKVM怎么用?C# IKVM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IKVM类属于命名空间,在下文中一共展示了IKVM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Write

		internal void Write(IKVM.Reflection.Writer.MetadataWriter mw)
		{
			mw.Write(Cb);
			mw.Write(MajorRuntimeVersion);
			mw.Write(MinorRuntimeVersion);
			MetaData.Write(mw);
			mw.Write(Flags);
			mw.Write(EntryPointToken);
			Resources.Write(mw);
			StrongNameSignature.Write(mw);
			CodeManagerTable.Write(mw);
			VTableFixups.Write(mw);
			ExportAddressTableJumps.Write(mw);
			ManagedNativeHeader.Write(mw);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:CliHeader.cs

示例2: helperDoLoad

        public static bool helperDoLoad(
        IKVM.Reflection.Type typ,
        IKVM.Reflection.ConstructorInfo ikSymtabCtor)
        {
            // note (1): ikSymtabAttr stands here for loaders.clrTypes.SCALA_SYMTAB_ATTR
              //           ie. the result of getTypeSafe("scala.runtime.SymtabAttribute")
              // note (2): ikSymtabCtor stands here for loaders.clrTypes.SYMTAB_CONSTR
              //           ie. the result of ikSymtabAttr.GetConstructor(Array(UBYTE.MakeArrayType()))

              IKVM.Reflection.Type ikSymtabAttr = ikSymtabCtor.DeclaringType;
              IList<IKVM.Reflection.CustomAttributeData> cads = typ.__GetCustomAttributes(null, false); // this prevents ReadFixedArg from being called
              foreach(IKVM.Reflection.CustomAttributeData cad in cads) {
            if (cad.Constructor.DeclaringType == ikSymtabAttr) {
              bool res = (cad.Constructor == ikSymtabCtor);
              return res;
            }
              }
              return true; // always load non-scala types
        }
开发者ID:hoanguyen81190,项目名称:scaladotnet,代码行数:19,代码来源:SymtabAttribute.cs

示例3: Write

		internal void Write(IKVM.Reflection.Writer.MetadataWriter mw)
		{
			mw.Write(Cb);
			mw.Write(MajorRuntimeVersion);
			mw.Write(MinorRuntimeVersion);
			mw.Write(MetaDataRVA);
			mw.Write(MetaDataSize);
			mw.Write(Flags);
			mw.Write(EntryPointToken);
			mw.Write(ResourcesRVA);
			mw.Write(ResourcesSize);
			mw.Write(StrongNameSignatureRVA);
			mw.Write(StrongNameSignatureSize);
			mw.Write(CodeManagerTable);
			mw.Write(VTableFixupsRVA);
			mw.Write(VTableFixupsSize);
			mw.Write(ExportAddressTableJumps);
			mw.Write(ManagedNativeHeader);
		}
开发者ID:koush,项目名称:mono,代码行数:19,代码来源:CliHeader.cs

示例4: _universe_AssemblyResolve

 Assembly _universe_AssemblyResolve(object sender, IKVM.Reflection.ResolveEventArgs args) {
     AssemblyName name = new AssemblyName(args.Name);
     AssemblyName previousMatch = null;
     int previousMatchLevel = 0;
     foreach (Assembly asm in _universe.GetAssemblies()) {
         if (Match(asm.GetName(), name, ref previousMatch, ref previousMatchLevel)) {
             return asm;
         }
     }
     foreach (string file in FindAssemblyPath(name.Name + ".dll")) {
         if (Match(AssemblyName.GetAssemblyName(file), name, ref previousMatch, ref previousMatchLevel)) {
             return LoadFile(file);
         }
     }
     if (args.RequestingAssembly != null) {
         string path = Path.Combine(Path.GetDirectoryName(args.RequestingAssembly.Location), name.Name + ".dll");
         if (File.Exists(path) && Match(AssemblyName.GetAssemblyName(path), name, ref previousMatch, ref previousMatchLevel)) {
             return LoadFile(path);
         }
     }
     string hintpath;
     if (_hintpaths.TryGetValue(name.FullName, out hintpath)) {
         string path = Path.Combine(hintpath, name.Name + ".dll");
         if (File.Exists(path) && Match(AssemblyName.GetAssemblyName(path), name, ref previousMatch, ref previousMatchLevel)) {
             return LoadFile(path);
         }
     }
     if (previousMatch != null) {
         if (previousMatchLevel == 2) {
             ConsoleOps.Warning("assuming assembly reference '{0}' matches '{1}', you may need to supply runtime policy", previousMatch.FullName, name.FullName);
             return LoadFile(new Uri(previousMatch.CodeBase).LocalPath);
         } else if (args.RequestingAssembly != null) {
             ConsoleOps.Error(true, "Assembly '{0}' uses '{1}' which has a higher version than referenced assembly '{2}'", args.RequestingAssembly.FullName, name.FullName, previousMatch.FullName);
         } else {
             ConsoleOps.Error(true, "Assembly '{0}' was requested which is a higher version than referenced assembly '{1}'", name.FullName, previousMatch.FullName);
         }
     } else {
         ConsoleOps.Error(true, "unable to find assembly '{0}' {1}", args.Name, args.RequestingAssembly != null ? string.Format("    (a dependency of '{0}')", args.RequestingAssembly.FullName) : string.Empty);
     }
     return null;
 }
开发者ID:paweljasinski,项目名称:ironpython3,代码行数:41,代码来源:AssemblyResolver.cs

示例5: helperGetPickle

 public static byte[] helperGetPickle(
 IKVM.Reflection.Type typ, 
 IKVM.Reflection.ConstructorInfo ikSymtabCtor)
 {
     // note: ikSymtabCtor stands here for loaders.clrTypes.SYMTAB_CONSTR
       // ie. the result of getTypeSafe("scala.runtime.SymtabAttribute").GetConstructor(Array(UBYTE.MakeArrayType()))
       IList<IKVM.Reflection.CustomAttributeData> cads = typ.__GetCustomAttributes(null, false);  // this prevents ReadFixedArg from being called
       foreach(IKVM.Reflection.CustomAttributeData cad in cads) {
     if (cad.Constructor == ikSymtabCtor) {
       byte[] blob = cad.__GetBlob();
       // blob starts with
       //   prolog 01 00
       //   length LL LH HL HH
       // where
       //   int pos = 2;
       //   int length = ((int) blob[pos++] | (int) blob[pos++] << 8 | (int) blob[pos++] << 16 | (int) blob[pos++] << 24);
       // and then comes the real data starting with blob[6] inclusive. That's why we give 6 as offset to unpickle.
       //   byte[] dest = new byte[length];
       //   Array.Copy(blob, 6, dest, 0, length);
       return blob;
     }
       }
       return null;
 }
开发者ID:hoanguyen81190,项目名称:scaladotnet,代码行数:24,代码来源:SymtabAttribute.cs

示例6: SetupGhosts

		private void SetupGhosts(IKVM.Internal.MapXml.Root map)
		{
			ghosts = new Dictionary<string, List<TypeWrapper>>();

			// find the ghost interfaces
			foreach(IKVM.Internal.MapXml.Class c in map.assembly.Classes)
			{
				if(c.Shadows != null && c.Interfaces != null)
				{
					// NOTE we don't support interfaces that inherit from other interfaces
					// (actually, if they are explicitly listed it would probably work)
					TypeWrapper typeWrapper = GetLoadedClass(c.Name);
					foreach(IKVM.Internal.MapXml.Interface iface in c.Interfaces)
					{
						TypeWrapper ifaceWrapper = GetLoadedClass(iface.Name);
						if(ifaceWrapper == null || !ifaceWrapper.TypeAsTBD.IsAssignableFrom(typeWrapper.TypeAsTBD))
						{
							AddGhost(iface.Name, typeWrapper);
						}
					}
				}
			}
			// we manually add the array ghost interfaces
			TypeWrapper array = ClassLoaderWrapper.GetWrapperFromType(Types.Array);
			AddGhost("java.io.Serializable", array);
			AddGhost("java.lang.Cloneable", array);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:27,代码来源:CompilerClassLoader.cs

示例7: ValidateAndSetMap

		private bool ValidateAndSetMap(IKVM.Internal.MapXml.Root map)
		{
			bool valid = true;
			if (map.assembly != null)
			{
				if (map.assembly.Classes != null)
				{
					foreach (IKVM.Internal.MapXml.Class c in map.assembly.Classes)
					{
						if (c.Fields != null)
						{
							foreach (IKVM.Internal.MapXml.Field f in c.Fields)
							{
								ValidateNameSig("field", c.Name, f.Name, f.Sig, ref valid, true);
							}
						}
						if (c.Methods != null)
						{
							foreach (IKVM.Internal.MapXml.Method m in c.Methods)
							{
								ValidateNameSig("method", c.Name, m.Name, m.Sig, ref valid, false);
							}
						}
						if (c.Constructors != null)
						{
							foreach (IKVM.Internal.MapXml.Constructor ctor in c.Constructors)
							{
								ValidateNameSig("constructor", c.Name, "<init>", ctor.Sig, ref valid, false);
							}
						}
						if (c.Properties != null)
						{
							foreach (IKVM.Internal.MapXml.Property prop in c.Properties)
							{
								ValidateNameSig("property", c.Name, prop.Name, prop.Sig, ref valid, false);
								ValidatePropertyGetterSetter("getter", c.Name, prop.Name, prop.getter, ref valid);
								ValidatePropertyGetterSetter("setter", c.Name, prop.Name, prop.setter, ref valid);
							}
						}
					}
				}
			}
			this.map = map;
			return valid;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:45,代码来源:CompilerClassLoader.cs

示例8: AddMapXmlMethods

		private void AddMapXmlMethods(string className, IKVM.Internal.MapXml.MethodBase[] methods)
		{
			if(methods != null)
			{
				foreach(IKVM.Internal.MapXml.MethodBase method in methods)
				{
					AddMapXmlMethod(className, method);
				}
			}
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:10,代码来源:CompilerClassLoader.cs

示例9: AddMapXmlMethod

		private void AddMapXmlMethod(string className, IKVM.Internal.MapXml.MethodBase method)
		{
			if(method.body != null)
			{
				mapxml_MethodBodies.Add(method.ToMethodKey(className), method.body);
			}
			if(method.ReplaceMethodCalls != null)
			{
				mapxml_ReplacedMethods.Add(method.ToMethodKey(className), method.ReplaceMethodCalls);
			}
			if (method.prologue != null)
			{
				mapxml_MethodPrologues.Add(method.ToMethodKey(className), method.prologue);
			}
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:CompilerClassLoader.cs

示例10: LoadInterfaces

			internal void LoadInterfaces(IKVM.Internal.MapXml.Class c)
			{
				if (c.Interfaces != null)
				{
					interfaceWrappers = new TypeWrapper[c.Interfaces.Length];
					for (int i = 0; i < c.Interfaces.Length; i++)
					{
						interfaceWrappers[i] = classLoader.LoadClassByDottedName(c.Interfaces[i].Name);
					}
				}
				else
				{
					interfaceWrappers = TypeWrapper.EmptyArray;
				}
			}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:CompilerClassLoader.cs

示例11: Write

		internal void Write(IKVM.Reflection.Writer.MetadataWriter mw)
		{
			mw.Write(VirtualAddress);
			mw.Write(Size);
		}
开发者ID:nestalk,项目名称:mono,代码行数:5,代码来源:PEReader.cs

示例12: AddDeclaredExceptions

		internal static void AddDeclaredExceptions(MethodBase mb, IKVM.Internal.MapXml.Throws[] throws)
		{
			if (throws != null)
			{
				string[] exceptions = new string[throws.Length];
				for (int i = 0; i < exceptions.Length; i++)
				{
					exceptions[i] = throws[i].Class;
				}
				AttributeHelper.SetThrowsAttribute(mb, exceptions);
			}
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:12,代码来源:CompilerClassLoader.cs

示例13: GetBaseWrapper

			private static TypeWrapper GetBaseWrapper(IKVM.Internal.MapXml.Class c)
			{
				if((c.Modifiers & IKVM.Internal.MapXml.MapModifiers.Interface) != 0)
				{
					return null;
				}
				if(c.Name == "java.lang.Object")
				{
					return null;
				}
				return CoreClasses.java.lang.Object.Wrapper;
			}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:12,代码来源:CompilerClassLoader.cs

示例14: SetParameters

			private static void SetParameters(ClassLoaderWrapper loader, ConstructorBuilder cb, IKVM.Internal.MapXml.Param[] parameters)
			{
				if(parameters != null)
				{
					for(int i = 0; i < parameters.Length; i++)
					{
						ParameterBuilder pb = cb.DefineParameter(i + 1, ParameterAttributes.None, parameters[i].Name);
						if(parameters[i].Attributes != null)
						{
							for(int j = 0; j < parameters[i].Attributes.Length; j++)
							{
								AttributeHelper.SetCustomAttribute(loader, pb, parameters[i].Attributes[j]);
							}
						}
					}
				}
			}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:17,代码来源:CompilerClassLoader.cs

示例15: Process2ndPassStep2

			internal void Process2ndPassStep2(IKVM.Internal.MapXml.Root map)
			{
				IKVM.Internal.MapXml.Class c = classDef;
				TypeBuilder tb = typeBuilder;

				List<FieldWrapper> fields = new List<FieldWrapper>();

				// TODO fields should be moved to the RemapperTypeWrapper constructor as well
				if(c.Fields != null)
				{
					foreach(IKVM.Internal.MapXml.Field f in c.Fields)
					{
						{
							FieldAttributes attr = MapFieldAccessModifiers(f.Modifiers);
							if(f.Constant != null)
							{
								attr |= FieldAttributes.Literal;
							}
							else if((f.Modifiers & IKVM.Internal.MapXml.MapModifiers.Final) != 0)
							{
								attr |= FieldAttributes.InitOnly;
							}
							if((f.Modifiers & IKVM.Internal.MapXml.MapModifiers.Static) != 0)
							{
								attr |= FieldAttributes.Static;
							}
							FieldBuilder fb = tb.DefineField(f.Name, GetClassLoader().FieldTypeWrapperFromSig(f.Sig).TypeAsSignatureType, attr);
							if(f.Attributes != null)
							{
								foreach(IKVM.Internal.MapXml.Attribute custattr in f.Attributes)
								{
									AttributeHelper.SetCustomAttribute(classLoader, fb, custattr);
								}
							}
							object constant;
							if(f.Constant != null)
							{
								switch(f.Sig[0])
								{
									case 'J':
										constant = long.Parse(f.Constant);
										break;
									default:
										// TODO support other types
										throw new NotImplementedException("remapped constant field of type: " + f.Sig);
								}
								fb.SetConstant(constant);
								fields.Add(new ConstantFieldWrapper(this, GetClassLoader().FieldTypeWrapperFromSig(f.Sig), f.Name, f.Sig, (Modifiers)f.Modifiers, fb, constant, MemberFlags.None));
							}
							else
							{
								fields.Add(FieldWrapper.Create(this, GetClassLoader().FieldTypeWrapperFromSig(f.Sig), fb, f.Name, f.Sig, new ExModifiers((Modifiers)f.Modifiers, false)));
							}
						}
					}
				}
				SetFields(fields.ToArray());
			}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:58,代码来源:CompilerClassLoader.cs


注:本文中的IKVM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。