2025-09-08 01:14:58 +01:00
|
|
|
using System;
|
2025-09-08 01:14:08 +01:00
|
|
|
using Aaru.CommonTypes.Enums;
|
|
|
|
|
|
|
|
|
|
namespace Aaru.Archives;
|
|
|
|
|
|
|
|
|
|
public sealed partial class Ha
|
|
|
|
|
{
|
|
|
|
|
#region IArchive Members
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ErrorNumber GetFilename(int entryNumber, out string fileName)
|
|
|
|
|
{
|
|
|
|
|
fileName = null;
|
|
|
|
|
|
|
|
|
|
if(!Opened) return ErrorNumber.NotOpened;
|
|
|
|
|
|
|
|
|
|
if(entryNumber < 0 || entryNumber >= _entries.Count) return ErrorNumber.OutOfRange;
|
|
|
|
|
|
|
|
|
|
fileName = _entries[entryNumber].Filename;
|
|
|
|
|
|
|
|
|
|
return ErrorNumber.NoError;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-08 01:14:58 +01:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ErrorNumber GetEntryNumber(string fileName, bool caseInsensitiveMatch, out int entryNumber)
|
|
|
|
|
{
|
|
|
|
|
entryNumber = -1;
|
|
|
|
|
|
|
|
|
|
if(!Opened) return ErrorNumber.NotOpened;
|
|
|
|
|
|
|
|
|
|
if(entryNumber < 0 || entryNumber >= _entries.Count) return ErrorNumber.OutOfRange;
|
|
|
|
|
|
|
|
|
|
StringComparison comparison = caseInsensitiveMatch
|
|
|
|
|
? StringComparison.CurrentCultureIgnoreCase
|
|
|
|
|
: StringComparison.CurrentCulture;
|
|
|
|
|
|
|
|
|
|
for(int i = 0, count = _entries.Count; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
if(!_entries[i].Filename.Equals(fileName, comparison)) continue;
|
|
|
|
|
|
|
|
|
|
entryNumber = i;
|
|
|
|
|
|
|
|
|
|
return ErrorNumber.NoError;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ErrorNumber.NoSuchFile;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-08 01:14:08 +01:00
|
|
|
#endregion
|
|
|
|
|
}
|