[ARC] Implement GetXattr.

This commit is contained in:
2025-09-01 06:20:36 +01:00
parent 914ab54d6c
commit 4ac93232b0
2 changed files with 17 additions and 4 deletions

View File

@@ -9,10 +9,6 @@ public sealed partial class Arc
{
#region IArchive Members
/// <inheritdoc />
public ErrorNumber GetXattr(int entryNumber, string xattr, ref byte[] buffer) =>
throw new NotImplementedException();
/// <inheritdoc />
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat) => throw new NotImplementedException();

View File

@@ -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;
}
/// <inheritdoc />
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
}