[Symbian Installation File] Implement GetEntryNumber().

This commit is contained in:
2023-10-07 17:56:58 +01:00
parent 7a2272f819
commit 199114e946
2 changed files with 18 additions and 5 deletions

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2023 Natalia Portillo // Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/ // ****************************************************************************/
using System;
namespace Aaru.Archives; namespace Aaru.Archives;
public sealed partial class Symbian public sealed partial class Symbian
@@ -37,12 +39,12 @@ public sealed partial class Symbian
#region IArchive Members #region IArchive Members
/// <inheritdoc /> /// <inheritdoc />
public int GetNumberOfEntries() => _opened ? -1 : _files.Count; public int GetNumberOfEntries() => _opened ? _files.Count : -1;
/// <inheritdoc /> /// <inheritdoc />
public string GetFilename(int entryNumber) public string GetFilename(int entryNumber)
{ {
if(_opened) if(!_opened)
return null; return null;
if(entryNumber < 0 || entryNumber >= _files.Count) if(entryNumber < 0 || entryNumber >= _files.Count)
@@ -51,5 +53,19 @@ public sealed partial class Symbian
return _files[entryNumber].destinationName; return _files[entryNumber].destinationName;
} }
/// <inheritdoc />
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 #endregion
} }

View File

@@ -45,9 +45,6 @@ public sealed partial class Symbian
{ {
#region IArchive Members #region IArchive Members
/// <inheritdoc />
public int GetEntryNumber(string fileName, bool caseInsensitiveMatch) => throw new NotImplementedException();
/// <inheritdoc /> /// <inheritdoc />
public long GetCompressedSize(int entryNumber) => throw new NotImplementedException(); public long GetCompressedSize(int entryNumber) => throw new NotImplementedException();