/// <summary> /// Sets <see cref="FileSystemExtendedAttribute"/> as a storage for attributes. /// </summary> /// <param name="fileSystemExtendedAttribute"></param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="fileSystemExtendedAttribute"/> is <c>null</c>.</exception> public static void UseFileSystemAttribute(FileSystemExtendedAttribute fileSystemExtendedAttribute) { if (extendedAttribute == null) { throw new ArgumentNullException(nameof(extendedAttribute)); } extendedAttribute = fileSystemExtendedAttribute; }
public static void SetAttribute <T>(this ApiList <IExtendedAttribute> attributes, string name, T value) { IExtendedAttribute attribute = attributes.FirstOrDefault(f => f.Key == name); if (attribute == null) { attribute = new ExtendedAttribute() { Key = name }; attributes.Add(attribute); } attribute.Value = Convert.ToString(value); }
/// <summary> /// Initializes static class members. /// </summary> static FileSystemInfoExtension() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { extendedAttribute = new WindowsExtendedAttribute(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { extendedAttribute = new LinuxExtendedAttribute(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { extendedAttribute = new OSXExtendedAttribute(); } else { throw new Exception("Not Supported OS"); } }