Skip to content

Commit 64aa438

Browse files
committed
Merge branch 'staging'
2 parents f1e5b63 + 9099a80 commit 64aa438

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

CathodeLib/CathodeLib.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<Authors>Matt Filer</Authors>
1111
<Description>Provides support for parsing and writing common Alien: Isolation formats from the Cathode engine.</Description>
1212
<Copyright>Matt Filer 2025</Copyright>
13-
<Version>0.8.2</Version>
13+
<Version>0.8.3</Version>
1414
<OutputType>Library</OutputType>
15-
<AssemblyVersion>0.7.8.2</AssemblyVersion>
15+
<AssemblyVersion>0.7.8.3</AssemblyVersion>
1616
<FileVersion>0.7.8.2</FileVersion>
1717
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>

CathodeLib/Scripts/CATHODE/CommandsPAK/Helpers/ShortGuidUtils.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,17 @@ public static string FindString(ShortGuid guid)
122122
/* Generate a random unique ShortGuid */
123123
public static ShortGuid GenerateRandom()
124124
{
125-
string str = DateTime.Now.ToString("G");
125+
string str = Guid.NewGuid().ToString();
126126
ShortGuid guid = Generate(str, false);
127-
int i = 0;
128-
int c_i = 0;
127+
int s = 0;
129128
while (_vanilla.cache.ContainsKey(str) || _custom.cache.ContainsKey(str) || _vanilla.cacheReversed.ContainsKey(guid) || _custom.cacheReversed.ContainsKey(guid))
130129
{
131-
str = guid.ToByteString();
132-
if (i > 1000)
133-
{
134-
str += (char)c_i;
135-
c_i++;
136-
i = 0;
137-
}
130+
str = $"{str}_{s++}";
138131
guid = Generate(str, false);
139-
i++;
132+
133+
if (s > 10000) throw new Exception("Failed to generate unique ShortGuid after many attempts.");
140134
}
141-
//Cache(guid, str);
135+
Cache(guid, str);
142136
return guid;
143137
}
144138

0 commit comments

Comments
 (0)