private static void CallBaseTypeFinalizer(MethodDefinition finalizer, CppCodeWriter writer, IRuntimeMetadataAccess metadataAccess) { MethodReference method = null; TypeDefinition definition; Unity.IL2CPP.ILPreProcessor.TypeResolver resolver; for (TypeReference reference2 = finalizer.DeclaringType.BaseType; reference2 != null; reference2 = resolver.Resolve(definition.BaseType)) { definition = reference2.Resolve(); resolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(reference2); foreach (MethodDefinition definition2 in definition.Methods) { if (definition2.IsFinalizerMethod()) { method = resolver.Resolve(definition2); break; } } } if (method != null) { List <string> argumentArray = new List <string>(2) { Naming.ThisParameterName }; if (MethodSignatureWriter.NeedsHiddenMethodInfo(method, MethodCallType.Normal, false)) { argumentArray.Add(metadataAccess.HiddenMethodInfo(method)); } Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolverForMethodToCall = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(finalizer.DeclaringType); string block = MethodBodyWriter.GetMethodCallExpression(finalizer, typeResolverForMethodToCall.Resolve(method), method, typeResolverForMethodToCall, MethodCallType.Normal, metadataAccess, new VTableBuilder(), argumentArray, false, null); writer.WriteStatement(block); } }
internal static bool MethodSignaturesMatchIgnoreStaticness(MethodReference candidate, MethodReference method) { if (candidate.Parameters.Count != method.Parameters.Count) { return(false); } if (candidate.GenericParameters.Count != method.GenericParameters.Count) { return(false); } Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(candidate.DeclaringType as GenericInstanceType, candidate as GenericInstanceMethod); Unity.IL2CPP.ILPreProcessor.TypeResolver resolver2 = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveReturnType(candidate), resolver2.ResolveReturnType(method), TypeComparisonMode.SignatureOnly)) { return(false); } for (int i = 0; i < candidate.Parameters.Count; i++) { if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveParameterType(candidate, candidate.Parameters[i]), resolver2.ResolveParameterType(method, method.Parameters[i]), TypeComparisonMode.SignatureOnly)) { return(false); } } return(true); }
internal static bool MethodSignaturesMatchIgnoreStaticness(MethodReference candidate, MethodReference method) { if (candidate.Parameters.Count != method.Parameters.Count) { return false; } if (candidate.GenericParameters.Count != method.GenericParameters.Count) { return false; } Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(candidate.DeclaringType as GenericInstanceType, candidate as GenericInstanceMethod); Unity.IL2CPP.ILPreProcessor.TypeResolver resolver2 = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveReturnType(candidate), resolver2.ResolveReturnType(method), TypeComparisonMode.SignatureOnly)) { return false; } for (int i = 0; i < candidate.Parameters.Count; i++) { if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveParameterType(candidate, candidate.Parameters[i]), resolver2.ResolveParameterType(method, method.Parameters[i]), TypeComparisonMode.SignatureOnly)) { return false; } } return true; }
public int GetIndex(MethodReference method) { int num3; if (method.HasGenericParameters || method.DeclaringType.HasGenericParameters) { return(-1); } if (GenericSharingAnalysis.CanShareMethod(method)) { method = GenericSharingAnalysis.GetSharedMethod(method); } Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); TypeReference[] key = new TypeReference[method.Parameters.Count + 1]; key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method)); for (int i = 0; i < method.Parameters.Count; i++) { key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i])); } if (!this._runtimeInvokerData.TryGetValue(key, out num3)) { return(-1); } return(num3); }
protected InteropMethodBodyWriter(MethodReference interopMethod, MethodReference methodForParameterNames, InteropMarshaler marshaler) { this._typeResolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(interopMethod.DeclaringType, interopMethod); this._interopMethod = interopMethod; this._marshaler = marshaler; MethodDefinition definition = this._interopMethod.Resolve(); this._parameters = new MarshaledParameter[definition.Parameters.Count]; for (int i = 0; i < definition.Parameters.Count; i++) { ParameterDefinition definition2 = definition.Parameters[i]; TypeReference parameterType = this._typeResolver.Resolve(definition2.ParameterType); this._parameters[i] = new MarshaledParameter(methodForParameterNames.Parameters[i].Name, Naming.ForParameterName(methodForParameterNames.Parameters[i]), parameterType, definition2.MarshalInfo, definition2.IsIn, definition2.IsOut); } List<MarshaledType> list = new List<MarshaledType>(); foreach (MarshaledParameter parameter in this._parameters) { foreach (MarshaledType type in this.MarshalInfoWriterFor(parameter).MarshaledTypes) { list.Add(new MarshaledType(type.Name, type.DecoratedName, parameter.NameInGeneratedCode + type.VariableName)); } } MarshaledType[] marshaledTypes = this.MarshalInfoWriterFor(this.GetMethodReturnType()).MarshaledTypes; for (int j = 0; j < (marshaledTypes.Length - 1); j++) { MarshaledType type2 = marshaledTypes[j]; list.Add(new MarshaledType(type2.Name + "*", type2.DecoratedName + "*", Naming.ForComInterfaceReturnParameterName() + type2.VariableName)); } this._marshaledParameterTypes = list.ToArray(); this._marshaledReturnType = marshaledTypes[marshaledTypes.Length - 1]; }
protected InteropMethodBodyWriter(MethodReference interopMethod, MethodReference methodForParameterNames, InteropMarshaler marshaler) { this._typeResolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(interopMethod.DeclaringType, interopMethod); this._interopMethod = interopMethod; this._marshaler = marshaler; MethodDefinition definition = this._interopMethod.Resolve(); this._parameters = new MarshaledParameter[definition.Parameters.Count]; for (int i = 0; i < definition.Parameters.Count; i++) { ParameterDefinition definition2 = definition.Parameters[i]; TypeReference parameterType = this._typeResolver.Resolve(definition2.ParameterType); this._parameters[i] = new MarshaledParameter(methodForParameterNames.Parameters[i].Name, Naming.ForParameterName(methodForParameterNames.Parameters[i]), parameterType, definition2.MarshalInfo, definition2.IsIn, definition2.IsOut); } List <MarshaledType> list = new List <MarshaledType>(); foreach (MarshaledParameter parameter in this._parameters) { foreach (MarshaledType type in this.MarshalInfoWriterFor(parameter).MarshaledTypes) { list.Add(new MarshaledType(type.Name, type.DecoratedName, parameter.NameInGeneratedCode + type.VariableName)); } } MarshaledType[] marshaledTypes = this.MarshalInfoWriterFor(this.GetMethodReturnType()).MarshaledTypes; for (int j = 0; j < (marshaledTypes.Length - 1); j++) { MarshaledType type2 = marshaledTypes[j]; list.Add(new MarshaledType(type2.Name + "*", type2.DecoratedName + "*", Naming.ForComInterfaceReturnParameterName() + type2.VariableName)); } this._marshaledParameterTypes = list.ToArray(); this._marshaledReturnType = marshaledTypes[marshaledTypes.Length - 1]; }
public static string GetSharedMethodSignatureRaw(MethodReference method) { TypeReference variableType = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod).Resolve(Unity.IL2CPP.GenericParameterResolver.ResolveReturnTypeIfNeeded(method)); string attributes = BuildMethodAttributes(method); return(GetMethodSignature(Naming.ForMethodNameOnly(method) + "_gshared", Naming.ForVariable(variableType), FormatParameters(method, ParameterFormat.WithTypeAndName, false, true), "extern \"C\"", attributes)); }
internal static string GetMethodSignature(CppCodeWriter writer, MethodReference method) { Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); RecordIncludes(writer, method, typeResolver); string attributes = BuildMethodAttributes(method); return(GetMethodSignature(Naming.ForMethodNameOnly(method), Naming.ForVariable(typeResolver.Resolve(Unity.IL2CPP.GenericParameterResolver.ResolveReturnTypeIfNeeded(method))), FormatParameters(method, ParameterFormat.WithTypeAndName, false, true), "extern \"C\"", attributes)); }
public WindowsRuntimeDelegateMarshalInfoWriter(TypeReference type) : base(type) { TypeDefinition definition = type.Resolve(); if (!Extensions.IsDelegate(definition)) { throw new ArgumentException(string.Format("WindowsRuntimeDelegateMarshalInfoWriter cannot marshal non-delegate type {0}.", type.FullName)); } this._typeResolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(type); if (<>f__am$cache0 == null) {
private StackStateBuilder(MethodDefinition methodDefinition, StackState initialState, Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver) { this._methodDefinition = methodDefinition; this._typeResolver = typeResolver; this._simulationStack = new Stack <Entry>(); foreach (Entry entry in initialState.Entries.Reverse <Entry>()) { this._simulationStack.Push(entry.Clone()); } }
public WindowsRuntimeDelegateMarshalInfoWriter(TypeReference type) : base(type) { TypeDefinition definition = type.Resolve(); if (!definition.IsDelegate()) { throw new ArgumentException($"WindowsRuntimeDelegateMarshalInfoWriter cannot marshal non-delegate type {type.FullName}."); } this._typeResolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(type); if (< > f__am$cache0 == null) {
public DefaultRuntimeMetadataAccess(MethodReference methodReference, MetadataUsage metadataUsage, MethodUsage methodUsage) { this._metadataUsage = metadataUsage; this._methodUsage = methodUsage; if (methodReference != null) { this._typeResolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(methodReference.DeclaringType as GenericInstanceType, methodReference as GenericInstanceMethod); } else { this._typeResolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(); } }
private static TypeReference[] MethodToSignature(MethodReference method) { if (GenericSharingAnalysis.CanShareMethod(method)) { method = GenericSharingAnalysis.GetSharedMethod(method); } Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); TypeReference[] referenceArray = new TypeReference[method.Parameters.Count + 1]; referenceArray[0] = TypeFor(resolver.ResolveReturnType(method)); for (int i = 0; i < method.Parameters.Count; i++) { referenceArray[i + 1] = TypeFor(resolver.ResolveParameterType(method, method.Parameters[i])); } return(referenceArray); }
private void WriteForwardDeclarations(TypeReference type) { Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(type); MarshalType marshalType = !type.Resolve().IsWindowsRuntime ? MarshalType.COM : MarshalType.WindowsRuntime; foreach (MethodDefinition definition in type.Resolve().Methods) { foreach (ParameterDefinition definition2 in definition.Parameters) { MarshalDataCollector.MarshalInfoWriterFor(resolver.Resolve(definition2.ParameterType), marshalType, definition2.MarshalInfo, true, false, false, null).WriteMarshaledTypeForwardDeclaration(this._writer); } if (definition.ReturnType.MetadataType != MetadataType.Void) { MarshalDataCollector.MarshalInfoWriterFor(resolver.Resolve(definition.ReturnType), marshalType, definition.MethodReturnType.MarshalInfo, true, false, false, null).WriteMarshaledTypeForwardDeclaration(this._writer); } } }
public void AddIncludesForMethodDeclaration(GenericInstanceMethod method) { Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method); this.AddIncludeForType(method.DeclaringType); if (method.ReturnType.MetadataType != MetadataType.Void) { this.AddIncludesForTypeReference(resolver.ResolveReturnType(method), false); } foreach (ParameterDefinition definition in method.Parameters) { this.AddIncludesForTypeReference(resolver.ResolveParameterType(method, definition), false); } if (GenericSharingAnalysis.CanShareMethod(method) && !GenericSharingAnalysis.IsSharedMethod(method)) { this.AddIncludesForMethodDeclaration((GenericInstanceMethod)GenericSharingAnalysis.GetSharedMethod(method)); } this.AddGenericInstanceMethod(method); }
public string Add(MethodReference method) { if (GenericSharingAnalysis.CanShareMethod(method)) { method = GenericSharingAnalysis.GetSharedMethod(method); } Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); TypeReference[] key = new TypeReference[method.Parameters.Count + 1]; key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method)); for (int i = 0; i < method.Parameters.Count; i++) { key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i])); } if (!this._runtimeInvokerData.ContainsKey(key)) { this._runtimeInvokerData.Add(key, this._runtimeInvokerData.Count); } return(NameForInvoker(key)); }
public string Add(MethodReference method) { if (GenericSharingAnalysis.CanShareMethod(method)) { method = GenericSharingAnalysis.GetSharedMethod(method); } Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); TypeReference[] key = new TypeReference[method.Parameters.Count + 1]; key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method)); for (int i = 0; i < method.Parameters.Count; i++) { key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i])); } if (!this._runtimeInvokerData.ContainsKey(key)) { this._runtimeInvokerData.Add(key, this._runtimeInvokerData.Count); } return NameForInvoker(key); }
public void WriteComInterfaceFor(TypeReference type) { this._writer.WriteCommentedLine(type.FullName); this.WriteForwardDeclarations(type); string str = !type.Resolve().IsWindowsRuntime ? "Il2CppIUnknown" : "Il2CppIInspectable"; object[] args = new object[] { Naming.ForTypeNameOnly(type), str }; this._writer.WriteLine("struct NOVTABLE {0} : {1}", args); using (new BlockWriter(this._writer, true)) { this._writer.WriteStatement("static const Il2CppGuid IID"); Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(type); foreach (MethodDefinition definition in type.Resolve().Methods) { MethodReference method = typeResolver.Resolve(definition); this._writer.Write(GetSignature(method, method, typeResolver, null)); this._writer.WriteLine(" = 0;"); } } }
private void CollectIncludes(CppCodeWriter writer, TypeReference type, TypeDefinition typeDefinition) { if (!type.HasGenericParameters) { if (type is ArrayType) { writer.AddIncludeForTypeDefinition(TypeProvider.Corlib.MainModule.GetType("System.Array")); } else { Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(type as GenericInstanceType); TypeReference typeReference = resolver.Resolve(typeDefinition.BaseType); if (typeReference != null) { writer.AddIncludeForTypeDefinition(typeReference); } foreach (FieldDefinition definition in typeDefinition.Fields) { writer.AddIncludesForTypeReference(resolver.Resolve(definition.FieldType), false); } foreach (FieldDefinition definition2 in typeDefinition.Fields) { PointerType fieldType = definition2.FieldType as PointerType; if (fieldType != null) { writer.AddForwardDeclaration(resolver.Resolve(fieldType.ElementType)); } } foreach (TypeReference reference2 in type.GetAllFactoryTypes()) { writer.AddForwardDeclaration(reference2); } if (typeDefinition.IsDelegate()) { MethodDefinition[] definitionArray; if (!typeDefinition.IsWindowsRuntime) { MethodDefinition[] definitionArray1 = new MethodDefinition[3]; if (< > f__am$cache2 == null) {
public int GetIndex(MethodReference method) { int num3; if (method.HasGenericParameters || method.DeclaringType.HasGenericParameters) { return -1; } if (GenericSharingAnalysis.CanShareMethod(method)) { method = GenericSharingAnalysis.GetSharedMethod(method); } Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); TypeReference[] key = new TypeReference[method.Parameters.Count + 1]; key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method)); for (int i = 0; i < method.Parameters.Count; i++) { key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i])); } if (!this._runtimeInvokerData.TryGetValue(key, out num3)) { return -1; } return num3; }
public NativeToManagedMarshaler(Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver, MarshalType marshalType, bool useUnicodeCharset) : base(typeResolver, marshalType, useUnicodeCharset) { }
public SharedRuntimeMetadataAccess(MethodReference methodReference, DefaultRuntimeMetadataAccess defaultRuntimeMetadataAccess) { this._methodReference = methodReference; this._typeResolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(methodReference.DeclaringType as GenericInstanceType, methodReference as GenericInstanceMethod); this._default = defaultRuntimeMetadataAccess; }
public InteropMarshaler(Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver, MarshalType marshalType, bool useUnicodeCharset) { this._typeResolver = typeResolver; this._marshalType = marshalType; this._useUnicodeCharset = useUnicodeCharset; }
private StackAnalysis(MethodDefinition methodDefinition, ControlFlowGraph cfg, Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver) { this._methodDefinition = methodDefinition; this._cfg = cfg; this._typeResolver = typeResolver; }
public static Unity.IL2CPP.StackAnalysis.StackAnalysis Analyze(MethodDefinition methodDefinition, ControlFlowGraph cfg, Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver) { Unity.IL2CPP.StackAnalysis.StackAnalysis analysis = new Unity.IL2CPP.StackAnalysis.StackAnalysis(methodDefinition, cfg, typeResolver); analysis.Analyze(); return(analysis); }
private void WriteMainInvocation(CppCodeWriter writer, IRuntimeMetadataAccess metadataAccess) { if (this.ValidateMainMethod(writer)) { writer.AddIncludeForMethodDeclarations(_entryPoint.DeclaringType); List <string> argumentArray = new List <string> { Naming.Null }; if (_entryPoint.Parameters.Count > 0) { ArrayType parameterType = (ArrayType)_entryPoint.Parameters[0].ParameterType; writer.AddIncludeForTypeDefinition(parameterType); object[] args = new object[] { Naming.ForVariable(parameterType), Emit.NewSZArray(parameterType, "argc - 1", metadataAccess) }; writer.WriteLine("{0} args = {1};", args); writer.WriteLine(); writer.WriteLine("for (int i = 1; i < argc; i++)"); using (new BlockWriter(writer, false)) { writer.WriteLine("DECLARE_NATIVE_C_STRING_AS_STRING_VIEW_OF_IL2CPP_CHARS(argumentUtf16, argv[i]);"); object[] objArray2 = new object[] { Naming.ForVariable(TypeProvider.SystemString) }; writer.WriteLine("{0} argument = il2cpp_codegen_string_new_utf16(argumentUtf16);", objArray2); writer.WriteStatement(Emit.StoreArrayElement("args", "i - 1", "argument", false)); } writer.WriteLine(); argumentArray.Add("args"); } if (MethodSignatureWriter.NeedsHiddenMethodInfo(_entryPoint, MethodCallType.Normal, false)) { argumentArray.Add(metadataAccess.HiddenMethodInfo(_entryPoint)); } if ((_entryPoint.DeclaringType.Attributes & (TypeAttributes.AnsiClass | TypeAttributes.BeforeFieldInit)) == TypeAttributes.AnsiClass) { object[] objArray3 = new object[] { metadataAccess.TypeInfoFor(_entryPoint.DeclaringType) }; writer.WriteLine("IL2CPP_RUNTIME_CLASS_INIT({0});", objArray3); } Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolverForMethodToCall = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(_entryPoint.DeclaringType, _entryPoint); string block = MethodBodyWriter.GetMethodCallExpression(null, _entryPoint, _entryPoint, typeResolverForMethodToCall, MethodCallType.Normal, metadataAccess, new VTableBuilder(), argumentArray, false, null); switch (_entryPoint.ReturnType.MetadataType) { case MetadataType.Void: writer.WriteStatement(block); writer.WriteLine("return 0;"); break; case MetadataType.Int32: { object[] objArray4 = new object[] { block }; writer.WriteLine("return {0};", objArray4); break; } case MetadataType.UInt32: { object[] objArray5 = new object[] { block }; writer.WriteLine("uint32_t exitCode = {0};", objArray5); writer.WriteLine("return static_cast<int>(exitCode);"); break; } } } }
public static string GetMethodPointer(MethodReference method, ParameterFormat parameterFormat) { Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod); return(GetMethodSignature("(*)", Naming.ForVariable(resolver.ResolveReturnType(method)), FormatParameters(method, parameterFormat, false, true), string.Empty, "")); }
public static string GetSignature(MethodReference method, MethodReference interfaceMethod, Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver, string typeName = null) { StringBuilder builder = new StringBuilder(); MarshalType marshalType = !interfaceMethod.DeclaringType.Resolve().IsWindowsRuntime ? MarshalType.COM : MarshalType.WindowsRuntime; if (string.IsNullOrEmpty(typeName)) { builder.Append("virtual il2cpp_hresult_t STDCALL "); } else { builder.Append("il2cpp_hresult_t "); builder.Append(typeName); builder.Append("::"); } builder.Append(Naming.ForMethodNameOnly(interfaceMethod)); builder.Append('('); builder.Append(BuildMethodParameterList(method, interfaceMethod, typeResolver, marshalType, true)); builder.Append(')'); return(builder.ToString()); }
internal static string BuildMethodParameterList(MethodReference interopMethod, MethodReference interfaceMethod, Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver, MarshalType marshalType, bool includeTypeNames) { List <string> elements = new List <string>(); int num = 0; foreach (ParameterDefinition definition in interopMethod.Parameters) { MarshalInfo marshalInfo = interfaceMethod.Parameters[num].MarshalInfo; DefaultMarshalInfoWriter writer = MarshalDataCollector.MarshalInfoWriterFor(typeResolver.Resolve(definition.ParameterType), marshalType, marshalInfo, true, false, false, null); foreach (MarshaledType type in writer.MarshaledTypes) { elements.Add(string.Format(!includeTypeNames ? "{1}" : "{0} {1}", type.DecoratedName, Naming.ForParameterName(definition) + type.VariableName)); } num++; } TypeReference reference2 = typeResolver.Resolve(interopMethod.ReturnType); if (reference2.MetadataType != MetadataType.Void) { MarshalInfo info2 = interfaceMethod.MethodReturnType.MarshalInfo; MarshaledType[] marshaledTypes = MarshalDataCollector.MarshalInfoWriterFor(reference2, marshalType, info2, true, false, false, null).MarshaledTypes; for (int i = 0; i < (marshaledTypes.Length - 1); i++) { elements.Add(string.Format(!includeTypeNames ? "{1}" : "{0}* {1}", marshaledTypes[i].DecoratedName, Naming.ForComInterfaceReturnParameterName() + marshaledTypes[i].VariableName)); } elements.Add(string.Format(!includeTypeNames ? "{1}" : "{0}* {1}", marshaledTypes[marshaledTypes.Length - 1].DecoratedName, Naming.ForComInterfaceReturnParameterName())); } return(elements.AggregateWithComma()); }