mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[ZOO] Implement GetEntryNumber.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
// Copyright © 2011-2025 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -110,5 +111,29 @@ public sealed partial class Zoo
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetEntryNumber(string fileName, bool caseInsensitiveMatch, out int entryNumber)
|
||||
{
|
||||
// This can be done faster, it's 7am, gimme a break
|
||||
entryNumber = -1;
|
||||
|
||||
if(!Opened) return ErrorNumber.NotOpened;
|
||||
|
||||
StringComparison comparison = caseInsensitiveMatch
|
||||
? StringComparison.CurrentCultureIgnoreCase
|
||||
: StringComparison.CurrentCulture;
|
||||
|
||||
for(int i = 0, count = _files.Count; i < count; i++)
|
||||
{
|
||||
if(GetFilename(i, out string name) != ErrorNumber.NoError || !name.Equals(fileName, comparison)) continue;
|
||||
|
||||
entryNumber = i;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
return ErrorNumber.NoSuchFile;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -37,11 +37,6 @@ public sealed partial class Zoo
|
||||
{
|
||||
#region IArchive Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetEntryNumber(string fileName, bool caseInsensitiveMatch, out int entryNumber) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat) => throw new NotImplementedException();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user