예제 #1
0
        static PropertyKey s_pkDateEncoded = new PropertyKey("2e4b640d-5019-46d8-8881-55414cc5caa0", 100); // System.Media.DateEncoded
#endif

        /// <summary>
        /// Open the property store for a file.
        /// </summary>
        /// <param name="filename">Path or filename of file on which to open the property store.</param>
        /// <param name="writeAccess">True if write access is desired. Defaults to false.</param>
        /// <returns>A <see cref="PropertyStore"/> instance.</returns>
        public static PropertyStore Open(string filename, bool writeAccess = false)
        {
            PropertyStoreInterop.IPropertyStore store;
            Guid iPropertyStoreGuid = typeof(PropertyStoreInterop.IPropertyStore).GUID;

            PropertyStoreInterop.SHGetPropertyStoreFromParsingName(filename, IntPtr.Zero,
                                                                   writeAccess ? PropertyStoreInterop.GETPROPERTYSTOREFLAGS.GPS_READWRITE : PropertyStoreInterop.GETPROPERTYSTOREFLAGS.GPS_BESTEFFORT,
                                                                   ref iPropertyStoreGuid, out store);
            return(new PropertyStore(store));
        }
예제 #2
0
        /// <summary>
        /// Constructs an instance of the PropertySytem object. PropertySystem has no
        /// state so one instance can be shared across the whole application if that is
        /// convenient.
        /// </summary>
        /// <remarks>
        /// PropertySystem should be disposed before going out of scope in order to free
        /// associated system resources.
        /// </remarks>
        public PropertySystem()
        {
            Guid IID_IPropertySystem = typeof(PropertyStoreInterop.IPropertySystem).GUID;

            PropertyStoreInterop.PSGetPropertySystem(ref IID_IPropertySystem, out m_IPropertySystem);
        }