From da8b5cd12a43360fd0558f2fbf0284fc927ecca6 Mon Sep 17 00:00:00 2001 From: Milkitic Date: Sun, 31 Dec 2023 13:55:53 +0800 Subject: [PATCH] Fix title --- KeyAsio.Gui/Windows/MainWindow.xaml.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/KeyAsio.Gui/Windows/MainWindow.xaml.cs b/KeyAsio.Gui/Windows/MainWindow.xaml.cs index 49b710f..4b4d588 100644 --- a/KeyAsio.Gui/Windows/MainWindow.xaml.cs +++ b/KeyAsio.Gui/Windows/MainWindow.xaml.cs @@ -313,7 +313,9 @@ private void ForceClose() private async void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { - Title += $" {Updater.GetVersion()}"; + var version = Updater.GetVersion(); + FixCommit(ref version); + Title += $" {version}"; if (_appSettings.Device == null) { @@ -481,4 +483,16 @@ private void btnRealtimeOptions_OnClick(object sender, RoutedEventArgs e) }; latencyGuideWindow.ShowDialog(); } + + private static void FixCommit(ref string version) + { + var lastIndexOf = version.LastIndexOf('+'); + if (lastIndexOf >= 0) + { + if (version.Length > lastIndexOf + 8) + { + version = version.Substring(0, lastIndexOf + 8); + } + } + } } \ No newline at end of file