From 199114e946f5cbf4e92d7bae02a6fb81f7076a71 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 7 Oct 2023 17:56:58 +0100 Subject: [PATCH] [Symbian Installation File] Implement `GetEntryNumber()`. --- Aaru.Archives/Symbian/Files.cs | 20 ++++++++++++++++++-- Aaru.Archives/Symbian/Unsupported.cs | 3 --- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Aaru.Archives/Symbian/Files.cs b/Aaru.Archives/Symbian/Files.cs index 5d4b13284..675e1be2e 100644 --- a/Aaru.Archives/Symbian/Files.cs +++ b/Aaru.Archives/Symbian/Files.cs @@ -30,6 +30,8 @@ // Copyright © 2011-2023 Natalia Portillo // ****************************************************************************/ +using System; + namespace Aaru.Archives; public sealed partial class Symbian @@ -37,12 +39,12 @@ public sealed partial class Symbian #region IArchive Members /// - public int GetNumberOfEntries() => _opened ? -1 : _files.Count; + public int GetNumberOfEntries() => _opened ? _files.Count : -1; /// public string GetFilename(int entryNumber) { - if(_opened) + if(!_opened) return null; if(entryNumber < 0 || entryNumber >= _files.Count) @@ -51,5 +53,19 @@ public sealed partial class Symbian return _files[entryNumber].destinationName; } + /// + public int GetEntryNumber(string fileName, bool caseInsensitiveMatch) + { + if(!_opened) + return -1; + + if(string.IsNullOrEmpty(fileName)) + return -1; + + return _files.FindIndex(x => caseInsensitiveMatch + ? x.destinationName.Equals(fileName, StringComparison.CurrentCultureIgnoreCase) + : x.destinationName.Equals(fileName, StringComparison.CurrentCulture)); + } + #endregion } \ No newline at end of file diff --git a/Aaru.Archives/Symbian/Unsupported.cs b/Aaru.Archives/Symbian/Unsupported.cs index 5e3b31795..b0f829981 100644 --- a/Aaru.Archives/Symbian/Unsupported.cs +++ b/Aaru.Archives/Symbian/Unsupported.cs @@ -45,9 +45,6 @@ public sealed partial class Symbian { #region IArchive Members - /// - public int GetEntryNumber(string fileName, bool caseInsensitiveMatch) => throw new NotImplementedException(); - /// public long GetCompressedSize(int entryNumber) => throw new NotImplementedException();