diff --git a/src/UniversalValveToolbox/Program.cs b/src/UniversalValveToolbox/Program.cs index 5e2361c..ac02e2a 100644 --- a/src/UniversalValveToolbox/Program.cs +++ b/src/UniversalValveToolbox/Program.cs @@ -1,5 +1,7 @@ -using Steamworks; +using Microsoft.Win32; +using Steamworks; using System; +using System.Diagnostics; using System.Windows.Forms; using UniversalValveToolbox.Model.Provider; using UniversalValveToolbox.Utils; @@ -14,12 +16,47 @@ namespace UniversalValveToolbox { var dataProvide = new DataProvider(); var currSettings = dataProvide.Settings; - LanguageManager.UpdateLanguage(currSettings.Language); - - SteamClient.Init(currSettings.ToolsAppId); - Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + + LanguageManager.UpdateLanguage(currSettings.Language); + + try { SteamClient.Init(currSettings.ToolsAppId); } + catch (Exception ex) { + + DialogResult result = MessageBox.Show(@"Some error was occurred when trying to init Steam API:" + Environment.NewLine + + "---------------------------------------------------------------------------" + Environment.NewLine + + ex.Message + Environment.NewLine + + "---------------------------------------------------------------------------" + Environment.NewLine + + "Try to launch Steam?", + "Error!", MessageBoxButtons.YesNo, MessageBoxIcon.Error); + if (result == DialogResult.Yes) + { + try { + string steamPATH = ""; + RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Valve\Steam"); + steamPATH = key.GetValue("SteamExe").ToString(); + Process.Start(steamPATH); + key.Close(); + } + catch (Exception exs) { + MessageBox.Show(@"Sorry. Steam launch failed because:" + Environment.NewLine + + "---------------------------------------------------------------------------" + Environment.NewLine + + exs.Message + Environment.NewLine + + "---------------------------------------------------------------------------" + Environment.NewLine + + "Application will be terminated.", + "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); + Application.Exit(); + } + } + else + { + MessageBox.Show("Application will be terminated.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); + Application.Exit(); + } + + } + Application.Run(new FormMain()); } } diff --git a/src/UniversalValveToolbox/Properties/AssemblyInfo.cs b/src/UniversalValveToolbox/Properties/AssemblyInfo.cs index 7fb7d68..d931b65 100644 --- a/src/UniversalValveToolbox/Properties/AssemblyInfo.cs +++ b/src/UniversalValveToolbox/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.3")] -[assembly: AssemblyFileVersion("1.0.0.3")] +[assembly: AssemblyVersion("1.0.0.4")] +[assembly: AssemblyFileVersion("1.0.0.4")]