internal string GetDisplayText(ref PropVariant propVariant, PropertyDescriptionFormatFlags formatFlags) { var result = String.Empty; if (this.PropertyDescriptionNative != null) { var flags = (PROPDESC_FORMAT_FLAGS)formatFlags; var hr = this.PropertyDescriptionNative.FormatForDisplay(ref propVariant, ref flags, out result); if (HRESULT.Failed(hr)) { result = String.Empty; } } return(result); }
/// <summary> /// Gets the text for displaying the property value. /// </summary> /// <param name="formatFlags">Format flags.</param> /// <returns></returns> public string GetDisplayText(PropertyDescriptionFormatFlags formatFlags) { using (var store = ShellPropertyStore.Create(this.ShellObject)) { var propVar = default(PropVariant); try { store.GetPropVariant(this.PropertyKey, out propVar); return(this.Description.GetDisplayText(ref propVar, formatFlags)); } finally { propVar.Clear(); } } }
internal bool TryGetDisplayText(ref PropVariant propVariant, PropertyDescriptionFormatFlags formatFlags, out string result) { if (this.PropertyDescriptionNative == null) { result = null; return(false); } var flags = (PROPDESC_FORMAT_FLAGS)formatFlags; var hr = this.PropertyDescriptionNative.FormatForDisplay(ref propVariant, ref flags, out result); if (HRESULT.Failed(hr)) { result = null; return(false); } return(true); }
public bool TryGetDisplayText(PropertyDescriptionFormatFlags formatFlags, out string text) { using (var store = ShellPropertyStore.Create(this.ShellObject)) { var propVar = default(PropVariant); try { store.GetPropVariant(this.PropertyKey, out propVar); if (!this.Description.TryGetDisplayText(ref propVar, formatFlags, out text)) { text = String.Empty; return(false); } return(true); } finally { propVar.Clear(); } } }