/// <summary> /// Map a GType to the name of the C# type we use to represent it. /// </summary> /// <param name="gtype">The GType to map.</param> /// <returns>The C# type we use to represent it.</returns> private string GTypeToCSharp(IntPtr gtype) { if (_gTypeToCSharpDict.ContainsKey(gtype)) { return(_gTypeToCSharpDict[gtype]); } var fundamental = NetVips.FundamentalType(gtype); if (_gTypeToCSharpDict.ContainsKey(fundamental)) { return(_gTypeToCSharpDict[fundamental]); } return("object"); }
/// <summary> /// Map a GType to the name of the C# type we use to represent it. /// </summary> /// <param name="name">The GType identifier.</param> /// <param name="gtype">The GType to map.</param> /// <returns>The C# type we use to represent it.</returns> private string GTypeToCSharp(string name, IntPtr gtype) { if (_gTypeToCSharpDict.ContainsKey(gtype)) { return(_gTypeToCSharpDict[gtype]); } var fundamental = NetVips.FundamentalType(gtype); if (_gTypeToCSharpDict.ContainsKey(fundamental)) { return(_gTypeToCSharpDict[fundamental]); } throw new Exception($"Unsupported type: {gtype} name: {name}"); }
/// <summary> /// Map a GType to the name of the C# type we use to represent it. /// </summary> /// <param name="name">The GType identifier.</param> /// <param name="gtype">The GType to map.</param> /// <returns>The C# type we use to represent it.</returns> private string GTypeToCSharp(string name, IntPtr gtype) { if (_gTypeToCSharpDict.ContainsKey(gtype)) { return(_gTypeToCSharpDict[gtype]); } var fundamental = NetVips.FundamentalType(gtype); if (_gTypeToCSharpDict.ContainsKey(fundamental)) { return(_gTypeToCSharpDict[fundamental]); } if (fundamental == GValue.GFlagsType) { return(name switch { "flags" => "Enums.ForeignFlags", "filter" => "Enums.ForeignPngFilter", _ => throw new Exception($"Unsupported type: {gtype} name: {name}") });