本文整理汇总了C#中Method.ToSignatureString方法的典型用法代码示例。如果您正苦于以下问题:C# Method.ToSignatureString方法的具体用法?C# Method.ToSignatureString怎么用?C# Method.ToSignatureString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method.ToSignatureString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitMethod
protected override void EmitMethod (Method method)
{
if (method.IsSynthetic)
return;
if (method.IsOverride && !method.IsConstructor && !method.Abstract && !method.Static)
{
Type parent = method.Type.ParentType;
string sig = method.ToSignatureString();
while (parent != null)
{
if (myJniTypes.ContainsKey(parent.Name) && parent.Methods.Dictionary.ContainsKey(sig))
{
var jniType = myJniTypes[parent.Name];
// see if the method exists to override
try
{
if (jniType.GetMethod(method.Name) == null)
return;
}
catch (AmbiguousMatchException)
{
}
}
parent = parent.ParentType;
}
}
//if (method.PropertyType != null && method.Name.StartsWith("set"))
// return;
string methodId = null;
if (!method.Type.IsInterface)
{
string signature = GetMethodSignature(method);
if (method.Name.LastIndexOf('.') == -1)
methodId = method.Name;
else
methodId = method.Name.Substring(method.Name.LastIndexOf('.') + 1);
string methodIdLookup = methodId;
methodId = string.Format("_{0}{1}", methodId.Replace("@",""), myMemberCounter++);
string initJni = string.Format("global::{0}.{1} = @__env.Get{4}MethodIDNoThrow(global::{0}.staticClass, \"{2}\", \"{3}\");", method.Type.Name, methodId, method.IsConstructor ? "<init>" : methodIdLookup, signature, method.Static ? "Static" : string.Empty);
myInitJni.Add(initJni);
WriteLine("internal static global::MonoJavaBridge.MethodId {0};", methodId);
//WriteLine("[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]");
Write(method.Scope);
if (method.Abstract)
Write("abstract");
else
{
if (method.Static)
{
Write("static");
}
else if (!method.IsConstructor)
{
if (method.IsOverride)
{
if (method.IsSealed)
Write("sealed");
Write("override");
}
else if (!method.Type.IsSealed && method.Scope != string.Empty)
Write("virtual");
}
//Write("extern");
}
}
// TODO: Reflect on the jni4net type, and see if the method exists or not.
// This is a hack to prevent some compiler warnings.
if (method.IsNew && (method.Name != "clone" || !myJniTypes.ContainsKey(method.Type.Parent)))
Write("new");
if (method.Return != null)
Write("{0}{1}", ObjectModel.IsSystemType(method.Return) ? string.Empty : "global::", method.Return);
Write(method.Name, false);
Write("(", false);
//WriteDelimited(method.Parameters, (v, i) => string.Format("{0} arg{1}", v == "java.lang.CharSequence" && !method.Name.Contains('.') ? "string" : v, i), ",");
WriteDelimited(method.Parameters, (v, i) => string.Format("{0} arg{1}", v, i), ",");
if (method.Type.IsInterface || method.Abstract || method.Scope == "internal")
{
WriteLine(");");
}
else
{
Write(")");
if (method.IsConstructor)
Write(" : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)");
WriteLine();
WriteLine("{");
myIndent++;
// TODO: Remove this if statement when array returns are properly supported
WriteLine("global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;");
var statement = GetMethodStatement(method);
StringBuilder parBuilder = new StringBuilder();
if (method.Static || method.IsConstructor)
parBuilder.AppendFormat("{0}.staticClass, ", method.Type.Name);
else
parBuilder.Append("this.JvmHandle, ");
//.........这里部分代码省略.........