using System.ComponentModel; using System.Drawing; using System.IO; using System.Reflection; using System.Windows.Forms; using TeslaConsole.Properties; namespace TeslaConsole; internal class abtTeslaConsole : Form { private IContainer components; private Label labelProductName; private Label labelVersion; private Label labelCopyright; private Label labelCompanyName; private Button okButton; private PictureBox picLogo; private TextBox textBoxDescription; public string AssemblyTitle { get { object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), inherit: false); if (customAttributes.Length > 0) { AssemblyTitleAttribute assemblyTitleAttribute = (AssemblyTitleAttribute)customAttributes[0]; if (assemblyTitleAttribute.Title != "") { return assemblyTitleAttribute.Title; } } return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); } } public string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString(); public string AssemblyDescription { get { object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), inherit: false); if (customAttributes.Length == 0) { return ""; } return ((AssemblyDescriptionAttribute)customAttributes[0]).Description; } } public string AssemblyProduct { get { object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), inherit: false); if (customAttributes.Length == 0) { return ""; } return ((AssemblyProductAttribute)customAttributes[0]).Product; } } public string AssemblyCopyright { get { object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), inherit: false); if (customAttributes.Length == 0) { return ""; } return ((AssemblyCopyrightAttribute)customAttributes[0]).Copyright; } } public string AssemblyCompany { get { object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), inherit: false); if (customAttributes.Length == 0) { return ""; } return ((AssemblyCompanyAttribute)customAttributes[0]).Company; } } public abtTeslaConsole() { InitializeComponent(); Text = $"About {AssemblyTitle}"; labelProductName.Text = AssemblyProduct; labelVersion.Text = $"Version {AssemblyVersion}"; labelCopyright.Text = AssemblyCopyright; labelCompanyName.Text = AssemblyCompany; textBoxDescription.Text = AssemblyDescription; picLogo.Image = new Icon(Resources.swirl, 64, 64).ToBitmap(); } protected override void Dispose(bool disposing) { if (disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.labelProductName = new System.Windows.Forms.Label(); this.labelVersion = new System.Windows.Forms.Label(); this.labelCopyright = new System.Windows.Forms.Label(); this.labelCompanyName = new System.Windows.Forms.Label(); this.okButton = new System.Windows.Forms.Button(); this.picLogo = new System.Windows.Forms.PictureBox(); this.textBoxDescription = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)this.picLogo).BeginInit(); base.SuspendLayout(); this.labelProductName.AutoSize = true; this.labelProductName.Location = new System.Drawing.Point(85, 12); this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17); this.labelProductName.Name = "labelProductName"; this.labelProductName.Size = new System.Drawing.Size(74, 13); this.labelProductName.TabIndex = 19; this.labelProductName.Text = "Tesla Console"; this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.labelVersion.AutoSize = true; this.labelVersion.Location = new System.Drawing.Point(85, 31); this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17); this.labelVersion.Name = "labelVersion"; this.labelVersion.Size = new System.Drawing.Size(22, 13); this.labelVersion.TabIndex = 0; this.labelVersion.Text = "1.0"; this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.labelCopyright.AutoSize = true; this.labelCopyright.Location = new System.Drawing.Point(85, 50); this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17); this.labelCopyright.Name = "labelCopyright"; this.labelCopyright.Size = new System.Drawing.Size(90, 13); this.labelCopyright.TabIndex = 21; this.labelCopyright.Text = "Copyright © 2009"; this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.labelCompanyName.AutoSize = true; this.labelCompanyName.Location = new System.Drawing.Point(85, 69); this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17); this.labelCompanyName.Name = "labelCompanyName"; this.labelCompanyName.Size = new System.Drawing.Size(135, 13); this.labelCompanyName.TabIndex = 22; this.labelCompanyName.Text = "Virtual World Entertainment"; this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.okButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.okButton.Location = new System.Drawing.Point(358, 234); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 24; this.okButton.Text = "&OK"; this.picLogo.Location = new System.Drawing.Point(12, 12); this.picLogo.Name = "picLogo"; this.picLogo.Size = new System.Drawing.Size(64, 70); this.picLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.picLogo.TabIndex = 1; this.picLogo.TabStop = false; this.textBoxDescription.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; this.textBoxDescription.Location = new System.Drawing.Point(12, 88); this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.textBoxDescription.Multiline = true; this.textBoxDescription.Name = "textBoxDescription"; this.textBoxDescription.ReadOnly = true; this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBoxDescription.Size = new System.Drawing.Size(421, 140); this.textBoxDescription.TabIndex = 23; this.textBoxDescription.TabStop = false; base.AcceptButton = this.okButton; base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.ClientSize = new System.Drawing.Size(445, 269); base.Controls.Add(this.textBoxDescription); base.Controls.Add(this.labelCompanyName); base.Controls.Add(this.okButton); base.Controls.Add(this.labelCopyright); base.Controls.Add(this.labelVersion); base.Controls.Add(this.labelProductName); base.Controls.Add(this.picLogo); base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; base.MaximizeBox = false; base.MinimizeBox = false; base.Name = "abtTeslaConsole"; base.Padding = new System.Windows.Forms.Padding(9); base.ShowIcon = false; base.ShowInTaskbar = false; base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "About"; ((System.ComponentModel.ISupportInitialize)this.picLogo).EndInit(); base.ResumeLayout(false); base.PerformLayout(); } }