diff --git a/Aaru.Archives/Arc/Unimplemented.cs b/Aaru.Archives/Arc/Unimplemented.cs index eaae68eb1..83d0119f8 100644 --- a/Aaru.Archives/Arc/Unimplemented.cs +++ b/Aaru.Archives/Arc/Unimplemented.cs @@ -9,10 +9,6 @@ public sealed partial class Arc { #region IArchive Members - /// - public ErrorNumber GetXattr(int entryNumber, string xattr, ref byte[] buffer) => - throw new NotImplementedException(); - /// public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat) => throw new NotImplementedException(); diff --git a/Aaru.Archives/Arc/Xattrs.cs b/Aaru.Archives/Arc/Xattrs.cs index 5c6de3a47..ce9da4eb0 100644 --- a/Aaru.Archives/Arc/Xattrs.cs +++ b/Aaru.Archives/Arc/Xattrs.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Text; using Aaru.CommonTypes.Enums; namespace Aaru.Archives; @@ -23,5 +24,21 @@ public sealed partial class Arc return ErrorNumber.NoError; } + /// + public ErrorNumber GetXattr(int entryNumber, string xattr, ref byte[] buffer) + { + buffer = null; + + if(!Opened) return ErrorNumber.NotOpened; + + if(entryNumber < 0 || entryNumber >= _entries.Count) return ErrorNumber.OutOfRange; + + if(xattr != "comment" || _entries[entryNumber].Comment is null) return ErrorNumber.NoSuchExtendedAttribute; + + buffer = Encoding.UTF8.GetBytes(_entries[entryNumber].Comment); + + return ErrorNumber.NoError; + } + #endregion } \ No newline at end of file