From e1f16e7b2c6991d3e4f807ab96b6707e770412bc Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 7 Oct 2023 18:09:28 +0100 Subject: [PATCH] [Symbian Installation File] Implement `GetXattr()`. --- Aaru.Archives/Symbian/Unsupported.cs | 5 ----- Aaru.Archives/Symbian/Xattrs.cs | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Aaru.Archives/Symbian/Unsupported.cs b/Aaru.Archives/Symbian/Unsupported.cs index 6ae1ccd9f..4f3d426e3 100644 --- a/Aaru.Archives/Symbian/Unsupported.cs +++ b/Aaru.Archives/Symbian/Unsupported.cs @@ -33,7 +33,6 @@ using System; using System.Diagnostics.CodeAnalysis; using System.IO; -using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; namespace Aaru.Archives; @@ -44,10 +43,6 @@ public sealed partial class Symbian { #region IArchive Members - /// - public ErrorNumber GetXattr(int entryNumber, string xattr, out byte[] buffer) => - throw new NotImplementedException(); - /// public FileSystemInfo Stat(int entryNumber) => throw new NotImplementedException(); diff --git a/Aaru.Archives/Symbian/Xattrs.cs b/Aaru.Archives/Symbian/Xattrs.cs index 10fc14b80..74fd538bc 100644 --- a/Aaru.Archives/Symbian/Xattrs.cs +++ b/Aaru.Archives/Symbian/Xattrs.cs @@ -31,6 +31,8 @@ // ****************************************************************************/ using System.Collections.Generic; +using System.Text; +using Aaru.CommonTypes.Enums; namespace Aaru.Archives; @@ -56,5 +58,24 @@ public sealed partial class Symbian }; } + /// + public ErrorNumber GetXattr(int entryNumber, string xattr, out byte[] buffer) + { + buffer = null; + + if(!_opened) + return ErrorNumber.NotOpened; + + if(entryNumber < 0 || entryNumber >= _files.Count) + return ErrorNumber.OutOfRange; + + if(xattr != "org.iana.mime_type" || _files[entryNumber].mime is null) + return ErrorNumber.NoSuchExtendedAttribute; + + buffer = Encoding.ASCII.GetBytes(_files[entryNumber].mime); + + return ErrorNumber.NoError; + } + #endregion } \ No newline at end of file