Esempio n. 1
0
        public static bool TrySetMetadataByName(this IWICMetadataQueryWriter meta, string name, PropVariant value)
        {
            var pvMarshal = new PropVariant.Marshaler();
            var pvNative  = pvMarshal.MarshalManagedToNative(value);
            int hr        = ProxyFunctions.SetMetadataByName(meta, name, pvNative);

            pvMarshal.CleanUpNativeData(pvNative);

            return(hr >= 0);
        }
Esempio n. 2
0
        public static bool TryGetMetadataByName(this IWICMetadataQueryReader meta, string name, out PropVariant value)
        {
            value = null;

            int hr = ProxyFunctions.GetMetadataByName(meta, name, IntPtr.Zero);

            if (hr >= 0)
            {
                value = new PropVariant();

                var pvMarshal = new PropVariant.Marshaler();
                var pvNative  = pvMarshal.MarshalManagedToNative(value);
                hr = ProxyFunctions.GetMetadataByName(meta, name, pvNative);
                pvMarshal.MarshalNativeToManaged(pvNative);
                pvMarshal.CleanUpNativeData(pvNative);
            }

            return(hr >= 0);
        }