public static Type Unbox_Type(IntPtr val) { IntPtr cPtr = NoesisGUI_PINVOKE.Unbox_Type(val); if (cPtr != IntPtr.Zero) { Noesis.Extend.NativeTypeInfo info = Noesis.Extend.GetNativeTypeInfo(cPtr); return(info.Type); } return(null); }
private static Dictionary <Type, GetDelegate> CreateGetFunctions() { Dictionary <Type, GetDelegate> getFunctions = new Dictionary <Type, GetDelegate>(50); getFunctions[typeof(bool)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return(Noesis_DependencyGet_Bool(cPtr, dp, false, out isNull)); }; getFunctions[typeof(float)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return(Noesis_DependencyGet_Float(cPtr, dp, false, out isNull)); }; getFunctions[typeof(double)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return(Noesis_DependencyGet_Double(cPtr, dp, false, out isNull)); }; getFunctions[typeof(decimal)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return((decimal)Noesis_DependencyGet_Double(cPtr, dp, false, out isNull)); }; getFunctions[typeof(int)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return(Noesis_DependencyGet_Int(cPtr, dp, false, out isNull)); }; getFunctions[typeof(long)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return((long)Noesis_DependencyGet_Int(cPtr, dp, false, out isNull)); }; getFunctions[typeof(uint)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return(Noesis_DependencyGet_UInt(cPtr, dp, false, out isNull)); }; getFunctions[typeof(ulong)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return((ulong)Noesis_DependencyGet_UInt(cPtr, dp, false, out isNull)); }; getFunctions[typeof(char)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return((char)Noesis_DependencyGet_UInt(cPtr, dp, false, out isNull)); }; getFunctions[typeof(short)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return(Noesis_DependencyGet_Short(cPtr, dp, false, out isNull)); }; getFunctions[typeof(sbyte)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return((sbyte)Noesis_DependencyGet_Short(cPtr, dp, false, out isNull)); }; getFunctions[typeof(ushort)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return(Noesis_DependencyGet_UShort(cPtr, dp, false, out isNull)); }; getFunctions[typeof(byte)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; return((byte)Noesis_DependencyGet_UShort(cPtr, dp, false, out isNull)); }; getFunctions[typeof(string)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); IntPtr ptr = Noesis_DependencyGet_String(cPtr, dp); return(Noesis.Extend.StringFromNativeUtf8(ptr)); }; getFunctions[typeof(System.Uri)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); IntPtr ptr = Noesis_DependencyGet_Uri(cPtr, dp); string uri = Noesis.Extend.StringFromNativeUtf8(ptr); return(new Uri(uri, UriKind.Relative)); }; getFunctions[typeof(Noesis.Color)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Color(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.Color>(ptr)); }; getFunctions[typeof(Noesis.Point)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Point(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.Point>(ptr)); }; getFunctions[typeof(Noesis.Rect)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Rect(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.Rect>(ptr)); }; getFunctions[typeof(Noesis.Size)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Size(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.Size>(ptr)); }; getFunctions[typeof(Noesis.Thickness)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Thickness(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.Thickness>(ptr)); }; getFunctions[typeof(Noesis.CornerRadius)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_CornerRadius(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.CornerRadius>(ptr)); }; getFunctions[typeof(TimeSpan)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_TimeSpan(cPtr, dp, false, out isNull); return((TimeSpan)Marshal.PtrToStructure <Noesis.TimeSpanStruct>(ptr)); }; getFunctions[typeof(Noesis.Duration)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Duration(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.Duration>(ptr)); }; getFunctions[typeof(Noesis.KeyTime)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_KeyTime(cPtr, dp, false, out isNull); return(Marshal.PtrToStructure <Noesis.KeyTime>(ptr)); }; getFunctions[typeof(bool?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; bool val = Noesis_DependencyGet_Bool(cPtr, dp, true, out isNull); return(isNull ? null : (bool?)val); }; getFunctions[typeof(float?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; float val = Noesis_DependencyGet_Float(cPtr, dp, true, out isNull); return(isNull ? null : (float?)val); }; getFunctions[typeof(double?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; double val = Noesis_DependencyGet_Double(cPtr, dp, true, out isNull); return(isNull ? null : (double?)val); }; getFunctions[typeof(decimal?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; double val = Noesis_DependencyGet_Double(cPtr, dp, true, out isNull); return(isNull ? null : (decimal?)(decimal)val); }; getFunctions[typeof(int?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; int val = Noesis_DependencyGet_Int(cPtr, dp, true, out isNull); return(isNull ? null : (int?)val); }; getFunctions[typeof(long?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; int val = Noesis_DependencyGet_Int(cPtr, dp, true, out isNull); return(isNull ? null : (long?)(long)val); }; getFunctions[typeof(uint?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; uint val = Noesis_DependencyGet_UInt(cPtr, dp, true, out isNull); return(isNull ? null : (uint?)val); }; getFunctions[typeof(ulong?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; uint val = Noesis_DependencyGet_UInt(cPtr, dp, true, out isNull); return(isNull ? null : (ulong?)(ulong)val); }; getFunctions[typeof(char?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; uint val = Noesis_DependencyGet_UInt(cPtr, dp, true, out isNull); return(isNull ? null : (char?)(char)val); }; getFunctions[typeof(short?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; short val = Noesis_DependencyGet_Short(cPtr, dp, true, out isNull); return(isNull ? null : (short?)val); }; getFunctions[typeof(sbyte?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; short val = Noesis_DependencyGet_Short(cPtr, dp, true, out isNull); return(isNull ? null : (sbyte?)(sbyte)val); }; getFunctions[typeof(ushort?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; ushort val = Noesis_DependencyGet_UShort(cPtr, dp, true, out isNull); return(isNull ? null : (ushort?)val); }; getFunctions[typeof(byte?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; ushort val = Noesis_DependencyGet_UShort(cPtr, dp, true, out isNull); return(isNull ? null : (byte?)(byte)val); }; getFunctions[typeof(Noesis.Color?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Color(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.Color?)Marshal.PtrToStructure <Noesis.Color>(ptr)); }; getFunctions[typeof(Noesis.Point?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Point(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.Point?)Marshal.PtrToStructure <Noesis.Point>(ptr)); }; getFunctions[typeof(Noesis.Rect?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Rect(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.Rect?)Marshal.PtrToStructure <Noesis.Rect>(ptr)); }; getFunctions[typeof(Noesis.Size?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Size(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.Size?)Marshal.PtrToStructure <Noesis.Size>(ptr)); }; getFunctions[typeof(Noesis.Thickness?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Thickness(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.Thickness?)Marshal.PtrToStructure <Noesis.Thickness>(ptr)); }; getFunctions[typeof(Noesis.CornerRadius?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_CornerRadius(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.CornerRadius?)Marshal.PtrToStructure <Noesis.CornerRadius>(ptr)); }; getFunctions[typeof(TimeSpan?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_TimeSpan(cPtr, dp, true, out isNull); return(isNull ? null : (TimeSpan?)(TimeSpan)Marshal.PtrToStructure <Noesis.TimeSpanStruct>(ptr)); }; getFunctions[typeof(Noesis.Duration?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_Duration(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.Duration?)Marshal.PtrToStructure <Noesis.Duration>(ptr)); }; getFunctions[typeof(Noesis.KeyTime?)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); bool isNull; IntPtr ptr = Noesis_DependencyGet_KeyTime(cPtr, dp, true, out isNull); return(isNull ? null : (Noesis.KeyTime?)Marshal.PtrToStructure <Noesis.KeyTime>(ptr)); }; getFunctions[typeof(Type)] = (cPtr, dp) => { CheckProperty(cPtr, dp, "get"); IntPtr ptr = Noesis_DependencyGet_Type(cPtr, dp); if (ptr != IntPtr.Zero) { Noesis.Extend.NativeTypeInfo info = Noesis.Extend.GetNativeTypeInfo(cPtr); return(info.Type); } return(null); }; return(getFunctions); }