diff --git a/Source/Bind/CSharpSpecWriter.cs b/Source/Bind/CSharpSpecWriter.cs index 437c1fbd..daf82092 100644 --- a/Source/Bind/CSharpSpecWriter.cs +++ b/Source/Bind/CSharpSpecWriter.cs @@ -694,110 +694,6 @@ namespace Bind array_levels[type.Array]); } - string GetInvocationString(Delegate d, bool respect_wrappers) - { - StringBuilder sb = new StringBuilder(); - - if (d.ReturnType.CurrentType == "void") - { - sb.AppendFormat("InteropHelper.Call"); - } - else - { - sb.Append("InteropHelper.CallReturn<"); - sb.Append(d.ReturnType.CurrentType != "String" ? d.ReturnType.CurrentType : "IntPtr"); - if (d.Parameters.Count > 0) - { - var parameters = String.Join( - ", ", - d.Parameters.Select(p => p.IndirectionLevel != 0 ? "IntPtr" : p.CurrentType).ToArray()); - sb.Append(", "); - sb.Append(parameters); - } - sb.Append(">"); - } - - sb.Append("("); - var parameter_string = GetInvocationString(d.Parameters, respect_wrappers); - if (!String.IsNullOrEmpty(parameter_string)) - { - sb.Append(parameter_string); - sb.Append(", "); - } - sb.AppendFormat("EntryPoints[{0}]", d.Slot); - sb.Append(")"); - - return sb.ToString(); - } - - string GetInvocationString(ParameterCollection parameters, bool respect_wrappers) - { - StringBuilder sb = new StringBuilder(); - - if (parameters.Count > 0) - { - foreach (Parameter p in parameters) - { - if (p.Unchecked) - sb.Append("unchecked((" + p.QualifiedType + ")"); - - if (!p.Generic && p.CurrentType != "object") - { - if (p.CurrentType.ToLower().Contains("string")) - { - sb.Append(String.Format("({0}{1})", - p.QualifiedType, (p.Array > 0) ? "[]" : "")); - } - else if (p.IndirectionLevel != 0) - { - sb.Append("(IntPtr)"); - } - else - { - sb.Append(String.Format("({0})", p.QualifiedType)); - } - } - - - if (respect_wrappers) - { - switch (p.WrapperType) - { - case WrapperTypes.GenericParameter: - sb.Append(p.Name); - if (p.Generic) - { - sb.Append("_ptr"); - } - break; - - case WrapperTypes.ArrayParameter: - case WrapperTypes.ReferenceParameter: - sb.Append(p.Name); - sb.Append("_ptr"); - break; - - default: - sb.Append(p.Name); - break; - } - } - else - { - sb.Append(p.Name); - } - - if (p.Unchecked) - sb.Append(")"); - - sb.Append(", "); - } - sb.Replace(", ", "", sb.Length - 2, 2); - } - - return sb.ToString(); - } - #endregion } }