public Signature(string name, string signature, string connector, string managedParameters, string outerType, string superCall) { ManagedParameters = managedParameters; JniSignature = signature; Method = "n_" + name + ":" + signature + ":" + connector; Name = name; var jnisig = signature; int closer = jnisig.IndexOf(")"); string ret = jnisig.Substring(closer + 1); retval = JavaNativeTypeManager.Parse(ret).Type; string jniparms = jnisig.Substring(1, closer - 1); if (string.IsNullOrEmpty(jniparms) && string.IsNullOrEmpty(superCall)) { return; } var parms = new StringBuilder(); var scall = new StringBuilder(); var acall = new StringBuilder(); bool first = true; int i = 0; foreach (JniTypeName jti in JavaNativeTypeManager.FromSignature(jniparms)) { if (outerType != null) { acall.Append(outerType).Append(".this"); outerType = null; continue; } string parmType = jti.Type; if (!first) { parms.Append(", "); scall.Append(", "); acall.Append(", "); } first = false; parms.Append(parmType).Append(" p").Append(i); scall.Append("p").Append(i); acall.Append("p").Append(i); ++i; } this.parms = parms.ToString(); this.call = superCall != null ? superCall : scall.ToString(); this.ActivateCall = acall.ToString(); }
internal static ExportAttribute ToExportAttribute(CustomAttribute attr, IMemberDefinition declaringMember) { var name = attr.ConstructorArguments.Count > 0 ? (string)attr.ConstructorArguments [0].Value : declaringMember.Name; if (attr.Properties.Count == 0) { return(new ExportAttribute(name)); } var typeArgs = (CustomAttributeArgument [])attr.Properties.FirstOrDefault(p => p.Name == "Throws").Argument.Value; var thrown = typeArgs != null && typeArgs.Any() ? (from caa in typeArgs select JavaNativeTypeManager.Parse(GetJniTypeName((TypeReference)caa.Value)).Type).ToArray() : null; var superArgs = (string)attr.Properties.FirstOrDefault(p => p.Name == "SuperArgumentsString").Argument.Value; return(new ExportAttribute(name) { ThrownNames = thrown, SuperArgumentsString = superArgs }); }