From d08666c3671023d5894dee2ab00645a5def36f91 Mon Sep 17 00:00:00 2001 From: anon Date: Sat, 14 May 2022 22:22:27 +0900 Subject: [PATCH 1/5] Support notify to updating privacy policy --- .../PrivacyConfirmationException.cs | 52 +++++++++++++++ KsGameLauncher/KsGameLauncher.csproj | 1 + KsGameLauncher/Launcher.cs | 63 ++++++++++++++----- .../Properties/Settings.Designer.cs | 48 ++++++++++++++ KsGameLauncher/Properties/Settings.settings | 15 +++++ KsGameLauncher/Properties/Strings.Designer.cs | 27 ++++++++ KsGameLauncher/Properties/Strings.en-US.resx | 6 ++ KsGameLauncher/Properties/Strings.ja-JP.resx | 6 ++ KsGameLauncher/Properties/Strings.resx | 6 ++ 9 files changed, 209 insertions(+), 15 deletions(-) create mode 100644 KsGameLauncher/Exceptions/PrivacyConfirmationException.cs diff --git a/KsGameLauncher/Exceptions/PrivacyConfirmationException.cs b/KsGameLauncher/Exceptions/PrivacyConfirmationException.cs new file mode 100644 index 0000000..10c570b --- /dev/null +++ b/KsGameLauncher/Exceptions/PrivacyConfirmationException.cs @@ -0,0 +1,52 @@ +using System; +using System.Runtime.Serialization; + +namespace KsGameLauncher +{ + [Serializable] + internal class PrivacyConfirmationException : Exception + { + public static string PrivacyURL; + + public PrivacyConfirmationException() + { + } + + public PrivacyConfirmationException(string message) : base(message) + { + } + + public PrivacyConfirmationException(string message, Exception innerException) : base(message, innerException) + { + } + + protected PrivacyConfirmationException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + + public PrivacyConfirmationException(string message, string URL) : base(message) + { + PrivacyURL = URL; + } + + public PrivacyConfirmationException(string message, string URL, Exception innerException) : base(message, innerException) + { + PrivacyURL = URL; + } + + public void SetTosURL(string url) + { + PrivacyURL = url ?? throw new ArgumentNullException("url"); + } + public void SetTosURL(Uri url) + { + if (url == null) + throw new ArgumentNullException("url"); + PrivacyURL = url.ToString(); + } + public string GetPrivacyURL() + { + return PrivacyURL; + } + } +} \ No newline at end of file diff --git a/KsGameLauncher/KsGameLauncher.csproj b/KsGameLauncher/KsGameLauncher.csproj index 86e6335..d7f8d8c 100644 --- a/KsGameLauncher/KsGameLauncher.csproj +++ b/KsGameLauncher/KsGameLauncher.csproj @@ -155,6 +155,7 @@ + Form diff --git a/KsGameLauncher/Launcher.cs b/KsGameLauncher/Launcher.cs index 7139553..b0e2449 100644 --- a/KsGameLauncher/Launcher.cs +++ b/KsGameLauncher/Launcher.cs @@ -12,6 +12,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; +using KsGameLauncher.Properties; namespace KsGameLauncher { @@ -170,11 +171,26 @@ private HttpClient CreateHttp() { httpHandler.Proxy = WebRequest.GetSystemWebProxy(); } - Cookie savedCookie = Properties.Settings.Default.Cookie; - if (savedCookie != null - && !savedCookie.Expired) + + CookieContainer savedCookies = Properties.Settings.Default.Cookies; + if (savedCookies != null) { - httpHandler.CookieContainer.Add(savedCookie); + bool expired = true; + Debug.WriteLine(savedCookies.GetType().ToString()); + foreach (Cookie cookie in savedCookies.GetCookies(new Uri(Properties.Settings.Default.BaseURL))) + { + Debug.WriteLine(cookie.GetType().ToString()); + // cookie : CookieCollection + if (cookie != null && cookie.Name == Properties.Resources.LoginCookieSessionKey) + { + //expired = collection[Properties.Resources.LoginCookieSessionKey].Expired; + expired = cookie.Expired; + } + } + if (!expired) + { + httpHandler.CookieContainer = savedCookies; + } } HttpClient httpClient = new HttpClient(httpHandler) { @@ -213,19 +229,21 @@ internal bool IsLogin() } bool isLogin = false; - CookieCollection cookies = httpHandler.CookieContainer.GetCookies(new Uri(Properties.Settings.Default.BaseURL)); - Cookie savedCookie = Properties.Settings.Default.Cookie; + Uri BaseURL = new Uri(Properties.Settings.Default.BaseURL); + CookieCollection cookies = httpHandler.CookieContainer.GetCookies(BaseURL); + CookieContainer savedCookies = Properties.Settings.Default.Cookies; foreach (Cookie cookie in cookies) { + Debug.WriteLine(String.Format("DomainName: {0}; Path={1}", cookie.Domain, cookie.Path)); Debug.WriteLine(String.Format("CookieName: {0}", cookie.Name)); if (cookie.Name == Properties.Resources.LoginCookieSessionKey) { Debug.WriteLine(String.Format("Cookie: {0}", cookie.ToString())); isLogin = true; - if (savedCookie == null || savedCookie.Expired) + if (savedCookies == null || cookie.Expired) { // Save latest cookie value if it does not exists, or expired - Properties.Settings.Default.Cookie = cookie; + Properties.Settings.Default.Cookies = httpHandler.CookieContainer; Properties.Settings.Default.Save(); } break; @@ -606,14 +624,17 @@ public async Task StartApp(AppInfo app) { response.EnsureSuccessStatusCode(); - + Debug.WriteLine(String.Format("After get launcher URL: {0}", response.RequestMessage.RequestUri)); if (response.RequestMessage.RequestUri.Host.Contains(Properties.Resources.AuthorizeDomain)) { - MessageBox.Show(Properties.Strings.IncorrectUsernameOrPassword, Properties.Strings.AppName, - MessageBoxButtons.OK, MessageBoxIcon.Error, - MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); - await Logout(); - return; + //if (!await Login(GetCredential(), response.RequestMessage.RequestUri)) + //{ + MessageBox.Show(Properties.Strings.IncorrectUsernameOrPassword, Properties.Strings.AppName, + MessageBoxButtons.OK, MessageBoxIcon.Error, + MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); + await Logout(); + return; + //} } if (response.StatusCode != HttpStatusCode.OK) @@ -652,6 +673,10 @@ public async Task StartApp(AppInfo app) { throw new GameTermsOfServiceException(Properties.Strings.ShouldCheckTermOfService, loadedURL); } + else if (loadedURL.Contains(Properties.Settings.Default.PrivacyConfirmPath)) + { + throw new PrivacyConfirmationException(Properties.Strings.ConfirmPrivacyPolicy, loadedURL); + } string content = GetResponseContentWithEncoding(response); @@ -700,6 +725,14 @@ public async Task StartApp(AppInfo app) MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); Utils.Common.OpenUrlByDefaultBrowser(ex.GetTosURL()); } + catch (PrivacyConfirmationException ex) + { + MessageBox.Show(ex.Message, Properties.Strings.PrivacyConfirmationExceptionDialogName, + MessageBoxButtons.OK, MessageBoxIcon.Information, + MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); + Utils.Common.OpenUrlByDefaultBrowser(ex.GetPrivacyURL()); + + } catch (Exception e) { throw e; @@ -782,7 +815,7 @@ async public static Task Logout() response.EnsureSuccessStatusCode(); instance.httpClient = null; - Properties.Settings.Default.Cookie = null; + Properties.Settings.Default.Cookies = null; Properties.Settings.Default.Save(); return response; diff --git a/KsGameLauncher/Properties/Settings.Designer.cs b/KsGameLauncher/Properties/Settings.Designer.cs index 354c875..7e2ac6a 100644 --- a/KsGameLauncher/Properties/Settings.Designer.cs +++ b/KsGameLauncher/Properties/Settings.Designer.cs @@ -382,5 +382,53 @@ public int UpdateCheckInterval { } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("https://p.eagate.573.jp/gate/agree/p/privacy_confirm.html")] + public string PrivacyConfirmPath { + get { + return ((string)(this["PrivacyConfirmPath"])); + } + set { + this["PrivacyConfirmPath"] = value; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("launcher\\modules\\errorreporter.exe")] + public string ErrorReporterPath { + get { + return ((string)(this["ErrorReporterPath"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("launcher\\modules\\bm2dx_er.exe")] + public string ErrorReporterPath_2dx { + get { + return ((string)(this["ErrorReporterPath_2dx"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("launcher\\modules\\launcher.exe")] + public string LauncherPath { + get { + return ((string)(this["LauncherPath"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("launcher\\modules\\bm2dx_launcher.exe")] + public string LauncherPath_2dx { + get { + return ((string)(this["LauncherPath_2dx"])); + } + } } } diff --git a/KsGameLauncher/Properties/Settings.settings b/KsGameLauncher/Properties/Settings.settings index ef26f90..b64c2a1 100644 --- a/KsGameLauncher/Properties/Settings.settings +++ b/KsGameLauncher/Properties/Settings.settings @@ -105,5 +105,20 @@ 0 + + https://p.eagate.573.jp/gate/agree/p/privacy_confirm.html + + + launcher\modules\errorreporter.exe + + + launcher\modules\bm2dx_er.exe + + + launcher\modules\launcher.exe + + + launcher\modules\bm2dx_launcher.exe + \ No newline at end of file diff --git a/KsGameLauncher/Properties/Strings.Designer.cs b/KsGameLauncher/Properties/Strings.Designer.cs index 8243483..cc35ff7 100644 --- a/KsGameLauncher/Properties/Strings.Designer.cs +++ b/KsGameLauncher/Properties/Strings.Designer.cs @@ -326,6 +326,15 @@ internal static string ConfirmExitDialogMessage { } } + /// + /// Privacy policy has updated, please check it. に類似しているローカライズされた文字列を検索します。 + /// + internal static string ConfirmPrivacyPolicy { + get { + return ResourceManager.GetString("ConfirmPrivacyPolicy", resourceCulture); + } + } + /// /// Are you sure you want to enable shortcut launch ? /// @@ -753,6 +762,24 @@ internal static string OTPDialogMessage_OTP { } } + /// + /// Privacy policy update に類似しているローカライズされた文字列を検索します。 + /// + internal static string PrivacyConfirmationExceptionDialogName { + get { + return ResourceManager.GetString("PrivacyConfirmationExceptionDialogName", resourceCulture); + } + } + + /// + /// Run the game directly に類似しているローカライズされた文字列を検索します。 + /// + internal static string RunGameDirectly { + get { + return ResourceManager.GetString("RunGameDirectly", resourceCulture); + } + } + /// /// Service is temporarily down or unavailable. に類似しているローカライズされた文字列を検索します。 /// diff --git a/KsGameLauncher/Properties/Strings.en-US.resx b/KsGameLauncher/Properties/Strings.en-US.resx index a3074e8..d378ebf 100644 --- a/KsGameLauncher/Properties/Strings.en-US.resx +++ b/KsGameLauncher/Properties/Strings.en-US.resx @@ -215,6 +215,9 @@ If you select "No", this changes will be applied at the next time. Are you sure you want to exit ? + + Privacy policy has updated, please check it. + Are you sure you want to enable shortcut launch ? @@ -376,6 +379,9 @@ This file may not exist or may be temporarily unavailable. Enter {0}-digits code displayed on your token device/app. {0} is required number of digits + + Privacy policy update + Service is temporarily down or unavailable. diff --git a/KsGameLauncher/Properties/Strings.ja-JP.resx b/KsGameLauncher/Properties/Strings.ja-JP.resx index c010e79..e816c9e 100644 --- a/KsGameLauncher/Properties/Strings.ja-JP.resx +++ b/KsGameLauncher/Properties/Strings.ja-JP.resx @@ -426,4 +426,10 @@ OTPとは + + プライバシーポリシーが更新されました。内容をご確認ください。 + + + プライバシーポリシーの更新 + \ No newline at end of file diff --git a/KsGameLauncher/Properties/Strings.resx b/KsGameLauncher/Properties/Strings.resx index 4279f44..d0c3445 100644 --- a/KsGameLauncher/Properties/Strings.resx +++ b/KsGameLauncher/Properties/Strings.resx @@ -431,4 +431,10 @@ Do you want to display maintenance information? What is OTP + + Privacy policy has updated, please check it. + + + Privacy policy update + \ No newline at end of file From 6eeec67d04a984ad9ad82d689cc8879b4df902e7 Mon Sep 17 00:00:00 2001 From: anon Date: Sat, 14 May 2022 22:23:15 +0900 Subject: [PATCH 2/5] Privacy policy support --- KsGameLauncher/App.config | 153 +++++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 69 deletions(-) diff --git a/KsGameLauncher/App.config b/KsGameLauncher/App.config index 9ccb3c5..d9e69f5 100644 --- a/KsGameLauncher/App.config +++ b/KsGameLauncher/App.config @@ -50,6 +50,18 @@ + + launcher\modules\errorreporter.exe + + + launcher\modules\bm2dx_er.exe + + + launcher\modules\launcher.exe + + + launcher\modules\bm2dx_launcher.exe + @@ -95,75 +107,78 @@ - - https://launcher-app.sdvx.net/conf/appinfo.json - - - #id_userId - - - #id_password - - - #login>div>a.link-btn - - - div.form-area>form>input[type=hidden][name=csrfmiddlewaretoken] - - - #login-form>div.form-area>form - - - False - - - True - - - 1 - - - True - - - 0 - - - #login>div>a.link-btn - - - True - - - 400, 300 - - - False - - - #id_pincode - - - #is_persistent - - - two_step.html - - - False - - - #two-step-form>div.form-area>form - - - system - - - 0 - - - 0 - + + https://launcher-app.sdvx.net/conf/appinfo.json + + + #id_userId + + + #id_password + + + #login>div>a.link-btn + + + div.form-area>form>input[type=hidden][name=csrfmiddlewaretoken] + + + #login-form>div.form-area>form + + + False + + + True + + + 1 + + + True + + + 0 + + + #login>div>a.link-btn + + + True + + + 400, 300 + + + False + + + #id_pincode + + + #is_persistent + + + two_step.html + + + False + + + #two-step-form>div.form-area>form + + + system + + + 0 + + + 0 + + + https://p.eagate.573.jp/gate/agree/p/privacy_confirm.html + From 27248d7b87d4a2cbe7c06be4faddbf78c6e3cd02 Mon Sep 17 00:00:00 2001 From: anon Date: Sat, 14 May 2022 22:25:17 +0900 Subject: [PATCH 3/5] Updated how to retain login sessions --- KsGameLauncher/Forms/AboutForm.cs | 3 ++- KsGameLauncher/Properties/AssemblyInfo.cs | 4 +-- .../Properties/Resources.Designer.cs | 11 +++++++- KsGameLauncher/Properties/Resources.resx | 5 +++- KsGameLauncher/Properties/app.manifest | 2 +- KsGameLauncher/Settings.cs | 26 +++++++++++++++---- KsGameLauncher/Utils/AppUtil.cs | 2 +- 7 files changed, 41 insertions(+), 12 deletions(-) diff --git a/KsGameLauncher/Forms/AboutForm.cs b/KsGameLauncher/Forms/AboutForm.cs index 09719fe..5042b20 100644 --- a/KsGameLauncher/Forms/AboutForm.cs +++ b/KsGameLauncher/Forms/AboutForm.cs @@ -24,7 +24,8 @@ private void About_Load(object sender, EventArgs e) if (GetInstalledGamesName().Length > 0) { string installedGameRights = string.Format("\"{0}\"", string.Join("\", \"", GetInstalledGamesName())); - textBox_Copyrights.Text += string.Format("{0} are KONAMI Amusement All Rights Reserved.\r\n", installedGameRights); + string allrightsReserved = string.Format("{0} All Rights Reserved.", Properties.Resources.GamePublisher); + textBox_Copyrights.Text += string.Format("{0} are {1}.\r\n", installedGameRights, allrightsReserved); } textBox_Copyrights.Text += Properties.Resources.Copyrights; linkLabel_Support.Text = Properties.Resources.SupportLabelText; diff --git a/KsGameLauncher/Properties/AssemblyInfo.cs b/KsGameLauncher/Properties/AssemblyInfo.cs index c9c6b71..7252e42 100644 --- a/KsGameLauncher/Properties/AssemblyInfo.cs +++ b/KsGameLauncher/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.2.0")] -[assembly: AssemblyFileVersion("1.0.2.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("1.0.3.0")] diff --git a/KsGameLauncher/Properties/Resources.Designer.cs b/KsGameLauncher/Properties/Resources.Designer.cs index 7fcc010..75534f9 100644 --- a/KsGameLauncher/Properties/Resources.Designer.cs +++ b/KsGameLauncher/Properties/Resources.Designer.cs @@ -135,7 +135,7 @@ internal static string DefaultLanguage { } /// - /// anon に類似しているローカライズされた文字列を検索します。 + /// anon5r に類似しているローカライズされた文字列を検索します。 /// internal static string Developers { get { @@ -143,6 +143,15 @@ internal static string Developers { } } + /// + /// KONAMI Amusement Co.,Ltd. に類似しているローカライズされた文字列を検索します。 + /// + internal static string GamePublisher { + get { + return ResourceManager.GetString("GamePublisher", resourceCulture); + } + } + /// /// https://github.com/anon5r/KsGameLauncher に類似しているローカライズされた文字列を検索します。 /// diff --git a/KsGameLauncher/Properties/Resources.resx b/KsGameLauncher/Properties/Resources.resx index 1bd5d5b..6fb12e2 100644 --- a/KsGameLauncher/Properties/Resources.resx +++ b/KsGameLauncher/Properties/Resources.resx @@ -143,7 +143,10 @@ ..\resources\icons\default-game-icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - anon + anon5r + + + KONAMI Amusement Co.,Ltd. https://github.com/anon5r/KsGameLauncher diff --git a/KsGameLauncher/Properties/app.manifest b/KsGameLauncher/Properties/app.manifest index d63dbaf..27da1e0 100644 --- a/KsGameLauncher/Properties/app.manifest +++ b/KsGameLauncher/Properties/app.manifest @@ -19,8 +19,8 @@ - + diff --git a/KsGameLauncher/Settings.cs b/KsGameLauncher/Settings.cs index 54456f2..88cab5c 100644 --- a/KsGameLauncher/Settings.cs +++ b/KsGameLauncher/Settings.cs @@ -42,20 +42,36 @@ public System.Boolean IsUpgrated [System.Configuration.UserScopedSettingAttribute()] - [System.Configuration.SettingsDescription("Cookie as login session")] + [System.Configuration.SettingsDescription("Cookie collection as login session")] [System.Configuration.DefaultSettingValue(null)] [System.Configuration.SettingsSerializeAs(System.Configuration.SettingsSerializeAs.Binary)] - public System.Net.Cookie Cookie + public System.Net.CookieContainer Cookies { get { - if (this["Cookie"] == null) + if (this["Cookies"] == null) return null; - return (System.Net.Cookie)this["Cookie"]; + return (System.Net.CookieContainer)this["Cookies"]; } - set { this["Cookie"] = value; } + set { this["Cookies"] = value; } } + //[System.Configuration.UserScopedSettingAttribute()] + //[System.Configuration.SettingsDescription("Cookie collection as login session")] + //[System.Configuration.DefaultSettingValue(null)] + //[System.Configuration.SettingsSerializeAs(System.Configuration.SettingsSerializeAs.Binary)] + //public System.Collections.Generic.Dictionary Cookies + //{ + // get + // { + // if (this["Cookies"] == null) + // return null; + // return (System.Collections.Generic.Dictionary)this["Cookies"]; + // } + // set { this["Cookies"] = value; } + //} + + [System.Configuration.UserScopedSettingAttribute()] [System.Configuration.SettingsDescription("UpdateIntervalUnit")] [System.Configuration.DefaultSettingValueAttribute("0")] diff --git a/KsGameLauncher/Utils/AppUtil.cs b/KsGameLauncher/Utils/AppUtil.cs index beb07d9..5449e6d 100644 --- a/KsGameLauncher/Utils/AppUtil.cs +++ b/KsGameLauncher/Utils/AppUtil.cs @@ -100,7 +100,7 @@ internal static void CheckUpdate() AutoUpdater.RunUpdateAsAdmin = false; AutoUpdater.Start(Properties.Resources.UpdateXML, typeof(Program).Assembly); #if DEBUG - Debug.WriteLine(String.Format("[CheckUpdate {0}] Done called", DateTime.Now)); + Debug.WriteLine(String.Format("[CheckUpdate {0}] Done", DateTime.Now)); #endif } From 5c6c0dc4cc0ac7a0f7d3d04f43a110e61dfd8657 Mon Sep 17 00:00:00 2001 From: anon Date: Thu, 28 Jul 2022 02:45:14 +0900 Subject: [PATCH 4/5] Fix bug while login #28 - Change login URL --- KsGameLauncher/App.config | 2 +- KsGameLauncher/Launcher.cs | 20 ++++++++----------- .../Properties/Settings.Designer.cs | 2 +- KsGameLauncher/Properties/Settings.settings | 2 +- KsGameLauncher/Properties/Strings.Designer.cs | 18 ++++++++--------- KsGameLauncher/Properties/Strings.en-US.resx | 3 +++ KsGameLauncher/Properties/Strings.ja-JP.resx | 3 +++ KsGameLauncher/Properties/Strings.resx | 3 +++ 8 files changed, 29 insertions(+), 24 deletions(-) diff --git a/KsGameLauncher/App.config b/KsGameLauncher/App.config index d9e69f5..7221b42 100644 --- a/KsGameLauncher/App.config +++ b/KsGameLauncher/App.config @@ -22,7 +22,7 @@ https://p.eagate.573.jp/gate/p/logout.html - https://p.eagate.573.jp/gate/k/API/common/getloginurl.html + https://p.eagate.573.jp/gate/p/login.html https://p.eagate.573.jp/game/konasteapp/ diff --git a/KsGameLauncher/Launcher.cs b/KsGameLauncher/Launcher.cs index b0e2449..0ed1739 100644 --- a/KsGameLauncher/Launcher.cs +++ b/KsGameLauncher/Launcher.cs @@ -318,19 +318,10 @@ private async Task GetLoginUri() using (var response = await httpClient.GetAsync(Properties.Settings.Default.LoginURL)) { response.EnsureSuccessStatusCode(); - - Stream stream = response.Content.ReadAsStreamAsync().Result; - Encoding enc = null; - if (response.Content.Headers.Contains("Content-Type")) - enc = EncodingMapJapanese(response.Content.Headers.ContentType.CharSet); - else - enc = Encoding.UTF8; - string content = ConvertEncoding(stream, enc); - - if (content == null || !content.StartsWith("https:")) + + if (response.StatusCode != HttpStatusCode.OK) throw new LoginUriException("Failed to get login URL"); - - return new Uri(content); + return response.RequestMessage.RequestUri; } } @@ -598,6 +589,11 @@ public async Task StartApp(AppInfo app) return; } } + catch (LoginUriException ex) + { + MessageBox.Show(Properties.Strings.FailedToGetAuthURL, Properties.Strings.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); + throw ex; + } catch (LoginCancelException ex) { // Canceled process diff --git a/KsGameLauncher/Properties/Settings.Designer.cs b/KsGameLauncher/Properties/Settings.Designer.cs index 7e2ac6a..e517061 100644 --- a/KsGameLauncher/Properties/Settings.Designer.cs +++ b/KsGameLauncher/Properties/Settings.Designer.cs @@ -128,7 +128,7 @@ public string LogoutURL { [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] - [global::System.Configuration.DefaultSettingValueAttribute("https://p.eagate.573.jp/gate/k/API/common/getloginurl.html")] + [global::System.Configuration.DefaultSettingValueAttribute("https://p.eagate.573.jp/gate/p/login.html")] public string LoginURL { get { return ((string)(this["LoginURL"])); diff --git a/KsGameLauncher/Properties/Settings.settings b/KsGameLauncher/Properties/Settings.settings index b64c2a1..09467e5 100644 --- a/KsGameLauncher/Properties/Settings.settings +++ b/KsGameLauncher/Properties/Settings.settings @@ -30,7 +30,7 @@ https://p.eagate.573.jp/gate/p/logout.html - https://p.eagate.573.jp/gate/k/API/common/getloginurl.html + https://p.eagate.573.jp/gate/p/login.html https://p.eagate.573.jp/game/konasteapp/ diff --git a/KsGameLauncher/Properties/Strings.Designer.cs b/KsGameLauncher/Properties/Strings.Designer.cs index cc35ff7..2be68db 100644 --- a/KsGameLauncher/Properties/Strings.Designer.cs +++ b/KsGameLauncher/Properties/Strings.Designer.cs @@ -528,6 +528,15 @@ internal static string ErrorWhileLogin { } } + /// + /// Failed to get authURL. This url was changed or removed from the servicve. に類似しているローカライズされた文字列を検索します。 + /// + internal static string FailedToGetAuthURL { + get { + return ResourceManager.GetString("FailedToGetAuthURL", resourceCulture); + } + } + /// /// Failed to load {0} に類似しているローカライズされた文字列を検索します。 /// @@ -771,15 +780,6 @@ internal static string PrivacyConfirmationExceptionDialogName { } } - /// - /// Run the game directly に類似しているローカライズされた文字列を検索します。 - /// - internal static string RunGameDirectly { - get { - return ResourceManager.GetString("RunGameDirectly", resourceCulture); - } - } - /// /// Service is temporarily down or unavailable. に類似しているローカライズされた文字列を検索します。 /// diff --git a/KsGameLauncher/Properties/Strings.en-US.resx b/KsGameLauncher/Properties/Strings.en-US.resx index d378ebf..cc3ae0f 100644 --- a/KsGameLauncher/Properties/Strings.en-US.resx +++ b/KsGameLauncher/Properties/Strings.en-US.resx @@ -289,6 +289,9 @@ This file may not exist or may be temporarily unavailable. Error has occrred while login + + Failed to get authURL. This url was changed or removed from the servicve. + Failed to load {0} {0} is JSON filename diff --git a/KsGameLauncher/Properties/Strings.ja-JP.resx b/KsGameLauncher/Properties/Strings.ja-JP.resx index e816c9e..7a087ed 100644 --- a/KsGameLauncher/Properties/Strings.ja-JP.resx +++ b/KsGameLauncher/Properties/Strings.ja-JP.resx @@ -432,4 +432,7 @@ プライバシーポリシーの更新 + + 認証URLの取得に失敗しました。URLは変更されたか、サービスから削除されました。 + \ No newline at end of file diff --git a/KsGameLauncher/Properties/Strings.resx b/KsGameLauncher/Properties/Strings.resx index d0c3445..898f210 100644 --- a/KsGameLauncher/Properties/Strings.resx +++ b/KsGameLauncher/Properties/Strings.resx @@ -437,4 +437,7 @@ Do you want to display maintenance information? Privacy policy update + + Failed to get authURL. This url was changed or removed from the servicve. + \ No newline at end of file From a497fe039483f99f2c8b309131d085eb08c7623c Mon Sep 17 00:00:00 2001 From: anon Date: Thu, 28 Jul 2022 02:45:39 +0900 Subject: [PATCH 5/5] Minor changes for development --- KsGameLauncher/Forms/OptionsForm.Designer.cs | 70 ++++++++++---------- KsGameLauncher/Forms/OptionsForm.cs | 10 ++- KsGameLauncher/Program.cs | 10 ++- KsGameLauncher/Utils/AppUtil.cs | 14 +++- 4 files changed, 59 insertions(+), 45 deletions(-) diff --git a/KsGameLauncher/Forms/OptionsForm.Designer.cs b/KsGameLauncher/Forms/OptionsForm.Designer.cs index 0f5925e..51986f1 100644 --- a/KsGameLauncher/Forms/OptionsForm.Designer.cs +++ b/KsGameLauncher/Forms/OptionsForm.Designer.cs @@ -48,9 +48,10 @@ private void InitializeComponent() // checkBox_UseProxy // this.checkBox_UseProxy.AutoSize = true; - this.checkBox_UseProxy.Location = new System.Drawing.Point(15, 98); + this.checkBox_UseProxy.Location = new System.Drawing.Point(10, 65); + this.checkBox_UseProxy.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.checkBox_UseProxy.Name = "checkBox_UseProxy"; - this.checkBox_UseProxy.Size = new System.Drawing.Size(109, 22); + this.checkBox_UseProxy.Size = new System.Drawing.Size(102, 22); this.checkBox_UseProxy.TabIndex = 0; this.checkBox_UseProxy.Text = "Use proxy"; this.checkBox_UseProxy.UseVisualStyleBackColor = true; @@ -59,7 +60,8 @@ private void InitializeComponent() // this.linkLabel_OpenProxySettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.linkLabel_OpenProxySettings.AutoSize = true; - this.linkLabel_OpenProxySettings.Location = new System.Drawing.Point(160, 122); + this.linkLabel_OpenProxySettings.Location = new System.Drawing.Point(107, 81); + this.linkLabel_OpenProxySettings.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.linkLabel_OpenProxySettings.Name = "linkLabel_OpenProxySettings"; this.linkLabel_OpenProxySettings.Size = new System.Drawing.Size(157, 18); this.linkLabel_OpenProxySettings.TabIndex = 1; @@ -71,9 +73,10 @@ private void InitializeComponent() // button_Save // this.button_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button_Save.Location = new System.Drawing.Point(249, 511); + this.button_Save.Location = new System.Drawing.Point(166, 341); + this.button_Save.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button_Save.Name = "button_Save"; - this.button_Save.Size = new System.Drawing.Size(81, 38); + this.button_Save.Size = new System.Drawing.Size(54, 25); this.button_Save.TabIndex = 3; this.button_Save.Text = "&Save"; this.button_Save.UseVisualStyleBackColor = true; @@ -84,10 +87,9 @@ private void InitializeComponent() this.checkBox_Notification.AutoSize = true; this.checkBox_Notification.Checked = true; this.checkBox_Notification.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBox_Notification.Location = new System.Drawing.Point(15, 148); - this.checkBox_Notification.Margin = new System.Windows.Forms.Padding(4); + this.checkBox_Notification.Location = new System.Drawing.Point(10, 99); this.checkBox_Notification.Name = "checkBox_Notification"; - this.checkBox_Notification.Size = new System.Drawing.Size(177, 22); + this.checkBox_Notification.Size = new System.Drawing.Size(170, 22); this.checkBox_Notification.TabIndex = 2; this.checkBox_Notification.Text = "Display notification"; this.checkBox_Notification.UseVisualStyleBackColor = true; @@ -97,10 +99,9 @@ private void InitializeComponent() this.checkBox_ConfirmExit.AutoSize = true; this.checkBox_ConfirmExit.Checked = true; this.checkBox_ConfirmExit.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBox_ConfirmExit.Location = new System.Drawing.Point(15, 182); - this.checkBox_ConfirmExit.Margin = new System.Windows.Forms.Padding(4); + this.checkBox_ConfirmExit.Location = new System.Drawing.Point(10, 121); this.checkBox_ConfirmExit.Name = "checkBox_ConfirmExit"; - this.checkBox_ConfirmExit.Size = new System.Drawing.Size(167, 22); + this.checkBox_ConfirmExit.Size = new System.Drawing.Size(160, 22); this.checkBox_ConfirmExit.TabIndex = 4; this.checkBox_ConfirmExit.Text = "Show confirm exit"; this.checkBox_ConfirmExit.UseVisualStyleBackColor = true; @@ -110,18 +111,16 @@ private void InitializeComponent() this.comboBox_ContextMenuSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.comboBox_ContextMenuSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox_ContextMenuSize.FormattingEnabled = true; - this.comboBox_ContextMenuSize.Location = new System.Drawing.Point(12, 284); - this.comboBox_ContextMenuSize.Margin = new System.Windows.Forms.Padding(4); + this.comboBox_ContextMenuSize.Location = new System.Drawing.Point(8, 189); this.comboBox_ContextMenuSize.Name = "comboBox_ContextMenuSize"; - this.comboBox_ContextMenuSize.Size = new System.Drawing.Size(180, 26); + this.comboBox_ContextMenuSize.Size = new System.Drawing.Size(121, 26); this.comboBox_ContextMenuSize.TabIndex = 5; // // label_ContextMenuSize // this.label_ContextMenuSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label_ContextMenuSize.AutoSize = true; - this.label_ContextMenuSize.Location = new System.Drawing.Point(12, 262); - this.label_ContextMenuSize.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_ContextMenuSize.Location = new System.Drawing.Point(8, 175); this.label_ContextMenuSize.Name = "label_ContextMenuSize"; this.label_ContextMenuSize.Size = new System.Drawing.Size(146, 18); this.label_ContextMenuSize.TabIndex = 6; @@ -130,10 +129,9 @@ private void InitializeComponent() // button_SyncAppInfo // this.button_SyncAppInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.button_SyncAppInfo.Location = new System.Drawing.Point(12, 324); - this.button_SyncAppInfo.Margin = new System.Windows.Forms.Padding(4); + this.button_SyncAppInfo.Location = new System.Drawing.Point(8, 216); this.button_SyncAppInfo.Name = "button_SyncAppInfo"; - this.button_SyncAppInfo.Size = new System.Drawing.Size(150, 34); + this.button_SyncAppInfo.Size = new System.Drawing.Size(100, 23); this.button_SyncAppInfo.TabIndex = 7; this.button_SyncAppInfo.TabStop = false; this.button_SyncAppInfo.Text = "Sync with server"; @@ -145,10 +143,9 @@ private void InitializeComponent() this.checkBox_DisplayInstalledGamesOnly.AutoSize = true; this.checkBox_DisplayInstalledGamesOnly.Checked = true; this.checkBox_DisplayInstalledGamesOnly.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBox_DisplayInstalledGamesOnly.Location = new System.Drawing.Point(15, 214); - this.checkBox_DisplayInstalledGamesOnly.Margin = new System.Windows.Forms.Padding(4); + this.checkBox_DisplayInstalledGamesOnly.Location = new System.Drawing.Point(10, 143); this.checkBox_DisplayInstalledGamesOnly.Name = "checkBox_DisplayInstalledGamesOnly"; - this.checkBox_DisplayInstalledGamesOnly.Size = new System.Drawing.Size(244, 22); + this.checkBox_DisplayInstalledGamesOnly.Size = new System.Drawing.Size(237, 22); this.checkBox_DisplayInstalledGamesOnly.TabIndex = 4; this.checkBox_DisplayInstalledGamesOnly.Text = "Display installed games only"; this.checkBox_DisplayInstalledGamesOnly.UseVisualStyleBackColor = true; @@ -159,8 +156,7 @@ private void InitializeComponent() this.checkBox_RegisterCustomURI.Appearance = System.Windows.Forms.Appearance.Button; this.checkBox_RegisterCustomURI.AutoSize = true; this.checkBox_RegisterCustomURI.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.checkBox_RegisterCustomURI.Location = new System.Drawing.Point(12, 372); - this.checkBox_RegisterCustomURI.Margin = new System.Windows.Forms.Padding(4); + this.checkBox_RegisterCustomURI.Location = new System.Drawing.Point(8, 239); this.checkBox_RegisterCustomURI.Name = "checkBox_RegisterCustomURI"; this.checkBox_RegisterCustomURI.Size = new System.Drawing.Size(173, 28); this.checkBox_RegisterCustomURI.TabIndex = 8; @@ -172,17 +168,15 @@ private void InitializeComponent() // this.comboBox_Languages.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox_Languages.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.comboBox_Languages.Location = new System.Drawing.Point(15, 45); - this.comboBox_Languages.Margin = new System.Windows.Forms.Padding(4); + this.comboBox_Languages.Location = new System.Drawing.Point(10, 30); this.comboBox_Languages.Name = "comboBox_Languages"; - this.comboBox_Languages.Size = new System.Drawing.Size(244, 26); + this.comboBox_Languages.Size = new System.Drawing.Size(164, 26); this.comboBox_Languages.TabIndex = 9; // // label_Language // this.label_Language.AutoSize = true; - this.label_Language.Location = new System.Drawing.Point(15, 18); - this.label_Language.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_Language.Location = new System.Drawing.Point(10, 12); this.label_Language.Name = "label_Language"; this.label_Language.Size = new System.Drawing.Size(79, 18); this.label_Language.TabIndex = 10; @@ -192,7 +186,8 @@ private void InitializeComponent() // this.label_CheckAutoUpdateInterval.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label_CheckAutoUpdateInterval.AutoSize = true; - this.label_CheckAutoUpdateInterval.Location = new System.Drawing.Point(12, 418); + this.label_CheckAutoUpdateInterval.Location = new System.Drawing.Point(8, 279); + this.label_CheckAutoUpdateInterval.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_CheckAutoUpdateInterval.Name = "label_CheckAutoUpdateInterval"; this.label_CheckAutoUpdateInterval.Size = new System.Drawing.Size(149, 18); this.label_CheckAutoUpdateInterval.TabIndex = 11; @@ -204,17 +199,19 @@ private void InitializeComponent() this.comboBox_CheckInterval.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox_CheckInterval.FlatStyle = System.Windows.Forms.FlatStyle.System; this.comboBox_CheckInterval.FormattingEnabled = true; - this.comboBox_CheckInterval.Location = new System.Drawing.Point(12, 439); + this.comboBox_CheckInterval.Location = new System.Drawing.Point(8, 293); + this.comboBox_CheckInterval.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.comboBox_CheckInterval.Name = "comboBox_CheckInterval"; - this.comboBox_CheckInterval.Size = new System.Drawing.Size(219, 26); + this.comboBox_CheckInterval.Size = new System.Drawing.Size(147, 26); this.comboBox_CheckInterval.TabIndex = 12; // // button_ManualCheck // this.button_ManualCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.button_ManualCheck.Location = new System.Drawing.Point(12, 471); + this.button_ManualCheck.Location = new System.Drawing.Point(8, 314); + this.button_ManualCheck.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button_ManualCheck.Name = "button_ManualCheck"; - this.button_ManualCheck.Size = new System.Drawing.Size(146, 35); + this.button_ManualCheck.Size = new System.Drawing.Size(97, 23); this.button_ManualCheck.TabIndex = 13; this.button_ManualCheck.Text = "Manual check"; this.button_ManualCheck.UseVisualStyleBackColor = true; @@ -223,9 +220,9 @@ private void InitializeComponent() // OptionsForm // this.AcceptButton = this.button_Save; - this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(340, 560); + this.ClientSize = new System.Drawing.Size(227, 373); this.Controls.Add(this.button_ManualCheck); this.Controls.Add(this.comboBox_CheckInterval); this.Controls.Add(this.label_CheckAutoUpdateInterval); @@ -242,6 +239,7 @@ private void InitializeComponent() this.Controls.Add(this.linkLabel_OpenProxySettings); this.Controls.Add(this.checkBox_UseProxy); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "OptionsForm"; diff --git a/KsGameLauncher/Forms/OptionsForm.cs b/KsGameLauncher/Forms/OptionsForm.cs index 2aaf3fe..4089ccf 100644 --- a/KsGameLauncher/Forms/OptionsForm.cs +++ b/KsGameLauncher/Forms/OptionsForm.cs @@ -228,9 +228,13 @@ private void CheckBox_RegisterCustomURI_Click(object sender, EventArgs e) { DialogResult dialogResult; CheckState state = ((CheckBox)sender).CheckState; + string appScheme = Properties.Settings.Default.AppUriScheme; +#if DEBUG + appScheme = String.Format("{0}.dev", appScheme); +#endif if (state == CheckState.Checked) { - string message = string.Format(Properties.Strings.ConfirmRegisterCustomURI, Properties.Settings.Default.AppUriScheme); + string message = string.Format(Properties.Strings.ConfirmRegisterCustomURI, appScheme); dialogResult = MessageBox.Show(message, Properties.Strings.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); if (dialogResult == DialogResult.Yes) @@ -238,7 +242,7 @@ private void CheckBox_RegisterCustomURI_Click(object sender, EventArgs e) // Enable shortcut launch mode / Register custom URI scheme AppUtil.RegisterScheme(); checkBox_RegisterCustomURI.Text = Properties.Strings.ShortcutLaunchCheckboxDisable; - Properties.Settings.Default.RegisterCustomURI = (state == CheckState.Checked); + Properties.Settings.Default.RegisterCustomURI = state == CheckState.Checked; Properties.Settings.Default.Save(); MessageBox.Show(Properties.Strings.Enabled, Properties.Strings.AppName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } @@ -254,7 +258,7 @@ private void CheckBox_RegisterCustomURI_Click(object sender, EventArgs e) // Disable shortcut launch mode / Remove custom URI scheme AppUtil.DeleteScheme(); checkBox_RegisterCustomURI.Text = Properties.Strings.ShortcutLaunchCheckboxEnable; - Properties.Settings.Default.RegisterCustomURI = (state == CheckState.Checked); + Properties.Settings.Default.RegisterCustomURI = state == CheckState.Checked; Properties.Settings.Default.Save(); MessageBox.Show(Properties.Strings.Disabled, Properties.Strings.AppName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } diff --git a/KsGameLauncher/Program.cs b/KsGameLauncher/Program.cs index 184e714..b65d680 100644 --- a/KsGameLauncher/Program.cs +++ b/KsGameLauncher/Program.cs @@ -147,7 +147,11 @@ static void Main(string[] args) /// Custom URI starts with `Properties.Settings.Default.AppUriScheme` static async Task ProcessUri(Uri uri) { - if (string.Equals(uri.Scheme, Properties.Settings.Default.AppUriScheme, StringComparison.OrdinalIgnoreCase)) + string appScheme = Properties.Settings.Default.AppUriScheme; +#if DEBUG + appScheme = string.Format("{0}.dev", Properties.Settings.Default.AppUriScheme); +#endif + if (string.Equals(uri.Scheme, appScheme, StringComparison.OrdinalIgnoreCase)) { #if DEBUG @@ -179,7 +183,7 @@ static async Task ProcessUri(Uri uri) } - #region isLoaded() +#region isLoaded() /// /// Does it has been already running /// @@ -196,6 +200,6 @@ private static bool IsLoaded() } return false; } - #endregion +#endregion } } diff --git a/KsGameLauncher/Utils/AppUtil.cs b/KsGameLauncher/Utils/AppUtil.cs index 5449e6d..2b5ce78 100644 --- a/KsGameLauncher/Utils/AppUtil.cs +++ b/KsGameLauncher/Utils/AppUtil.cs @@ -52,13 +52,17 @@ internal static void RegisterScheme() try { //using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(Properties.Settings.Default.AppCustomURIScheme); - using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Classes\" + Properties.Settings.Default.AppUriScheme)) + string appScheme = Properties.Settings.Default.AppUriScheme; +#if DEBUG + appScheme = string.Format("{0}.dev", appScheme); +#endif + using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Classes\" + appScheme)) { // Replace typeof(App) by the class that contains the Main method or any class located in the project that produces the exe. // or replace typeof(App).Assembly.Location by anything that gives the full path to the exe string appLocation = Assembly.GetExecutingAssembly().Location; - key.SetValue("", "URL:" + Properties.Settings.Default.AppUriScheme); + key.SetValue("", "URL:" + appScheme); key.SetValue("URL Protocol", ""); using (RegistryKey defaultIcon = key.CreateSubKey("DefaultIcon")) @@ -83,8 +87,12 @@ internal static void DeleteScheme() { try { + string appScheme = Properties.Settings.Default.AppUriScheme; +#if DEBUG + appScheme = string.Format("{0}.dev", appScheme); +#endif // Remove keys about URI Scheme for this program - Registry.CurrentUser.DeleteSubKeyTree(@"SOFTWARE\Classes\" + Properties.Settings.Default.AppUriScheme); + Registry.CurrentUser.DeleteSubKeyTree(@"SOFTWARE\Classes\" + appScheme); } catch (ObjectDisposedException) { } catch (ArgumentException) { }