/// <summary> /// Attempts to get the build number from the mods folder. /// </summary> private void GetModsDirectoryBuild() { ReadOnlySpan <char> storagePath = StoragePath.AsSpan(); ReadOnlySpan <char> lastDirectory = storagePath.Slice(storagePath.LastIndexOf(Path.DirectorySeparatorChar) + 1); int indexOfBuild = lastDirectory.LastIndexOf('_'); if (indexOfBuild > -1 && int.TryParse(lastDirectory.Slice(indexOfBuild + 1), out int value)) { HotsBuild = value; Console.WriteLine($"Hots build: {HotsBuild}"); } else { Console.WriteLine($"Defaulting to latest build"); } }
/// <summary> /// Attempts to get the build number from the mods folder. /// </summary> private static void GetModsDirectoryBuild() { ReadOnlySpan <char> storagePath = StoragePath.AsSpan(); ReadOnlySpan <char> lastDirectory = storagePath[(storagePath.LastIndexOf(Path.DirectorySeparatorChar) + 1)..];