修复根据index计算name的bug
parent
dcf7fd3ae5
commit
632725f230
|
@ -20,10 +20,17 @@ namespace Obfuz.Rename
|
||||||
|
|
||||||
public string GetNewName(string originalName)
|
public string GetNewName(string originalName)
|
||||||
{
|
{
|
||||||
if (_nextIndex >= _wordSet.Count)
|
var nameBuilder = new StringBuilder();
|
||||||
throw new InvalidOperationException("No more names available in the word set.");
|
for (int i = _nextIndex++; ;)
|
||||||
string newName = _wordSet[_nextIndex++];
|
{
|
||||||
return newName;
|
nameBuilder.Append(_wordSet[i % _wordSet.Count]);
|
||||||
|
i = i / _wordSet.Count;
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nameBuilder.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue