/// <summary> /// Checks extended attribute existence. /// </summary> /// <param name="info"><see cref="FileSystemInfo"/> instance.</param> /// <param name="attribName">Attribute name.</param> /// <returns>True if attribute exist, false otherwise.</returns> public static async Task <bool> HasExtendedAttributeAsync(this FileSystemInfo info, string attribName) { if (info == null) { throw new ArgumentNullException("info"); } if (string.IsNullOrEmpty(attribName)) { throw new ArgumentNullException("attribName"); } return(await extendedAttribute.GetExtendedAttributeAsync(info.FullName, attribName) != null); }
/// <summary> /// Gets extended attribute or null if attribute or file not found. /// </summary> /// <typeparam name="T">The value will be automatically deserialized to the type specified by this type-parameter.</typeparam> /// <param name="info"><see cref="FileSystemInfo"/> instance.</param> /// <param name="attribName">Attribute name.</param> /// <returns>Attribute value.</returns> public static async Task <T> GetExtendedAttributeAsync <T>(this FileSystemInfo info, string attribName) where T : new() { if (info == null) { throw new ArgumentNullException("info"); } if (string.IsNullOrEmpty(attribName)) { throw new ArgumentNullException("attribName"); } string attributeValue = await extendedAttribute.GetExtendedAttributeAsync(info.FullName, attribName); return(Deserialize <T>(attributeValue)); }