Example #1
0
        /// <summary>
        /// Enumerates the property set format identifiers (FMTID) of the storage.
        /// </summary>
        /// <returns>A list of guids.</returns>
        public IEnumerable <Guid> EnumerateFormats()
        {
            var guid = typeof(IPropertySetStorage).GUID;
            var mode = GetMode(IsReadOnly);

            var hr = StgOpenStorageEx(FilePath, mode, STGFMT.STGFMT_ANY, 0, IntPtr.Zero, IntPtr.Zero, ref guid, out var propertySetStorage);

            if (hr == STG_E_FILENOTFOUND || hr == STG_E_PATHNOTFOUND)
            {
                throw new FileNotFoundException(null, FilePath);
            }

            if (hr != 0)
            {
                throw new Win32Exception((int)hr);
            }

            try
            {
                propertySetStorage.Enum(out var es);
                if (es != null)
                {
                    try
                    {
                        var stg = new STATPROPSETSTG();
                        int fetched;
                        do
                        {
                            hr = es.Next(1, ref stg, out fetched);
                            if (hr != 0 && hr != 1)
                            {
                                throw new Win32Exception((int)hr);
                            }

                            if (fetched == 1)
                            {
                                if (stg.fmtid == Guid.Empty)
                                {
                                    continue;
                                }

                                yield return(stg.fmtid);
                            }
                        }while (fetched == 1);
                    }
                    finally
                    {
                        Marshal.ReleaseComObject(es);
                    }
                }
            }
            finally
            {
                if (propertySetStorage != null)
                {
                    Marshal.ReleaseComObject(propertySetStorage);
                }
            }
        }
Example #2
0
 void IPropertyStorage.Stat(
     out STATPROPSETSTG pstatpsstg
     )
 {
     _unsafePropertyStorage.Stat(
         out pstatpsstg
         );
 }
Example #3
0
            void IPropertyStorage.Stat(
                out STATPROPSETSTG pstatpsstg
                )
            {
                SecurityHelper.DemandCompoundFileIOPermission();

                _unsafePropertyStorage.Stat(
                    out pstatpsstg
                    );
            }
Example #4
0
 IEnumSTATPROPSETSTG.Next(
     UInt32 celt,
     STATPROPSETSTG rgelt,
     out UInt32 pceltFetched
     )
 {
     return(_unsafeEnumSTATPROPSETSTG.Next(
                celt,
                rgelt,
                out pceltFetched
                ));
 }
Example #5
0
            IEnumSTATPROPSETSTG.Next(
                UInt32 celt,
                STATPROPSETSTG rgelt,
                out UInt32 pceltFetched
                )
            {
                SecurityHelper.DemandCompoundFileIOPermission();

                return(_unsafeEnumSTATPROPSETSTG.Next(
                           celt,
                           rgelt,
                           out pceltFetched
                           ));
            }
Example #6
0
            IEnumSTATPROPSETSTG.Next(
                UInt32 celt,
                STATPROPSETSTG rgelt,
                out UInt32 pceltFetched
                )
            {
                SecurityHelper.DemandCompoundFileIOPermission();

                return _unsafeEnumSTATPROPSETSTG.Next(
                    celt,
                    rgelt,
                    out pceltFetched
                    );
            }
Example #7
0
            void IPropertyStorage.Stat(
                out STATPROPSETSTG pstatpsstg
                )
            {
                SecurityHelper.DemandCompoundFileIOPermission();

                _unsafePropertyStorage.Stat(
                    out pstatpsstg
                    );
            }
 internal VersionInformationPropertySet(STATPROPSETSTG stat, Property[] properties)
     : base(stat, properties)
 {
 }
 internal MechanicalModelingPropertySet(STATPROPSETSTG stat, Property[] properties)
     : base(stat, properties)
 {
 }
 internal ExtendedSummaryInformationPropertySet(STATPROPSETSTG stat, Property[] properties)
     : base(stat, properties)
 {
 }
 internal SolidEdgePropertySet(STATPROPSETSTG stat, Property[] properties)
     : base(stat, properties)
 {
 }