mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[ARC] Implement GetXattr.
This commit is contained in:
@@ -9,10 +9,6 @@ public sealed partial class Arc
|
|||||||
{
|
{
|
||||||
#region IArchive Members
|
#region IArchive Members
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public ErrorNumber GetXattr(int entryNumber, string xattr, ref byte[] buffer) =>
|
|
||||||
throw new NotImplementedException();
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat) => throw new NotImplementedException();
|
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
|
|
||||||
namespace Aaru.Archives;
|
namespace Aaru.Archives;
|
||||||
@@ -23,5 +24,21 @@ public sealed partial class Arc
|
|||||||
return ErrorNumber.NoError;
|
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
|
#endregion
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user