OSDN Git Service

アセンブリ名を表す ApplicationSettings.AssemblyName を追加
authorKimura Youichi <kim.upsilon@bucyou.net>
Wed, 23 May 2018 17:16:12 +0000 (02:16 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Fri, 25 May 2018 02:56:46 +0000 (11:56 +0900)
OpenTween/ApplicationEvents.cs
OpenTween/ApplicationSettings.cs
OpenTween/Connection/Networking.cs
OpenTween/EventViewerDialog.cs
OpenTween/MyCommon.cs
OpenTween/Setting/SettingBase.cs
OpenTween/Tween.cs

index 3023ef1..88bf4da 100644 (file)
@@ -80,12 +80,12 @@ namespace OpenTween
             InitCulture();
 
             // 同じ設定ファイルを使用する OpenTween プロセスの二重起動を防止する
-            string pt = MyCommon.settingPath.Replace("\\", "/") + "/" + Application.ProductName;
+            string pt = MyCommon.settingPath.Replace("\\", "/") + "/" + ApplicationSettings.AssemblyName;
             using (Mutex mt = new Mutex(false, pt))
             {
                 if (!mt.WaitOne(0, false))
                 {
-                    var text = string.Format(MyCommon.ReplaceAppName(Properties.Resources.StartupText1), MyCommon.GetAssemblyName());
+                    var text = string.Format(MyCommon.ReplaceAppName(Properties.Resources.StartupText1), ApplicationSettings.AssemblyName);
                     MessageBox.Show(text, MyCommon.ReplaceAppName(Properties.Resources.StartupText2), MessageBoxButtons.OK, MessageBoxIcon.Information);
 
                     TryActivatePreviousWindow();
index 4c72715..425d0f9 100644 (file)
@@ -41,8 +41,17 @@ namespace OpenTween
         /// <summary>
         /// アプリケーション名
         /// </summary>
+        /// <remarks>
+        /// 派生版のアプリケーションでは名前にマルチバイト文字を含む場合があります。
+        /// ファイル名など英数字のみを含めたい用途ではこのプロパティではなく <see cref="AssemblyName"/> を使用します
+        /// </remarks>
         public static string ApplicationName => Application.ProductName;
 
+        /// <summary>
+        /// アセンブリ名
+        /// </summary>
+        public static string AssemblyName => MyCommon.GetAssemblyName();
+
         //=====================================================================
         // フィードバック送信先
         // 異常終了時などにエラーログ等とともに表示されます。
index 86e7142..a60a77d 100644 (file)
@@ -189,9 +189,9 @@ namespace OpenTween.Connection
         public static string GetUserAgentString(bool fakeMSIE = false)
         {
             if (fakeMSIE)
-                return MyCommon.GetAssemblyName() + "/" + MyCommon.FileVersion + " (compatible; MSIE 10.0)";
+                return ApplicationSettings.AssemblyName + "/" + MyCommon.FileVersion + " (compatible; MSIE 10.0)";
             else
-                return MyCommon.GetAssemblyName() + "/" + MyCommon.FileVersion;
+                return ApplicationSettings.AssemblyName + "/" + MyCommon.FileVersion;
         }
 
         /// <summary>
index db571f8..a2de273 100644 (file)
@@ -253,10 +253,10 @@ namespace OpenTween
             switch (rslt)
             {
                 case DialogResult.Yes:
-                    SaveFileDialog1.FileName = $"{MyCommon.GetAssemblyName()}Events{_curTab.Tag}{DateTimeUtc.Now.ToLocalTime():yyMMdd-HHmmss}.tsv";
+                    SaveFileDialog1.FileName = $"{ApplicationSettings.AssemblyName}Events{_curTab.Tag}{DateTimeUtc.Now.ToLocalTime():yyMMdd-HHmmss}.tsv";
                     break;
                 case DialogResult.No:
-                    SaveFileDialog1.FileName = $"{MyCommon.GetAssemblyName()}Events{DateTimeUtc.Now.ToLocalTime():yyMMdd-HHmmss}.tsv";
+                    SaveFileDialog1.FileName = $"{ApplicationSettings.AssemblyName}Events{DateTimeUtc.Now.ToLocalTime():yyMMdd-HHmmss}.tsv";
                     break;
                 default:
                     return;
index b68d352..d2e6de2 100644 (file)
@@ -277,7 +277,7 @@ namespace OpenTween
                     Directory.CreateDirectory(logPath);
 
                 var now = DateTimeUtc.Now;
-                var fileName = $"{GetAssemblyName()}Trace-{now.ToLocalTime():yyyyMMdd-HHmmss}.log";
+                var fileName = $"{ApplicationSettings.AssemblyName}Trace-{now.ToLocalTime():yyyyMMdd-HHmmss}.log";
                 fileName = Path.Combine(logPath, fileName);
 
                 using (var writer = new StreamWriter(fileName))
@@ -289,7 +289,7 @@ namespace OpenTween
                     writer.WriteLine(Properties.Resources.TraceOutText3);
                     writer.WriteLine(Properties.Resources.TraceOutText4, Environment.OSVersion.VersionString);
                     writer.WriteLine(Properties.Resources.TraceOutText5, Environment.Version);
-                    writer.WriteLine(Properties.Resources.TraceOutText6, MyCommon.GetAssemblyName(), FileVersion);
+                    writer.WriteLine(Properties.Resources.TraceOutText6, ApplicationSettings.AssemblyName, FileVersion);
                     writer.WriteLine(Message);
                     writer.WriteLine();
                 }
@@ -403,7 +403,7 @@ namespace OpenTween
                     string.Format(Properties.Resources.UnhandledExceptionText4),
                     string.Format(Properties.Resources.UnhandledExceptionText5, Environment.OSVersion.VersionString),
                     string.Format(Properties.Resources.UnhandledExceptionText6, Environment.Version),
-                    string.Format(Properties.Resources.UnhandledExceptionText7, MyCommon.GetAssemblyName(), FileVersion),
+                    string.Format(Properties.Resources.UnhandledExceptionText7, ApplicationSettings.AssemblyName, FileVersion),
 
                     ExceptionOutMessage(ex, ref IsTerminatePermission));
 
@@ -411,7 +411,7 @@ namespace OpenTween
                 if (!Directory.Exists(logPath))
                     Directory.CreateDirectory(logPath);
 
-                var fileName = $"{GetAssemblyName()}-{now.ToLocalTime():yyyyMMdd-HHmmss}.log";
+                var fileName = $"{ApplicationSettings.AssemblyName}-{now.ToLocalTime():yyyyMMdd-HHmmss}.log";
                 using (var writer = new StreamWriter(Path.Combine(logPath, fileName)))
                 {
                     writer.Write(errorReport);
index 2ad58fd..fc42b4d 100644 (file)
@@ -80,7 +80,7 @@ namespace OpenTween
                 string backupFile = Path.Combine(
                         Path.Combine(
                             Application.StartupPath,
-                            MyCommon.GetAssemblyName() + "Backup1st"),
+                            ApplicationSettings.AssemblyName + "Backup1st"),
                         typeof(T).Name + FileId + ".xml");
                 if (File.Exists(backupFile))
                 {
index 2732267..7a89670 100644 (file)
@@ -7519,7 +7519,7 @@ namespace OpenTween
                     MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
             if (rslt == DialogResult.Cancel) return;
 
-            SaveFileDialog1.FileName = $"{MyCommon.GetAssemblyName()}Posts{DateTimeUtc.Now.ToLocalTime():yyMMdd-HHmmss}.tsv";
+            SaveFileDialog1.FileName = $"{ApplicationSettings.AssemblyName}Posts{DateTimeUtc.Now.ToLocalTime():yyMMdd-HHmmss}.tsv";
             SaveFileDialog1.InitialDirectory = Application.ExecutablePath;
             SaveFileDialog1.Filter = Properties.Resources.SaveLogMenuItem_ClickText3;
             SaveFileDialog1.FilterIndex = 0;