diff --git a/CollapseLauncher/Classes/ShortcutCreator/SteamShortcut.cs b/CollapseLauncher/Classes/ShortcutCreator/SteamShortcut.cs index 022d1af1f..2b43a1288 100644 --- a/CollapseLauncher/Classes/ShortcutCreator/SteamShortcut.cs +++ b/CollapseLauncher/Classes/ShortcutCreator/SteamShortcut.cs @@ -107,12 +107,12 @@ public static uint GenerateAppId(string exe, string appname) return appId >> 32; } - /*private uint GenerateGridId(string exe, string appname) + private static uint GenerateGridId(string exe, string appname) { uint appId = GeneratePreliminaryId(exe, appname); return (appId >> 32) - 0x10000000; - }*/ + } public void MoveImages(string path, PresetConfigV2 preset) { @@ -126,18 +126,18 @@ public void MoveImages(string path, PresetConfigV2 preset) SteamAssetCollection assets = preset.ZoneSteamAssets; // Game background - CopyImage(gridPath, assets.Hero, "_hero"); + GetImageFromUrl(gridPath, assets.Hero, "_hero"); // Game logo - CopyImage(gridPath, assets.Logo, "_logo"); + GetImageFromUrl(gridPath, assets.Logo, "_logo"); // Vertical banner // Shows when viewing all games of category or in the Home page - CopyImage(gridPath, assets.Banner, "p"); + GetImageFromUrl(gridPath, assets.Banner, "p"); // Horizontal banner // Appears in Big Picture mode when the game is the most recently played - CopyImage(gridPath, assets.Preview, ""); + GetImageFromUrl(gridPath, assets.Preview, ""); } private static string MD5Hash(string path) @@ -150,7 +150,7 @@ private static string MD5Hash(string path) return BitConverter.ToString(hash).Replace("-", string.Empty).ToLower(); } - private async void CopyImage(string gridPath, SteamAsset asset, string steamSuffix) + private async void GetImageFromUrl(string gridPath, SteamAsset asset, string steamSuffix) { string steamPath = Path.Combine(gridPath, preliminaryAppID + steamSuffix + ".png"); @@ -158,7 +158,7 @@ private async void CopyImage(string gridPath, SteamAsset asset, string steamSuff if (hash.ToLower() == asset.MD5) return; - for (int i = 0; i < 2; i++) + for (int i = 0; i < 3; i++) { FileInfo info = new FileInfo(steamPath); await DownloadImage(info, asset.URL, new CancellationToken()); @@ -170,10 +170,9 @@ private async void CopyImage(string gridPath, SteamAsset asset, string steamSuff File.Delete(steamPath); LogWriteLine(string.Format("Invalid checksum for file {0}! {1} does not match {2}.", steamPath, hash, asset.MD5), Hi3Helper.LogType.Error); - LogWriteLine("Trying again...", Hi3Helper.LogType.Error); } - LogWriteLine("After two tries, " + asset.URL + " could not be downloaded successfully.", Hi3Helper.LogType.Error); + LogWriteLine("After 3 tries, " + asset.URL + " could not be downloaded successfully.", Hi3Helper.LogType.Error); return; } diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs b/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs index 35f4bffb5..d3e67bd51 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs @@ -646,25 +646,25 @@ void CopyTextToClipboard(object sender, RoutedEventArgs e) public static async Task> Dialog_ShortcutCreationConfirm(UIElement Content, string path) { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; - panel.Children.Add(new TextBlock { Text = "A shortcut will be created in the following path:", Margin = new Thickness(0, 2, 0, 4), HorizontalAlignment = HorizontalAlignment.Center }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmSubtitle1, Margin = new Thickness(0, 2, 0, 4), HorizontalAlignment = HorizontalAlignment.Center }); TextBlock pathText = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4) }; pathText.Inlines.Add(new Run() { Text = path, FontWeight = FontWeights.Bold }); panel.Children.Add(pathText); - panel.Children.Add(new TextBlock { Text = "If there is already a shortcut with the same name in this folder, it will be replaced.", TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4), HorizontalAlignment = HorizontalAlignment.Center }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmSubtitle2, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4), HorizontalAlignment = HorizontalAlignment.Center }); CheckBox playOnLoad = new CheckBox() { - Content = new TextBlock { Text = "Automatically start game after using this shortcut", TextWrapping = TextWrapping.Wrap }, + Content = new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmCheckBox, TextWrapping = TextWrapping.Wrap }, Margin = new Thickness(0, 4, 0, -8), HorizontalAlignment = HorizontalAlignment.Center }; panel.Children.Add(playOnLoad); ContentDialogResult result = await SpawnDialog( - "Are you sure you want to continue?", + Lang._Dialogs.ShortcutCreationConfirmTitle, panel, Content, Lang._Misc.Cancel, - "Yes, continue", + Lang._Misc.YesContinue, dialogTheme: ContentDialogTheme.Warning ); @@ -674,20 +674,20 @@ public static async Task> Dialog_ShortcutCreati public static async Task Dialog_ShortcutCreationSuccess(UIElement Content, string path, bool play = false) { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; - panel.Children.Add(new TextBlock { Text = "A shiny new shortcut was created!", HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 2, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 2, 0, 4) }); TextBlock pathText = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4) }; - pathText.Inlines.Add(new Run() { Text = "Location: " }); + pathText.Inlines.Add(new Run() { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle2 }); pathText.Inlines.Add(new Run() { Text = path, FontWeight = FontWeights.Bold }); panel.Children.Add(pathText); if (play) { - panel.Children.Add(new TextBlock { Text = "Notes:", FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 4) }); - panel.Children.Add(new TextBlock { Text = " • Using this shortcut will start the game after loading the region.", TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle3, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle4, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); } return await SpawnDialog( - "Success!", + Lang._Dialogs.ShortcutCreationSuccessTitle, panel, Content, Lang._Misc.Close, @@ -699,23 +699,23 @@ public static async Task> Dialog_SteamShortcutC { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; - panel.Children.Add(new TextBlock { Text = "A shortcut will be added to every Steam profile in this computer.", HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 2) }); - panel.Children.Add(new TextBlock { Text = "If already added, the assets related to the shortcut will be verified.", HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationConfirmSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationConfirmSubtitle2, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); CheckBox playOnLoad = new CheckBox() { - Content = new TextBlock { Text = "Automatically start game after using this shortcut", TextWrapping = TextWrapping.Wrap }, + Content = new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationConfirmCheckBox, TextWrapping = TextWrapping.Wrap }, Margin = new Thickness(0, 4, 0, -8), HorizontalAlignment = HorizontalAlignment.Center }; panel.Children.Add(playOnLoad); ContentDialogResult result = await SpawnDialog( - "Are you sure you want to continue?", + Lang._Dialogs.SteamShortcutCreationConfirmTitle, panel, Content, Lang._Misc.Cancel, - "Yes, continue", + Lang._Misc.YesContinue, dialogTheme: ContentDialogTheme.Warning ); @@ -725,17 +725,17 @@ public static async Task> Dialog_SteamShortcutC public static async Task Dialog_SteamShortcutCreationSuccess(UIElement Content, bool play = false) { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; - panel.Children.Add(new TextBlock { Text = "A new shiny shortcut was added every Steam profile in this computer!", HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); - panel.Children.Add(new TextBlock { Text = "Notes:", FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle2, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 4) }); if (play) { - panel.Children.Add(new TextBlock { Text = " • Using this shortcut will start the game after loading the region.", TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle3, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); } - panel.Children.Add(new TextBlock { Text = " • Running this process again will fix any corrupted/missing images belonging to the shortcut.", TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); - panel.Children.Add(new TextBlock { Text = " • New shortcuts will only be shown after Steam is reloaded.", TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle4, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle5, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); return await SpawnDialog( - "Success!", + Lang._Dialogs.SteamShortcutCreationSuccessTitle, panel, Content, Lang._Misc.Close, diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml index 7c06f67d0..8aabdc4c2 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml +++ b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml @@ -733,7 +733,7 @@ - + @@ -741,7 +741,7 @@ - + diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs index 618c3843b..dfdd74ee1 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs @@ -2021,7 +2021,7 @@ private async void AddToSteamButton_Click(object sender, RoutedEventArgs e) private async void ShortcutButton_Click(object sender, RoutedEventArgs e) { - string folder = await FileDialogNative.GetFolderPicker(); + string folder = await FileDialogNative.GetFolderPicker(Lang._HomePage.CreateShortcut_FolderPicker); if (string.IsNullOrEmpty(folder)) return; diff --git a/Hi3Helper.Core/Lang/Locale/LangDialogs.cs b/Hi3Helper.Core/Lang/Locale/LangDialogs.cs index 2ac889f0d..9a14cf43f 100644 --- a/Hi3Helper.Core/Lang/Locale/LangDialogs.cs +++ b/Hi3Helper.Core/Lang/Locale/LangDialogs.cs @@ -102,6 +102,25 @@ public sealed class LangDialogs public string MeteredConnectionWarningSubtitle { get; set; } = LangFallback?._Dialogs.MeteredConnectionWarningSubtitle; public string ResetKbShortcutsTitle { get; set; } = LangFallback?._Dialogs.ResetKbShortcutsTitle; public string ResetKbShortcutsSubtitle { get; set; } = LangFallback?._Dialogs.ResetKbShortcutsSubtitle; + public string ShortcutCreationConfirmTitle { get; set; } = LangFallback?._Dialogs.ShortcutCreationConfirmTitle; + public string ShortcutCreationConfirmSubtitle1 { get; set; } = LangFallback?._Dialogs.ShortcutCreationConfirmSubtitle1; + public string ShortcutCreationConfirmSubtitle2 { get; set; } = LangFallback?._Dialogs.ShortcutCreationConfirmSubtitle2; + public string ShortcutCreationConfirmCheckBox { get; set; } = LangFallback?._Dialogs.ShortcutCreationConfirmCheckBox; + public string ShortcutCreationSuccessTitle { get; set; } = LangFallback?._Dialogs.ShortcutCreationSuccessTitle; + public string ShortcutCreationSuccessSubtitle1 { get; set; } = LangFallback?._Dialogs.ShortcutCreationSuccessSubtitle1; + public string ShortcutCreationSuccessSubtitle2 { get; set; } = LangFallback?._Dialogs.ShortcutCreationSuccessSubtitle2; + public string ShortcutCreationSuccessSubtitle3 { get; set; } = LangFallback?._Dialogs.ShortcutCreationSuccessSubtitle3; + public string ShortcutCreationSuccessSubtitle4 { get; set; } = LangFallback?._Dialogs.ShortcutCreationSuccessSubtitle4; + public string SteamShortcutCreationConfirmTitle { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationConfirmTitle; + public string SteamShortcutCreationConfirmSubtitle1 { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationConfirmSubtitle1; + public string SteamShortcutCreationConfirmSubtitle2 { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationConfirmSubtitle2; + public string SteamShortcutCreationConfirmCheckBox { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationConfirmCheckBox; + public string SteamShortcutCreationSuccessTitle { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationSuccessTitle; + public string SteamShortcutCreationSuccessSubtitle1 { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationSuccessSubtitle1; + public string SteamShortcutCreationSuccessSubtitle2 { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationSuccessSubtitle2; + public string SteamShortcutCreationSuccessSubtitle3 { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationSuccessSubtitle3; + public string SteamShortcutCreationSuccessSubtitle4 { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationSuccessSubtitle4; + public string SteamShortcutCreationSuccessSubtitle5 { get; set; } = LangFallback?._Dialogs.SteamShortcutCreationSuccessSubtitle5; } } #endregion diff --git a/Hi3Helper.Core/Lang/Locale/LangHomePage.cs b/Hi3Helper.Core/Lang/Locale/LangHomePage.cs index dd50beaed..ef8525c05 100644 --- a/Hi3Helper.Core/Lang/Locale/LangHomePage.cs +++ b/Hi3Helper.Core/Lang/Locale/LangHomePage.cs @@ -46,6 +46,9 @@ public sealed class LangHomePage public string GameSettings_Panel4 { get; set; } = LangFallback?._HomePage.GameSettings_Panel4; public string GameSettings_Panel4ShowEventsPanel { get; set; } = LangFallback?._HomePage.GameSettings_Panel4ShowEventsPanel; public string GameSettings_Panel4ShowSocialMediaPanel { get; set; } = LangFallback?._HomePage.GameSettings_Panel4ShowSocialMediaPanel; + public string GameSettings_Panel4CreateShortcutBtn { get; set; } = LangFallback?._HomePage.GameSettings_Panel4CreateShortcutBtn; + public string GameSettings_Panel4AddToSteamBtn { get; set; } = LangFallback?._HomePage.GameSettings_Panel4AddToSteamBtn; + public string CreateShortcut_FolderPicker { get; set; } = LangFallback?._HomePage.CreateShortcut_FolderPicker; public string GamePlaytime_Panel1 { get; set; } = LangFallback?._HomePage.GamePlaytime_Panel1; public string GamePlaytime_Idle_Panel1Hours { get; set; } = LangFallback?._HomePage.GamePlaytime_Idle_Panel1Hours; public string GamePlaytime_Idle_Panel1Minutes { get; set; } = LangFallback?._HomePage.GamePlaytime_Idle_Panel1Minutes; diff --git a/Hi3Helper.Core/Lang/Locale/LangMisc.cs b/Hi3Helper.Core/Lang/Locale/LangMisc.cs index 47d9ddac8..374a1ac67 100644 --- a/Hi3Helper.Core/Lang/Locale/LangMisc.cs +++ b/Hi3Helper.Core/Lang/Locale/LangMisc.cs @@ -42,6 +42,7 @@ public sealed class LangMisc public string YesImReallySure { get; set; } = LangFallback?._Misc.YesImReallySure; public string YesIHaveBeefyPC { get; set; } = LangFallback?._Misc.YesIHaveBeefyPC; public string YesChangeLocation { get; set; } = LangFallback?._Misc.YesChangeLocation; + public string YesContinue { get; set; } = LangFallback?._Misc.YesContinue; public string No { get; set; } = LangFallback?._Misc.No; public string NoStartFromBeginning { get; set; } = LangFallback?._Misc.NoStartFromBeginning; public string NoCancel { get; set; } = LangFallback?._Misc.NoCancel; diff --git a/Hi3Helper.Core/Lang/en_US.json b/Hi3Helper.Core/Lang/en_US.json index 4265aff7f..9a6529f18 100644 --- a/Hi3Helper.Core/Lang/en_US.json +++ b/Hi3Helper.Core/Lang/en_US.json @@ -135,6 +135,8 @@ "GameSettings_Panel4": "Miscellaneous", "GameSettings_Panel4ShowEventsPanel": "Show Events Panel", "GameSettings_Panel4ShowSocialMediaPanel": "Show Social Media Panel", + "GameSettings_Panel4CreateShortcutBtn": "Create shortcut", + "GameSettings_Panel4AddToSteamBtn": "Add to Steam", "GamePlaytime_Panel1": "Edit Playtime", "GamePlaytime_Idle_Panel1Hours": "Hours", "GamePlaytime_Idle_Panel1Minutes": "Minutes", @@ -151,7 +153,9 @@ "CommunityToolsBtn": "Community Tools", "CommunityToolsBtn_OfficialText": "Official Tools", "CommunityToolsBtn_CommunityText": "Community Tools", - "CommunityToolsBtn_OpenExecutableAppDialogTitle": "Select Program Executable: {0}" + "CommunityToolsBtn_OpenExecutableAppDialogTitle": "Select Program Executable: {0}", + + "CreateShortcut_FolderPicker": "Select where to place the shortcut" }, "_GameRepairPage": { @@ -466,6 +470,7 @@ "YesImReallySure": "Yes, I'm really sure!", "YesIHaveBeefyPC": "Yes, I have a beefy PC! ᕦ(ò_ó)ᕤ", "YesChangeLocation": "Yes, Change location", + "YesContinue": "Yes, Continue", "No": "No", "NoStartFromBeginning": "No, Start Over", @@ -658,7 +663,28 @@ "OperationWarningNotCancellableMsg2": "CANNOT CANCEL THIS PROCESS", "OperationWarningNotCancellableMsg3": " while it's running!\r\n\r\nClick \"", "OperationWarningNotCancellableMsg4": "\" to start the process or \"", - "OperationWarningNotCancellableMsg5": "\" to cancel the operation." + "OperationWarningNotCancellableMsg5": "\" to cancel the operation.", + + "ShortcutCreationConfirmTitle": "Are you sure you want to continue?", + "ShortcutCreationConfirmSubtitle1": "A shortcut will be created in the following path:", + "ShortcutCreationConfirmSubtitle2": "If there is already a shortcut with the same name in this folder, it will be replaced.", + "ShortcutCreationConfirmCheckBox": "Automatically start game after using this shortcut", + "ShortcutCreationSuccessTitle": "Success!", + "ShortcutCreationSuccessSubtitle1": "A shiny new shortcut was created!", + "ShortcutCreationSuccessSubtitle2": "Location: ", + "ShortcutCreationSuccessSubtitle3": "Notes:", + "ShortcutCreationSuccessSubtitle4": " • Using this shortcut will start the game after loading the region.", + + "SteamShortcutCreationConfirmTitle": "Are you sure you want to continue?", + "SteamShortcutCreationConfirmSubtitle1": "A shortcut will be added to every Steam profile in this computer.", + "SteamShortcutCreationConfirmSubtitle2": "If already added, the assets related to the shortcut will be verified.", + "SteamShortcutCreationConfirmCheckBox": "Automatically start game after using this shortcut", + "SteamShortcutCreationSuccessTitle": "Success!", + "SteamShortcutCreationSuccessSubtitle1": "A new shiny shortcut was added to every Steam profile in this computer!", + "SteamShortcutCreationSuccessSubtitle2": "Notes:", + "SteamShortcutCreationSuccessSubtitle3": " • Using this shortcut will start the game after loading the region.", + "SteamShortcutCreationSuccessSubtitle4": " • Running this process again will fix any corrupted/missing images belonging to the shortcut.", + "SteamShortcutCreationSuccessSubtitle5": " • New shortcuts will only be shown after Steam is reloaded." }, "_FileMigrationProcess": {