From c88bff8fd5f1507f235d3f4ee9fd45193a331488 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 3 Sep 2025 03:03:39 +0100 Subject: [PATCH] [STFS] Implement GetAttributes. --- Aaru.Archives/Stfs/Files.cs | 18 ++++++++++++++++++ Aaru.Archives/Stfs/Unimplemented.cs | 6 ------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Aaru.Archives/Stfs/Files.cs b/Aaru.Archives/Stfs/Files.cs index b65adc1ca..ffc371f62 100644 --- a/Aaru.Archives/Stfs/Files.cs +++ b/Aaru.Archives/Stfs/Files.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using Aaru.CommonTypes.Enums; namespace Aaru.Archives; @@ -73,5 +74,22 @@ public sealed partial class Stfs return ErrorNumber.NoError; } + /// + public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes) + { + attributes = FileAttributes.None; + + if(!Opened) return ErrorNumber.NotOpened; + + if(entryNumber < 0 || entryNumber >= _entries.Length) return ErrorNumber.OutOfRange; + + if(_entries[entryNumber].IsDirectory) + attributes |= FileAttributes.Directory; + else + attributes |= FileAttributes.Normal; + + return ErrorNumber.NoError; + } + #endregion } \ No newline at end of file diff --git a/Aaru.Archives/Stfs/Unimplemented.cs b/Aaru.Archives/Stfs/Unimplemented.cs index 891f0754a..42cb64807 100644 --- a/Aaru.Archives/Stfs/Unimplemented.cs +++ b/Aaru.Archives/Stfs/Unimplemented.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using FileAttributes = System.IO.FileAttributes; namespace Aaru.Archives; @@ -11,11 +10,6 @@ public sealed partial class Stfs { #region IArchive Members - /// - /// - public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes) => - throw new NotImplementedException(); - /// public ErrorNumber ListXAttr(int entryNumber, out List xattrs) => throw new NotImplementedException();