Skip to content

Commit

Permalink
Make titles.str scan more efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
FenPhoenix committed Aug 31, 2023
1 parent 6ac6030 commit b0f9b86
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions FMScanner/Core/Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3545,21 +3545,21 @@ static bool NameExistsInList(List<NameAndIndex> list, string value)

foreach (string titlesFileLocation in FMFiles_TitlesStrLocations)
{
if (_fmFormat == FMFormat.Zip)
int titlesFileIndex = -1;
for (int i = 0; i < _stringsDirFiles.Count; i++)
{
int titlesFileIndex = -1;
for (int i = 0; i < _stringsDirFiles.Count; i++)
NameAndIndex item = _stringsDirFiles[i];
if (item.Name.PathEqualsI(titlesFileLocation))
{
var item = _stringsDirFiles[i];
if (item.Name.PathEqualsI(titlesFileLocation))
{
titlesFileIndex = i;
break;
}
titlesFileIndex = i;
break;
}
}

if (titlesFileIndex == -1) continue;
if (titlesFileIndex == -1) continue;

if (_fmFormat == FMFormat.Zip)
{
ZipArchiveFastEntry e = _archive.Entries[_stringsDirFiles[titlesFileIndex].Index];
using var es = _archive.OpenEntry(e);
ReadAllLinesE(es, e.Length, _tempLines);
Expand All @@ -3568,7 +3568,6 @@ static bool NameExistsInList(List<NameAndIndex> list, string value)
else
{
string titlesFile = Path.Combine(_fmWorkingPath, titlesFileLocation);
if (!File.Exists(titlesFile)) continue;
ReadAllLinesE(titlesFile, _tempLines);
titlesStrLines = _tempLines;
}
Expand Down

0 comments on commit b0f9b86

Please sign in to comment.