internal static STATPROPSETSTG GetStatistics(this IPropertyStorage propertyStorage) { STATPROPSETSTG statpropsetstg = default(STATPROPSETSTG); propertyStorage.Stat(out statpropsetstg); return(statpropsetstg); }
internal PropertySet(STATPROPSETSTG stat, Property[] properties) { if (properties == null) { throw new ArgumentNullException("properties"); } _stat = stat; _properties.AddRange(properties); }
internal static PropertySet InvokeInternalConstructor(Type type, STATPROPSETSTG stat, Property[] properties) { Type[] types = new[] { typeof(STATPROPSETSTG), typeof(Property[]) }; ConstructorInfo ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, types, null); if (ctor != null) { return((PropertySet)ctor.Invoke(new object[] { stat, properties })); } else { throw new System.Reflection.TargetException(String.Format("Unable for find appropriate constructor for type '{0}'", type.FullName)); } }
internal SummaryInformationPropertySet(STATPROPSETSTG stat, Property[] properties) : base(stat, properties) { }
internal CustomPropertySet(STATPROPSETSTG stat, Property[] properties) : base(stat, properties) { }
private void LoadPropertySets() { HRESULT hr = (int)HRESULT.E_FAIL; IEnumSTATPROPSETSTG enumerator = null; STATPROPSETSTG[] stat = new STATPROPSETSTG[1]; uint fetched = 0; List <Guid> fmtids = new List <Guid>(); // Build list of FMTID's. try { if (NativeMethods.Succeeded(hr = _propertySetStorage.Enum(out enumerator))) { while (NativeMethods.Succeeded(hr = (enumerator.Next(1, stat, out fetched))) && (fetched == 1)) { fmtids.Add(stat[0].fmtid); } // IPropertySetStorage.Enum() does not enumerate FMTID_UserDefinedProperties. // Note that FMTID_UserDefinedProperties may not exist. fmtids.Add(FormatId.UserDefinedProperties); } foreach (Guid fmtid in fmtids) { Guid rfmtid = fmtid; uint grfMode = (uint)(STGM.READ | STGM.SHARE_EXCLUSIVE); //uint grfMode = (uint)(STGM.DIRECT | STGM.READ | STGM.SHARE_DENY_WRITE); IPropertyStorage propertyStorage = null; try { if (NativeMethods.Succeeded(hr = _propertySetStorage.Open(ref rfmtid, grfMode, out propertyStorage))) { _propertySets.Add(PropertySet.FromIPropertyStorage(propertyStorage)); } } catch { #if DEBUG System.Diagnostics.Debugger.Break(); #endif } finally { if (propertyStorage != null) { propertyStorage.FinalRelease(); } } } } catch { } finally { if (enumerator != null) { enumerator.FinalRelease(); } } }