1
0
mirror of synced 2025-01-31 12:23:52 +01:00

Improve duplicate name check

This commit is contained in:
KillzXGaming 2019-05-04 15:18:32 -04:00
parent 686d6f809e
commit 4b1541d259
4 changed files with 3 additions and 4 deletions

Binary file not shown.

View File

@ -128,17 +128,16 @@ namespace Switch_Toolbox.Library
return data.Skip((int)offset).Take((int)length).ToArray();
}
static int i = 0;
public static string RenameDuplicateString(List<string> strings, string oldString)
public static string RenameDuplicateString(List<string> strings, string oldString, int index = 0)
{
foreach (string s in strings)
{
if (strings.Contains(oldString))
{
oldString += i.ToString();
oldString = $"oldString{index}";
if (strings.Contains(oldString))
RenameDuplicateString(strings, oldString);
RenameDuplicateString(strings, oldString, index++);
else
return oldString;
}