From ca77d3127a6c936a0460e5fb9e2f7a5331015bd0 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Thu, 24 May 2018 02:16:12 +0900 Subject: [PATCH] =?utf8?q?=E3=82=A2=E3=83=97=E3=83=AA=E3=82=B1=E3=83=BC?= =?utf8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E5=90=8D=E3=82=92=E8=A1=A8=E3=81=99?= =?utf8?q?=20ApplicationSettings.ApplicationName=20=E3=82=92=E8=BF=BD?= =?utf8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween/ApplicationEvents.cs | 14 +++++++------- OpenTween/ApplicationSettings.cs | 9 +++++++++ OpenTween/ListManage.cs | 4 ++-- OpenTween/MyCommon.cs | 2 +- OpenTween/SendErrorReportForm.cs | 2 +- OpenTween/Tween.cs | 34 +++++++++++++++++----------------- OpenTween/TweenAboutBox.cs | 2 +- OpenTween/UserInfoDialog.cs | 2 +- 8 files changed, 39 insertions(+), 30 deletions(-) diff --git a/OpenTween/ApplicationEvents.cs b/OpenTween/ApplicationEvents.cs index 628cea82..3023ef1e 100644 --- a/OpenTween/ApplicationEvents.cs +++ b/OpenTween/ApplicationEvents.cs @@ -66,7 +66,7 @@ namespace OpenTween if (!CheckRuntimeVersion()) { var message = string.Format(Properties.Resources.CheckRuntimeVersion_Error, ".NET Framework 4.5.1"); - MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(message, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; } @@ -129,8 +129,8 @@ namespace OpenTween var principal = new WindowsPrincipal(currentIdentity); if (principal.IsInRole(WindowsBuiltInRole.Administrator)) { - var message = string.Format(Properties.Resources.WarnIfRunAsAdministrator_Message, Application.ProductName); - MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); + var message = string.Format(Properties.Resources.WarnIfRunAsAdministrator_Message, ApplicationSettings.ApplicationName); + MessageBox.Show(message, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } @@ -181,7 +181,7 @@ namespace OpenTween return; } - IntPtr windowHandle = NativeMethods.GetWindowHandle((uint)prevProcess.Id, Application.ProductName); + IntPtr windowHandle = NativeMethods.GetWindowHandle((uint)prevProcess.Id, ApplicationSettings.ApplicationName); if (windowHandle != IntPtr.Zero) { NativeMethods.SetActiveWindow(windowHandle); @@ -291,7 +291,7 @@ namespace OpenTween if (!Directory.Exists(configDir)) { var text = string.Format(Properties.Resources.ConfigDirectoryNotExist, configDir); - MessageBox.Show(text, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(text, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } @@ -317,7 +317,7 @@ namespace OpenTween var roamingDir = Path.Combine(new[] { Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), - Application.ProductName, + ApplicationSettings.ApplicationName, }); Directory.CreateDirectory(roamingDir); @@ -359,7 +359,7 @@ namespace OpenTween { // StartupPath に設定ファイルが存在し、Roaming 内のファイルよりも新しい場合のみ警告を表示する var message = string.Format(Properties.Resources.SettingPath_Relocation, Application.StartupPath, MyCommon.settingPath); - MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show(message, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } // Roaming に設定ファイルを作成 (StartupPath に読み込みに成功した設定ファイルがあれば内容がコピーされる) diff --git a/OpenTween/ApplicationSettings.cs b/OpenTween/ApplicationSettings.cs index 1f487c5a..4c727155 100644 --- a/OpenTween/ApplicationSettings.cs +++ b/OpenTween/ApplicationSettings.cs @@ -23,6 +23,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Windows.Forms; namespace OpenTween { @@ -35,6 +36,14 @@ namespace OpenTween internal static class ApplicationSettings { //===================================================================== + // アプリケーション情報 + + /// + /// アプリケーション名 + /// + public static string ApplicationName => Application.ProductName; + + //===================================================================== // フィードバック送信先 // 異常終了時などにエラーログ等とともに表示されます。 diff --git a/OpenTween/ListManage.cs b/OpenTween/ListManage.cs index ec06f75d..626e42cd 100644 --- a/OpenTween/ListManage.cs +++ b/OpenTween/ListManage.cs @@ -229,7 +229,7 @@ namespace OpenTween { ListElement list = (ListElement)this.ListsList.SelectedItem; UserInfo user = (UserInfo)this.UserList.SelectedItem; - if (MessageBox.Show(Properties.Resources.ListManageDeleteUser1, Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK) + if (MessageBox.Show(Properties.Resources.ListManageDeleteUser1, ApplicationSettings.ApplicationName, MessageBoxButtons.OKCancel) == DialogResult.OK) { try { @@ -258,7 +258,7 @@ namespace OpenTween { ListElement list = (ListElement)this.ListsList.SelectedItem; - if (MessageBox.Show(Properties.Resources.ListManageDeleteLists1, Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK) + if (MessageBox.Show(Properties.Resources.ListManageDeleteLists1, ApplicationSettings.ApplicationName, MessageBoxButtons.OKCancel) == DialogResult.OK) { try { diff --git a/OpenTween/MyCommon.cs b/OpenTween/MyCommon.cs index e3a3084d..b68d3524 100644 --- a/OpenTween/MyCommon.cs +++ b/OpenTween/MyCommon.cs @@ -903,7 +903,7 @@ namespace OpenTween /// 置換後の文字列 public static string ReplaceAppName(string orig) { - return MyCommon.ReplaceAppName(orig, Application.ProductName); + return MyCommon.ReplaceAppName(orig, ApplicationSettings.ApplicationName); } /// diff --git a/OpenTween/SendErrorReportForm.cs b/OpenTween/SendErrorReportForm.cs index ab6a8fb2..731b08a3 100644 --- a/OpenTween/SendErrorReportForm.cs +++ b/OpenTween/SendErrorReportForm.cs @@ -156,7 +156,7 @@ namespace OpenTween public async Task SendByMailAsync() { var toAddress = ApplicationSettings.FeedbackEmailAddress; - var subject = $"{Application.ProductName} {MyCommon.GetReadableVersion()} エラーログ"; + var subject = $"{ApplicationSettings.ApplicationName} {MyCommon.GetReadableVersion()} エラーログ"; var body = this.ReportText; var mailto = $"mailto:{Uri.EscapeDataString(toAddress)}?subject={Uri.EscapeDataString(subject)}&body={Uri.EscapeDataString(body)}"; diff --git a/OpenTween/Tween.cs b/OpenTween/Tween.cs index de961c73..27322676 100644 --- a/OpenTween/Tween.cs +++ b/OpenTween/Tween.cs @@ -117,7 +117,7 @@ namespace OpenTween private Twitter tw; //Growl呼び出し部 - private GrowlHelper gh = new GrowlHelper(Application.ProductName); + private GrowlHelper gh = new GrowlHelper(ApplicationSettings.ApplicationName); //サブ画面インスタンス internal SearchWordDialog SearchDialog = new SearchWordDialog(); //検索画面インスタンス @@ -828,7 +828,7 @@ namespace OpenTween catch (WebApiException ex) { MessageBox.Show(this, string.Format(Properties.Resources.StartupAuthError_Text, ex.Message), - Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); + ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } //サムネイル関連の初期化 @@ -1782,7 +1782,7 @@ namespace OpenTween { //NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning; //NotifyIcon1.BalloonTipTitle += Application.ProductName + " [DM] " + Properties.Resources.RefreshDirectMessageText1 + " " + addCount.ToString() + Properties.Resources.RefreshDirectMessageText2; - title.Append(Application.ProductName); + title.Append(ApplicationSettings.ApplicationName); title.Append(" [DM] "); title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount); nt = GrowlHelper.NotifyType.DirectMessage; @@ -1791,7 +1791,7 @@ namespace OpenTween { //NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning; //NotifyIcon1.BalloonTipTitle += Application.ProductName + " [Reply!] " + Properties.Resources.RefreshTimelineText1 + " " + addCount.ToString() + Properties.Resources.RefreshTimelineText2; - title.Append(Application.ProductName); + title.Append(ApplicationSettings.ApplicationName); title.Append(" [Reply!] "); title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount); nt = GrowlHelper.NotifyType.Reply; @@ -1800,7 +1800,7 @@ namespace OpenTween { //NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info; //NotifyIcon1.BalloonTipTitle += Application.ProductName + " " + Properties.Resources.RefreshTimelineText1 + " " + addCount.ToString() + Properties.Resources.RefreshTimelineText2; - title.Append(Application.ProductName); + title.Append(ApplicationSettings.ApplicationName); title.Append(" "); title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount); nt = GrowlHelper.NotifyType.Notify; @@ -1851,7 +1851,7 @@ namespace OpenTween //NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning; //NotifyIcon1.BalloonTipTitle += Application.ProductName + " [DM] " + Properties.Resources.RefreshDirectMessageText1 + " " + addCount.ToString() + Properties.Resources.RefreshDirectMessageText2; ntIcon = ToolTipIcon.Warning; - title.Append(Application.ProductName); + title.Append(ApplicationSettings.ApplicationName); title.Append(" [DM] "); title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount); } @@ -1860,7 +1860,7 @@ namespace OpenTween //NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning; //NotifyIcon1.BalloonTipTitle += Application.ProductName + " [Reply!] " + Properties.Resources.RefreshTimelineText1 + " " + addCount.ToString() + Properties.Resources.RefreshTimelineText2; ntIcon = ToolTipIcon.Warning; - title.Append(Application.ProductName); + title.Append(ApplicationSettings.ApplicationName); title.Append(" [Reply!] "); title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount); } @@ -1869,7 +1869,7 @@ namespace OpenTween //NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info; //NotifyIcon1.BalloonTipTitle += Application.ProductName + " " + Properties.Resources.RefreshTimelineText1 + " " + addCount.ToString() + Properties.Resources.RefreshTimelineText2; ntIcon = ToolTipIcon.Info; - title.Append(Application.ProductName); + title.Append(ApplicationSettings.ApplicationName); title.Append(" "); title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount); } @@ -2104,7 +2104,7 @@ namespace OpenTween if (TextContainsOnlyMentions(this.StatusText.Text)) { var message = string.Format(Properties.Resources.PostConfirmText, this.StatusText.Text); - var ret = MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); + var ret = MessageBox.Show(message, ApplicationSettings.ApplicationName, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (ret != DialogResult.OK) return; @@ -5549,7 +5549,7 @@ namespace OpenTween } catch (TabException ex) { - MessageBox.Show(this, ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, ex.Message, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); } var resultTab = new LocalSearchTabModel(tabName); @@ -7508,7 +7508,7 @@ namespace OpenTween } catch (TabException ex) { - MessageBox.Show(this, ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, ex.Message, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -8871,7 +8871,7 @@ namespace OpenTween } if (SettingManager.Common.DispUsername) ttl.Append(tw.Username).Append(" - "); - ttl.Append(Application.ProductName); + ttl.Append(ApplicationSettings.ApplicationName); ttl.Append(" "); switch (SettingManager.Common.DispLatestPost) { @@ -9111,7 +9111,7 @@ namespace OpenTween ur.Append(tw.Username); ur.Append(" - "); } - ur.Append(Application.ProductName); + ur.Append(ApplicationSettings.ApplicationName); #if DEBUG ur.Append("(Debug Build)"); #endif @@ -9371,7 +9371,7 @@ namespace OpenTween if (string.IsNullOrEmpty(SettingManager.Common.BitlyAccessToken) && (string.IsNullOrEmpty(SettingManager.Common.BilyUser) || string.IsNullOrEmpty(SettingManager.Common.BitlyPwd))) { - MessageBox.Show(this, Properties.Resources.UrlConvert_BitlyAuthRequired, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageBox.Show(this, Properties.Resources.UrlConvert_BitlyAuthRequired, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } } @@ -11626,7 +11626,7 @@ namespace OpenTween } catch (TabException ex) { - MessageBox.Show(this, ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, ex.Message, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } @@ -11905,7 +11905,7 @@ namespace OpenTween { //title.Clear(); } - title.Append(Application.ProductName); + title.Append(ApplicationSettings.ApplicationName); title.Append(" ["); title.Append(ev.Event.ToUpper(CultureInfo.CurrentCulture)); title.Append("] by "); @@ -12063,7 +12063,7 @@ namespace OpenTween } catch (Exception) { - MessageBox.Show("Failed to restart. Please run " + Application.ProductName + " manually."); + MessageBox.Show("Failed to restart. Please run " + ApplicationSettings.ApplicationName + " manually."); } } diff --git a/OpenTween/TweenAboutBox.cs b/OpenTween/TweenAboutBox.cs index f11add3d..ef2ba022 100644 --- a/OpenTween/TweenAboutBox.cs +++ b/OpenTween/TweenAboutBox.cs @@ -51,7 +51,7 @@ namespace OpenTween // バージョン情報ボックスに表示されたテキストをすべて初期化します。 // TODO: [プロジェクト] メニューの下にある [プロジェクト プロパティ] ダイアログの [アプリケーション] ペインで、アプリケーションのアセンブリ情報を // カスタマイズします。 - this.LabelProductName.Text = Application.ProductName; + this.LabelProductName.Text = ApplicationSettings.ApplicationName; this.LabelVersion.Text = String.Format(Properties.Resources.TweenAboutBox_LoadText2, MyCommon.GetReadableVersion()); this.LabelCopyright.Text = GetApplicationAttribute().Copyright; this.LabelCompanyName.Text = Application.CompanyName; diff --git a/OpenTween/UserInfoDialog.cs b/OpenTween/UserInfoDialog.cs index a87603d4..d2fbb060 100644 --- a/OpenTween/UserInfoDialog.cs +++ b/OpenTween/UserInfoDialog.cs @@ -725,7 +725,7 @@ namespace OpenTween !e.Data.GetDataPresent(DataFormats.Html, false)) // WebBrowserコントロールからの絵文字画像D&Dは弾く { var ret = MessageBox.Show(this, Properties.Resources.ChangeIconToolStripMenuItem_Confirm, - Application.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); + ApplicationSettings.ApplicationName, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (ret != DialogResult.OK) return; -- 2.11.0