Skip to content

Commit ff1b2a2

Browse files
authored
Merge pull request #588 from RyanYappert/fix/quest-english-patching
Fix: More adjustments to the language patcher
2 parents 9a4b78b + 4f1be10 commit ff1b2a2

2 files changed

Lines changed: 271040 additions & 268235 deletions

File tree

Arrowgene.Ddon.Cli/Command/ClientCommand.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Text;
56
using System.Text.Json;
67
using Arrowgene.Ddon.Client;
@@ -219,16 +220,27 @@ public CommandResultType Run(CommandParameter parameter)
219220
foreach (GuiMessage.Entry entry in gmd.Entries)
220221
{
221222
GmdCsv.Entry matchCsvEntry = null;
223+
List<GmdCsv.Entry> keyMatches = new();
224+
List<GmdCsv.Entry> indexMatches = new();
222225
foreach (GmdCsv.Entry csvEntry in gmdCsvEntries)
223226
{
224-
if (!string.IsNullOrEmpty(entry.Key) && csvEntry.Key == entry.Key && entry.ReadIndex == csvEntry.ReadIndex)
227+
if (!string.IsNullOrEmpty(entry.Key) && csvEntry.Key == entry.Key)
225228
{
226-
// Both key AND index have to match, because there are gui entries with duplicate keys.
227-
matchCsvEntry = csvEntry;
228-
break;
229+
keyMatches.Add(csvEntry);
230+
continue;
231+
}
232+
233+
if (entry.ReadIndex == csvEntry.ReadIndex)
234+
{
235+
indexMatches.Add(csvEntry);
236+
continue;
229237
}
230238
}
231239

240+
matchCsvEntry = keyMatches.Where(x => x.ReadIndex == entry.ReadIndex).FirstOrDefault()
241+
?? keyMatches.FirstOrDefault()
242+
?? indexMatches.FirstOrDefault();
243+
232244
if (matchCsvEntry == null)
233245
{
234246
Logger.Info(

0 commit comments

Comments
 (0)