mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[AMG] Implement GetEntryNumber.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
|
|
||||||
namespace Aaru.Archives;
|
namespace Aaru.Archives;
|
||||||
@@ -20,5 +21,30 @@ public sealed partial class Amg
|
|||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ErrorNumber GetEntryNumber(string fileName, bool caseInsensitiveMatch, out int entryNumber)
|
||||||
|
{
|
||||||
|
entryNumber = -1;
|
||||||
|
|
||||||
|
if(!Opened) return ErrorNumber.NotOpened;
|
||||||
|
|
||||||
|
if(entryNumber < 0 || entryNumber >= _files.Count) return ErrorNumber.OutOfRange;
|
||||||
|
|
||||||
|
StringComparison comparison = caseInsensitiveMatch
|
||||||
|
? StringComparison.CurrentCultureIgnoreCase
|
||||||
|
: StringComparison.CurrentCulture;
|
||||||
|
|
||||||
|
for(int i = 0, count = _files.Count; i < count; i++)
|
||||||
|
{
|
||||||
|
if(!_files[i].Filename.Equals(fileName, comparison)) continue;
|
||||||
|
|
||||||
|
entryNumber = i;
|
||||||
|
|
||||||
|
return ErrorNumber.NoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ErrorNumber.NoSuchFile;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -11,10 +11,6 @@ public sealed partial class Amg
|
|||||||
{
|
{
|
||||||
#region IArchive Members
|
#region IArchive Members
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public ErrorNumber GetEntryNumber(string fileName, bool caseInsensitiveMatch, out int entryNumber) =>
|
|
||||||
throw new NotImplementedException();
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ErrorNumber GetCompressedSize(int entryNumber, out long length) => throw new NotImplementedException();
|
public ErrorNumber GetCompressedSize(int entryNumber, out long length) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user