本文整理汇总了C#中TypeWrapper.GetGenericSignature方法的典型用法代码示例。如果您正苦于以下问题:C# TypeWrapper.GetGenericSignature方法的具体用法?C# TypeWrapper.GetGenericSignature怎么用?C# TypeWrapper.GetGenericSignature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeWrapper
的用法示例。
在下文中一共展示了TypeWrapper.GetGenericSignature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteClass
internal static void WriteClass(Stream stream, TypeWrapper tw, bool includeNonPublicInterfaces, bool includeNonPublicMembers, bool includeSerialVersionUID, bool includeParameterNames)
{
string name = tw.Name.Replace('.', '/');
string super = null;
if (tw.IsInterface)
{
super = "java/lang/Object";
}
else if (tw.BaseTypeWrapper != null)
{
super = tw.BaseTypeWrapper.Name.Replace('.', '/');
}
ClassFileWriter writer = new ClassFileWriter(tw.Modifiers, name, super, 0, includeParameterNames ? (ushort)52 : (ushort)49);
foreach (TypeWrapper iface in tw.Interfaces)
{
if (iface.IsPublic || includeNonPublicInterfaces)
{
writer.AddInterface(iface.Name.Replace('.', '/'));
}
}
InnerClassesAttribute innerClassesAttribute = null;
if (tw.DeclaringTypeWrapper != null)
{
TypeWrapper outer = tw.DeclaringTypeWrapper;
string innername = name;
int idx = name.LastIndexOf('$');
if (idx >= 0)
{
innername = innername.Substring(idx + 1);
}
innerClassesAttribute = new InnerClassesAttribute(writer);
innerClassesAttribute.Add(name, outer.Name.Replace('.', '/'), innername, (ushort)tw.ReflectiveModifiers);
}
foreach (TypeWrapper inner in tw.InnerClasses)
{
if (inner.IsPublic)
{
if (innerClassesAttribute == null)
{
innerClassesAttribute = new InnerClassesAttribute(writer);
}
string namePart = inner.Name;
namePart = namePart.Substring(namePart.LastIndexOf('$') + 1);
innerClassesAttribute.Add(inner.Name.Replace('.', '/'), name, namePart, (ushort)inner.ReflectiveModifiers);
}
}
if (innerClassesAttribute != null)
{
writer.AddAttribute(innerClassesAttribute);
}
string genericTypeSignature = tw.GetGenericSignature();
if (genericTypeSignature != null)
{
writer.AddStringAttribute("Signature", genericTypeSignature);
}
AddAnnotations(writer, writer, tw.TypeAsBaseType);
writer.AddStringAttribute("IKVM.NET.Assembly", GetAssemblyName(tw));
if (tw.TypeAsBaseType.IsDefined(JVM.Import(typeof(ObsoleteAttribute)), false))
{
writer.AddAttribute(new DeprecatedAttribute(writer));
}
foreach (MethodWrapper mw in tw.GetMethods())
{
if (!mw.IsHideFromReflection && (mw.IsPublic || mw.IsProtected || includeNonPublicMembers))
{
FieldOrMethod m;
if (mw.Name == "<init>")
{
m = writer.AddMethod(mw.Modifiers, mw.Name, mw.Signature.Replace('.', '/'));
CodeAttribute code = new CodeAttribute(writer);
code.MaxLocals = (ushort)(mw.GetParameters().Length * 2 + 1);
code.MaxStack = 3;
ushort index1 = writer.AddClass("java/lang/UnsatisfiedLinkError");
ushort index2 = writer.AddString("ikvmstub generated stubs can only be used on IKVM.NET");
ushort index3 = writer.AddMethodRef("java/lang/UnsatisfiedLinkError", "<init>", "(Ljava/lang/String;)V");
code.ByteCode = new byte[] {
187, (byte)(index1 >> 8), (byte)index1, // new java/lang/UnsatisfiedLinkError
89, // dup
19, (byte)(index2 >> 8), (byte)index2, // ldc_w "..."
183, (byte)(index3 >> 8), (byte)index3, // invokespecial java/lang/UnsatisfiedLinkError/init()V
191 // athrow
};
m.AddAttribute(code);
}
else
{
Modifiers mods = mw.Modifiers;
if ((mods & Modifiers.Abstract) == 0)
{
mods |= Modifiers.Native;
}
m = writer.AddMethod(mods, mw.Name, mw.Signature.Replace('.', '/'));
if (mw.IsOptionalAttributeAnnotationValue)
{
m.AddAttribute(new AnnotationDefaultClassFileAttribute(writer, GetAnnotationDefault(writer, mw.ReturnType)));
}
}
MethodBase mb = mw.GetMethod();
if (mb != null)
{
//.........这里部分代码省略.........