OSDN Git Service

シンプルな型名を使用する (IDE0049)
[opentween/open-tween.git] / OpenTween / TweenAboutBox.cs
1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 //           (c) 2008-2011 Moz (@syo68k)
4 //           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 //           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 //           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 //           (c) 2011      kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
9 // 
10 // This file is part of OpenTween.
11 // 
12 // This program is free software; you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 3 of the License, or (at your option)
15 // any later version.
16 // 
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 // for more details. 
21 // 
22 // You should have received a copy of the GNU General Public License along
23 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 // Boston, MA 02110-1301, USA.
26
27 using System;
28 using System.Collections.Generic;
29 using System.ComponentModel;
30 using System.Data;
31 using System.Drawing;
32 using System.Linq;
33 using System.Text;
34 using System.Windows.Forms;
35 using System.Reflection;
36
37 namespace OpenTween
38 {
39     public partial class TweenAboutBox : OTBaseForm
40     {
41         public TweenAboutBox()
42             => this.InitializeComponent();
43
44         private void TweenAboutBox_Load(object sender, EventArgs e)
45         {
46             // フォームのタイトルを設定します。
47             this.Text = MyCommon.ReplaceAppName(this.Text);
48
49             // バージョン情報ボックスに表示されたテキストをすべて初期化します。
50             // TODO: [プロジェクト] メニューの下にある [プロジェクト プロパティ] ダイアログの [アプリケーション] ペインで、アプリケーションのアセンブリ情報を 
51             //    カスタマイズします。
52             this.LabelProductName.Text = ApplicationSettings.ApplicationName;
53             this.LabelVersion.Text = string.Format(Properties.Resources.TweenAboutBox_LoadText2, MyCommon.GetReadableVersion());
54             this.LabelCopyright.Text = GetApplicationAttribute<AssemblyCopyrightAttribute>().Copyright;
55             this.LabelCompanyName.Text = Application.CompanyName;
56             this.TextBoxDescription.Text = GetApplicationAttribute<AssemblyDescriptionAttribute>().Description;
57             this.ChangeLog.Text = Properties.Resources.ChangeLog;
58             this.TextBoxDescription.Text = string.Format(Properties.Resources.Description, ApplicationSettings.FeedbackTwitterName, ApplicationSettings.FeedbackEmailAddress) + Environment.NewLine + Environment.NewLine
59                 + "This software was created by The OpenTween Project, based on Tween v1.1.0.0, which is licensed under GPLv3.";
60         }
61
62         protected T GetApplicationAttribute<T>() where T : Attribute
63         {
64             var currentAssembly = Assembly.GetExecutingAssembly();
65
66             return (T) Attribute.GetCustomAttribute(currentAssembly, typeof(T));
67         }
68
69         private void OKButton_Click(object sender, EventArgs e)
70             => this.Close();
71
72         private void TweenAboutBox_Shown(object sender, EventArgs e)
73             => this.OKButton.Focus();
74     }
75 }