예제 #1
0
        /// <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");
        }
예제 #2
0
        /// <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}");
        }
예제 #3
0
        /// <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}")
                });