v1.2
This commit is contained in:
510
FSI.BT.Tools/Global/UserInterface/AboutBox.Designer.cs
generated
Normal file
510
FSI.BT.Tools/Global/UserInterface/AboutBox.Designer.cs
generated
Normal file
@@ -0,0 +1,510 @@
|
||||
namespace FSI.BT.Tools.Global.UserInterface
|
||||
{
|
||||
internal partial class AboutBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox));
|
||||
this.buttonDetails = new System.Windows.Forms.Button();
|
||||
this.ImagePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.AppDateLabel = new System.Windows.Forms.Label();
|
||||
this.buttonSystemInfo = new System.Windows.Forms.Button();
|
||||
this.AppCopyrightLabel = new System.Windows.Forms.Label();
|
||||
this.AppVersionLabel = new System.Windows.Forms.Label();
|
||||
this.AppDescriptionLabel = new System.Windows.Forms.Label();
|
||||
this.GroupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.AppTitleLabel = new System.Windows.Forms.Label();
|
||||
this.buttonOk = new System.Windows.Forms.Button();
|
||||
this.MoreRichTextBox = new System.Windows.Forms.RichTextBox();
|
||||
this.TabPanelDetails = new System.Windows.Forms.TabControl();
|
||||
this.TabPageApplication = new System.Windows.Forms.TabPage();
|
||||
this.AppInfoListView = new System.Windows.Forms.ListView();
|
||||
this.colKey = new System.Windows.Forms.ColumnHeader();
|
||||
this.colValue = new System.Windows.Forms.ColumnHeader();
|
||||
this.TabPageAssemblies = new System.Windows.Forms.TabPage();
|
||||
this.AssemblyInfoListView = new System.Windows.Forms.ListView();
|
||||
this.colAssemblyName = new System.Windows.Forms.ColumnHeader();
|
||||
this.colAssemblyVersion = new System.Windows.Forms.ColumnHeader();
|
||||
this.colAssemblyBuilt = new System.Windows.Forms.ColumnHeader();
|
||||
this.colAssemblyCodeBase = new System.Windows.Forms.ColumnHeader();
|
||||
this.TabPageAssemblyDetails = new System.Windows.Forms.TabPage();
|
||||
this.AssemblyDetailsListView = new System.Windows.Forms.ListView();
|
||||
this.ColumnHeader1 = new System.Windows.Forms.ColumnHeader();
|
||||
this.ColumnHeader2 = new System.Windows.Forms.ColumnHeader();
|
||||
this.AssemblyNamesComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ImagePictureBox)).BeginInit();
|
||||
this.TabPanelDetails.SuspendLayout();
|
||||
this.TabPageApplication.SuspendLayout();
|
||||
this.TabPageAssemblies.SuspendLayout();
|
||||
this.TabPageAssemblyDetails.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.tableLayoutPanel4.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonDetails
|
||||
//
|
||||
this.buttonDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDetails.AutoSize = true;
|
||||
this.buttonDetails.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.buttonDetails.Location = new System.Drawing.Point(88, 3);
|
||||
this.buttonDetails.MinimumSize = new System.Drawing.Size(76, 23);
|
||||
this.buttonDetails.Name = "buttonDetails";
|
||||
this.buttonDetails.Size = new System.Drawing.Size(76, 25);
|
||||
this.buttonDetails.TabIndex = 25;
|
||||
this.buttonDetails.Text = "Details";
|
||||
this.buttonDetails.Click += new System.EventHandler(this.DetailsButton_Click);
|
||||
//
|
||||
// ImagePictureBox
|
||||
//
|
||||
this.ImagePictureBox.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("ImagePictureBox.BackgroundImage")));
|
||||
this.ImagePictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.ImagePictureBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.ImagePictureBox.Name = "ImagePictureBox";
|
||||
this.ImagePictureBox.Size = new System.Drawing.Size(36, 36);
|
||||
this.ImagePictureBox.TabIndex = 24;
|
||||
this.ImagePictureBox.TabStop = false;
|
||||
//
|
||||
// AppDateLabel
|
||||
//
|
||||
this.AppDateLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AppDateLabel.AutoSize = true;
|
||||
this.AppDateLabel.Location = new System.Drawing.Point(3, 82);
|
||||
this.AppDateLabel.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.AppDateLabel.Name = "AppDateLabel";
|
||||
this.AppDateLabel.Size = new System.Drawing.Size(383, 15);
|
||||
this.AppDateLabel.TabIndex = 23;
|
||||
this.AppDateLabel.Text = "Built on %builddate%";
|
||||
//
|
||||
// buttonSystemInfo
|
||||
//
|
||||
this.buttonSystemInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonSystemInfo.AutoSize = true;
|
||||
this.buttonSystemInfo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.buttonSystemInfo.Location = new System.Drawing.Point(3, 3);
|
||||
this.buttonSystemInfo.MinimumSize = new System.Drawing.Size(76, 23);
|
||||
this.buttonSystemInfo.Name = "buttonSystemInfo";
|
||||
this.buttonSystemInfo.Size = new System.Drawing.Size(79, 25);
|
||||
this.buttonSystemInfo.TabIndex = 22;
|
||||
this.buttonSystemInfo.Text = "System Info";
|
||||
this.buttonSystemInfo.Visible = false;
|
||||
this.buttonSystemInfo.Click += new System.EventHandler(this.SysInfoButton_Click);
|
||||
//
|
||||
// AppCopyrightLabel
|
||||
//
|
||||
this.AppCopyrightLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AppCopyrightLabel.AutoSize = true;
|
||||
this.AppCopyrightLabel.Location = new System.Drawing.Point(3, 103);
|
||||
this.AppCopyrightLabel.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.AppCopyrightLabel.Name = "AppCopyrightLabel";
|
||||
this.AppCopyrightLabel.Size = new System.Drawing.Size(383, 15);
|
||||
this.AppCopyrightLabel.TabIndex = 21;
|
||||
this.AppCopyrightLabel.Text = "Copyright © %year%, %company%";
|
||||
//
|
||||
// AppVersionLabel
|
||||
//
|
||||
this.AppVersionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AppVersionLabel.AutoSize = true;
|
||||
this.AppVersionLabel.Location = new System.Drawing.Point(3, 61);
|
||||
this.AppVersionLabel.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.AppVersionLabel.Name = "AppVersionLabel";
|
||||
this.AppVersionLabel.Size = new System.Drawing.Size(383, 15);
|
||||
this.AppVersionLabel.TabIndex = 20;
|
||||
this.AppVersionLabel.Text = "Version %version%";
|
||||
//
|
||||
// AppDescriptionLabel
|
||||
//
|
||||
this.AppDescriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AppDescriptionLabel.AutoSize = true;
|
||||
this.AppDescriptionLabel.Location = new System.Drawing.Point(3, 24);
|
||||
this.AppDescriptionLabel.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.AppDescriptionLabel.Name = "AppDescriptionLabel";
|
||||
this.AppDescriptionLabel.Size = new System.Drawing.Size(86, 15);
|
||||
this.AppDescriptionLabel.TabIndex = 19;
|
||||
this.AppDescriptionLabel.Text = "%description%";
|
||||
//
|
||||
// GroupBox1
|
||||
//
|
||||
this.GroupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.GroupBox1.Location = new System.Drawing.Point(3, 53);
|
||||
this.GroupBox1.Name = "GroupBox1";
|
||||
this.GroupBox1.Size = new System.Drawing.Size(383, 2);
|
||||
this.GroupBox1.TabIndex = 18;
|
||||
this.GroupBox1.TabStop = false;
|
||||
this.GroupBox1.Text = "GroupBox1";
|
||||
//
|
||||
// AppTitleLabel
|
||||
//
|
||||
this.AppTitleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AppTitleLabel.AutoSize = true;
|
||||
this.AppTitleLabel.Location = new System.Drawing.Point(3, 3);
|
||||
this.AppTitleLabel.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.AppTitleLabel.Name = "AppTitleLabel";
|
||||
this.AppTitleLabel.Size = new System.Drawing.Size(86, 15);
|
||||
this.AppTitleLabel.TabIndex = 17;
|
||||
this.AppTitleLabel.Text = "%title%";
|
||||
//
|
||||
// buttonOk
|
||||
//
|
||||
this.buttonOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOk.AutoSize = true;
|
||||
this.buttonOk.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.buttonOk.Location = new System.Drawing.Point(170, 3);
|
||||
this.buttonOk.MinimumSize = new System.Drawing.Size(76, 23);
|
||||
this.buttonOk.Name = "buttonOk";
|
||||
this.buttonOk.Size = new System.Drawing.Size(76, 25);
|
||||
this.buttonOk.TabIndex = 16;
|
||||
this.buttonOk.Text = "OK";
|
||||
//
|
||||
// MoreRichTextBox
|
||||
//
|
||||
this.MoreRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.MoreRichTextBox.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.MoreRichTextBox.Location = new System.Drawing.Point(3, 124);
|
||||
this.MoreRichTextBox.Name = "MoreRichTextBox";
|
||||
this.MoreRichTextBox.ReadOnly = true;
|
||||
this.MoreRichTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.MoreRichTextBox.Size = new System.Drawing.Size(383, 122);
|
||||
this.MoreRichTextBox.TabIndex = 26;
|
||||
this.MoreRichTextBox.Text = "%product% is %copyright%, %trademark%";
|
||||
this.MoreRichTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.MoreRichTextBox_LinkClicked);
|
||||
//
|
||||
// TabPanelDetails
|
||||
//
|
||||
this.TabPanelDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TabPanelDetails.Controls.Add(this.TabPageApplication);
|
||||
this.TabPanelDetails.Controls.Add(this.TabPageAssemblies);
|
||||
this.TabPanelDetails.Controls.Add(this.TabPageAssemblyDetails);
|
||||
this.TabPanelDetails.Location = new System.Drawing.Point(3, 252);
|
||||
this.TabPanelDetails.Name = "TabPanelDetails";
|
||||
this.TabPanelDetails.SelectedIndex = 0;
|
||||
this.TabPanelDetails.Size = new System.Drawing.Size(383, 149);
|
||||
this.TabPanelDetails.TabIndex = 27;
|
||||
this.TabPanelDetails.Visible = false;
|
||||
this.TabPanelDetails.SelectedIndexChanged += new System.EventHandler(this.TabPanelDetails_SelectedIndexChanged);
|
||||
//
|
||||
// TabPageApplication
|
||||
//
|
||||
this.TabPageApplication.Controls.Add(this.AppInfoListView);
|
||||
this.TabPageApplication.Location = new System.Drawing.Point(4, 24);
|
||||
this.TabPageApplication.Name = "TabPageApplication";
|
||||
this.TabPageApplication.Size = new System.Drawing.Size(375, 121);
|
||||
this.TabPageApplication.TabIndex = 0;
|
||||
this.TabPageApplication.Text = "Application";
|
||||
//
|
||||
// AppInfoListView
|
||||
//
|
||||
this.AppInfoListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colKey,
|
||||
this.colValue});
|
||||
this.AppInfoListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.AppInfoListView.FullRowSelect = true;
|
||||
this.AppInfoListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.AppInfoListView.Location = new System.Drawing.Point(0, 0);
|
||||
this.AppInfoListView.Name = "AppInfoListView";
|
||||
this.AppInfoListView.Size = new System.Drawing.Size(375, 121);
|
||||
this.AppInfoListView.TabIndex = 16;
|
||||
this.AppInfoListView.UseCompatibleStateImageBehavior = false;
|
||||
this.AppInfoListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// colKey
|
||||
//
|
||||
this.colKey.Text = "Application Key";
|
||||
this.colKey.Width = 120;
|
||||
//
|
||||
// colValue
|
||||
//
|
||||
this.colValue.Text = "Value";
|
||||
this.colValue.Width = 700;
|
||||
//
|
||||
// TabPageAssemblies
|
||||
//
|
||||
this.TabPageAssemblies.Controls.Add(this.AssemblyInfoListView);
|
||||
this.TabPageAssemblies.Location = new System.Drawing.Point(4, 24);
|
||||
this.TabPageAssemblies.Name = "TabPageAssemblies";
|
||||
this.TabPageAssemblies.Size = new System.Drawing.Size(375, 109);
|
||||
this.TabPageAssemblies.TabIndex = 1;
|
||||
this.TabPageAssemblies.Text = "Assemblies";
|
||||
//
|
||||
// AssemblyInfoListView
|
||||
//
|
||||
this.AssemblyInfoListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colAssemblyName,
|
||||
this.colAssemblyVersion,
|
||||
this.colAssemblyBuilt,
|
||||
this.colAssemblyCodeBase});
|
||||
this.AssemblyInfoListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.AssemblyInfoListView.FullRowSelect = true;
|
||||
this.AssemblyInfoListView.Location = new System.Drawing.Point(0, 0);
|
||||
this.AssemblyInfoListView.MultiSelect = false;
|
||||
this.AssemblyInfoListView.Name = "AssemblyInfoListView";
|
||||
this.AssemblyInfoListView.Size = new System.Drawing.Size(375, 109);
|
||||
this.AssemblyInfoListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.AssemblyInfoListView.TabIndex = 13;
|
||||
this.AssemblyInfoListView.UseCompatibleStateImageBehavior = false;
|
||||
this.AssemblyInfoListView.View = System.Windows.Forms.View.Details;
|
||||
this.AssemblyInfoListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.AssemblyInfoListView_ColumnClick);
|
||||
this.AssemblyInfoListView.DoubleClick += new System.EventHandler(this.AssemblyInfoListView_DoubleClick);
|
||||
//
|
||||
// colAssemblyName
|
||||
//
|
||||
this.colAssemblyName.Text = "Assembly";
|
||||
this.colAssemblyName.Width = 123;
|
||||
//
|
||||
// colAssemblyVersion
|
||||
//
|
||||
this.colAssemblyVersion.Text = "Version";
|
||||
this.colAssemblyVersion.Width = 100;
|
||||
//
|
||||
// colAssemblyBuilt
|
||||
//
|
||||
this.colAssemblyBuilt.Text = "Built";
|
||||
this.colAssemblyBuilt.Width = 130;
|
||||
//
|
||||
// colAssemblyCodeBase
|
||||
//
|
||||
this.colAssemblyCodeBase.Text = "CodeBase";
|
||||
this.colAssemblyCodeBase.Width = 750;
|
||||
//
|
||||
// TabPageAssemblyDetails
|
||||
//
|
||||
this.TabPageAssemblyDetails.Controls.Add(this.AssemblyDetailsListView);
|
||||
this.TabPageAssemblyDetails.Controls.Add(this.AssemblyNamesComboBox);
|
||||
this.TabPageAssemblyDetails.Location = new System.Drawing.Point(4, 24);
|
||||
this.TabPageAssemblyDetails.Name = "TabPageAssemblyDetails";
|
||||
this.TabPageAssemblyDetails.Size = new System.Drawing.Size(375, 109);
|
||||
this.TabPageAssemblyDetails.TabIndex = 2;
|
||||
this.TabPageAssemblyDetails.Text = "Assembly Details";
|
||||
//
|
||||
// AssemblyDetailsListView
|
||||
//
|
||||
this.AssemblyDetailsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.ColumnHeader1,
|
||||
this.ColumnHeader2});
|
||||
this.AssemblyDetailsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.AssemblyDetailsListView.FullRowSelect = true;
|
||||
this.AssemblyDetailsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.AssemblyDetailsListView.Location = new System.Drawing.Point(0, 23);
|
||||
this.AssemblyDetailsListView.Name = "AssemblyDetailsListView";
|
||||
this.AssemblyDetailsListView.Size = new System.Drawing.Size(375, 86);
|
||||
this.AssemblyDetailsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.AssemblyDetailsListView.TabIndex = 19;
|
||||
this.AssemblyDetailsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.AssemblyDetailsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// ColumnHeader1
|
||||
//
|
||||
this.ColumnHeader1.Text = "Assembly Key";
|
||||
this.ColumnHeader1.Width = 120;
|
||||
//
|
||||
// ColumnHeader2
|
||||
//
|
||||
this.ColumnHeader2.Text = "Value";
|
||||
this.ColumnHeader2.Width = 700;
|
||||
//
|
||||
// AssemblyNamesComboBox
|
||||
//
|
||||
this.AssemblyNamesComboBox.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.AssemblyNamesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.AssemblyNamesComboBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.AssemblyNamesComboBox.Name = "AssemblyNamesComboBox";
|
||||
this.AssemblyNamesComboBox.Size = new System.Drawing.Size(375, 23);
|
||||
this.AssemblyNamesComboBox.Sorted = true;
|
||||
this.AssemblyNamesComboBox.TabIndex = 18;
|
||||
this.AssemblyNamesComboBox.SelectedIndexChanged += new System.EventHandler(this.AssemblyNamesComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel4, 0, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.AppCopyrightLabel, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.AppDateLabel, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.GroupBox1, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.TabPanelDetails, 0, 7);
|
||||
this.tableLayoutPanel1.Controls.Add(this.MoreRichTextBox, 0, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.AppVersionLabel, 0, 2);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(9, 7);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 9;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(389, 439);
|
||||
this.tableLayoutPanel1.TabIndex = 28;
|
||||
//
|
||||
// tableLayoutPanel4
|
||||
//
|
||||
this.tableLayoutPanel4.AutoSize = true;
|
||||
this.tableLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel4.ColumnCount = 3;
|
||||
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel4.Controls.Add(this.buttonSystemInfo, 0, 0);
|
||||
this.tableLayoutPanel4.Controls.Add(this.buttonDetails, 1, 0);
|
||||
this.tableLayoutPanel4.Controls.Add(this.buttonOk, 2, 0);
|
||||
this.tableLayoutPanel4.Location = new System.Drawing.Point(2, 406);
|
||||
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
|
||||
this.tableLayoutPanel4.RowCount = 1;
|
||||
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel4.Size = new System.Drawing.Size(249, 31);
|
||||
this.tableLayoutPanel4.TabIndex = 29;
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.AutoSize = true;
|
||||
this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel2.ColumnCount = 2;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 313F));
|
||||
this.tableLayoutPanel2.Controls.Add(this.ImagePictureBox, 0, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel3, 1, 0);
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(2, 2);
|
||||
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 1;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(355, 46);
|
||||
this.tableLayoutPanel2.TabIndex = 29;
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.AutoSize = true;
|
||||
this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel3.ColumnCount = 1;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel3.Controls.Add(this.AppTitleLabel, 0, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.AppDescriptionLabel, 0, 1);
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(44, 2);
|
||||
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 2;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(92, 42);
|
||||
this.tableLayoutPanel3.TabIndex = 25;
|
||||
//
|
||||
// AboutBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.CancelButton = this.buttonOk;
|
||||
this.ClientSize = new System.Drawing.Size(402, 492);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AboutBox";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "About %title%";
|
||||
this.Load += new System.EventHandler(this.AboutBox_Load);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.AboutBox_Paint);
|
||||
((System.ComponentModel.ISupportInitialize)(this.ImagePictureBox)).EndInit();
|
||||
this.TabPanelDetails.ResumeLayout(false);
|
||||
this.TabPageApplication.ResumeLayout(false);
|
||||
this.TabPageAssemblies.ResumeLayout(false);
|
||||
this.TabPageAssemblyDetails.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.tableLayoutPanel4.ResumeLayout(false);
|
||||
this.tableLayoutPanel4.PerformLayout();
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.PerformLayout();
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
this.tableLayoutPanel3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonDetails;
|
||||
private System.Windows.Forms.PictureBox ImagePictureBox;
|
||||
private System.Windows.Forms.Label AppDateLabel;
|
||||
private System.Windows.Forms.Button buttonSystemInfo;
|
||||
private System.Windows.Forms.Label AppCopyrightLabel;
|
||||
private System.Windows.Forms.Label AppVersionLabel;
|
||||
private System.Windows.Forms.Label AppDescriptionLabel;
|
||||
private System.Windows.Forms.GroupBox GroupBox1;
|
||||
private System.Windows.Forms.Label AppTitleLabel;
|
||||
private System.Windows.Forms.Button buttonOk;
|
||||
internal System.Windows.Forms.RichTextBox MoreRichTextBox;
|
||||
internal System.Windows.Forms.TabControl TabPanelDetails;
|
||||
internal System.Windows.Forms.TabPage TabPageApplication;
|
||||
internal System.Windows.Forms.ListView AppInfoListView;
|
||||
internal System.Windows.Forms.ColumnHeader colKey;
|
||||
internal System.Windows.Forms.ColumnHeader colValue;
|
||||
internal System.Windows.Forms.TabPage TabPageAssemblies;
|
||||
internal System.Windows.Forms.ListView AssemblyInfoListView;
|
||||
internal System.Windows.Forms.ColumnHeader colAssemblyName;
|
||||
internal System.Windows.Forms.ColumnHeader colAssemblyVersion;
|
||||
internal System.Windows.Forms.ColumnHeader colAssemblyBuilt;
|
||||
internal System.Windows.Forms.ColumnHeader colAssemblyCodeBase;
|
||||
internal System.Windows.Forms.TabPage TabPageAssemblyDetails;
|
||||
internal System.Windows.Forms.ListView AssemblyDetailsListView;
|
||||
internal System.Windows.Forms.ColumnHeader ColumnHeader1;
|
||||
internal System.Windows.Forms.ColumnHeader ColumnHeader2;
|
||||
internal System.Windows.Forms.ComboBox AssemblyNamesComboBox;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
|
||||
}
|
||||
}
|
||||
810
FSI.BT.Tools/Global/UserInterface/AboutBox.cs
Normal file
810
FSI.BT.Tools/Global/UserInterface/AboutBox.cs
Normal file
@@ -0,0 +1,810 @@
|
||||
// <copyright file="AboutBox.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.Global.UserInterface
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Win32;
|
||||
using FSI.BT.Tools.SystemTrayMenu.Utilities;
|
||||
using FSI.BT.Tools.Global.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Generic, self-contained About Box dialog.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Jeff Atwood
|
||||
/// http://www.codinghorror.com
|
||||
/// converted to C# by Scott Ferguson
|
||||
/// http://www.forestmoon.com
|
||||
/// .
|
||||
/// </remarks>
|
||||
internal partial class AboutBox : Form
|
||||
{
|
||||
private bool isPainted;
|
||||
private string entryAssemblyName;
|
||||
private string callingAssemblyName;
|
||||
private string executingAssemblyName;
|
||||
private NameValueCollection entryAssemblyAttribCollection;
|
||||
|
||||
public AboutBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
buttonOk.Text = Global.Utilities.Translator.GetText("OK");
|
||||
buttonDetails.Text = Global.Utilities.Translator.GetText("Details");
|
||||
buttonSystemInfo.Text = Global.Utilities.Translator.GetText("System Info");
|
||||
Text = Global.Utilities.Translator.GetText("About FSI.BT.Tools");
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// returns the entry assembly for the current application domain
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// This is usually read-only, but in some weird cases (Smart Client apps)
|
||||
// you won't have an entry assembly, so you may want to set this manually.
|
||||
// </remarks>
|
||||
public Assembly AppEntryAssembly { get; set; }
|
||||
|
||||
// <summary>
|
||||
// single line of text to show in the application title section of the about box dialog
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// defaults to "%title%"
|
||||
// %title% = Assembly: AssemblyTitle
|
||||
// </remarks>
|
||||
public string AppTitle
|
||||
{
|
||||
get => AppTitleLabel.Text;
|
||||
set => AppTitleLabel.Text = value;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// single line of text to show in the description section of the about box dialog
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// defaults to "%description%"
|
||||
// %description% = Assembly: AssemblyDescription
|
||||
// </remarks>
|
||||
public string AppDescription
|
||||
{
|
||||
get => AppDescriptionLabel.Text;
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
AppDescriptionLabel.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AppDescriptionLabel.Visible = true;
|
||||
AppDescriptionLabel.Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// single line of text to show in the version section of the about dialog
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// defaults to "Version %version%"
|
||||
// %version% = Assembly: AssemblyVersion
|
||||
// </remarks>
|
||||
public string AppVersion
|
||||
{
|
||||
get => AppVersionLabel.Text;
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
AppVersionLabel.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AppVersionLabel.Visible = true;
|
||||
AppVersionLabel.Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// single line of text to show in the copyright section of the about dialog
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// defaults to "Copyright © %year%, %company%"
|
||||
// %company% = Assembly: AssemblyCompany
|
||||
// %year% = current 4-digit year
|
||||
// </remarks>
|
||||
public string AppCopyright
|
||||
{
|
||||
get => AppCopyrightLabel.Text;
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
AppCopyrightLabel.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AppCopyrightLabel.Visible = true;
|
||||
AppCopyrightLabel.Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// intended for the default 32x32 application icon to appear in the upper left of the about dialog
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// if you open this form using .ShowDialog(Owner), the icon can be derived from the owning form
|
||||
// </remarks>
|
||||
public Image AppImage
|
||||
{
|
||||
get => ImagePictureBox.Image;
|
||||
set => ImagePictureBox.Image = value;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// multiple lines of miscellaneous text to show in rich text box
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// defaults to "%product% is %copyright%, %trademark%"
|
||||
// %product% = Assembly: AssemblyProduct
|
||||
// %copyright% = Assembly: AssemblyCopyright
|
||||
// %trademark% = Assembly: AssemblyTrademark
|
||||
// </remarks>
|
||||
public string AppMoreInfo
|
||||
{
|
||||
get => MoreRichTextBox.Text;
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
MoreRichTextBox.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoreRichTextBox.Visible = true;
|
||||
MoreRichTextBox.Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// determines if the "Details" (advanced assembly details) button is shown
|
||||
// </summary>
|
||||
public bool AppDetailsButton
|
||||
{
|
||||
get => buttonDetails.Visible;
|
||||
set => buttonDetails.Visible = value;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// exception-safe retrieval of LastWriteTime for this assembly.
|
||||
// </summary>
|
||||
// <returns>File.GetLastWriteTime, or DateTime.MaxValue if exception was encountered.</returns>
|
||||
private static DateTime AssemblyLastWriteTime(Assembly a)
|
||||
{
|
||||
DateTime assemblyLastWriteTime = DateTime.MaxValue;
|
||||
|
||||
// Location property not available for dynamic assemblies
|
||||
if (!a.IsDynamic)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(a.Location))
|
||||
{
|
||||
assemblyLastWriteTime = File.GetLastWriteTime(a.Location);
|
||||
}
|
||||
}
|
||||
|
||||
return assemblyLastWriteTime;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// returns DateTime this Assembly was last built. Will attempt to calculate from build number, if possible.
|
||||
// If not, the actual LastWriteTime on the assembly file will be returned.
|
||||
// </summary>
|
||||
// <param name="a">Assembly to get build date for</param>
|
||||
// <param name="ForceFileDate">Don't attempt to use the build number to calculate the date</param>
|
||||
// <returns>DateTime this assembly was last built</returns>
|
||||
private static DateTime AssemblyBuildDate(Assembly a, bool forceFileDate)
|
||||
{
|
||||
Version assemblyVersion = a.GetName().Version;
|
||||
DateTime dt;
|
||||
|
||||
if (forceFileDate)
|
||||
{
|
||||
dt = AssemblyLastWriteTime(a);
|
||||
}
|
||||
else
|
||||
{
|
||||
dt = DateTime.Parse("01/01/2000", CultureInfo.InvariantCulture).AddDays(assemblyVersion.Build).AddSeconds(assemblyVersion.Revision * 2);
|
||||
#pragma warning disable CS0618
|
||||
if (TimeZone.IsDaylightSavingTime(dt, TimeZone.CurrentTimeZone.GetDaylightChanges(dt.Year)))
|
||||
#pragma warning restore CS0618
|
||||
{
|
||||
dt = dt.AddHours(1);
|
||||
}
|
||||
|
||||
if (dt > DateTime.Now || assemblyVersion.Build < 730 || assemblyVersion.Revision == 0)
|
||||
{
|
||||
dt = AssemblyLastWriteTime(a);
|
||||
}
|
||||
}
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// returns string name / string value pair of all attribs
|
||||
// for specified assembly
|
||||
// </summary>
|
||||
// <remarks>
|
||||
// note that Assembly* values are pulled from AssemblyInfo file in project folder
|
||||
//
|
||||
// Trademark = AssemblyTrademark string
|
||||
// Debuggable = true
|
||||
// GUID = 7FDF68D5-8C6F-44C9-B391-117B5AFB5467
|
||||
// CLSCompliant = true
|
||||
// Product = AssemblyProduct string
|
||||
// Copyright = AssemblyCopyright string
|
||||
// Company = AssemblyCompany string
|
||||
// Description = AssemblyDescription string
|
||||
// Title = AssemblyTitle string
|
||||
// </remarks>
|
||||
private static NameValueCollection AssemblyAttribs(Assembly a)
|
||||
{
|
||||
string typeName;
|
||||
string name;
|
||||
string value;
|
||||
NameValueCollection nvc = new();
|
||||
Regex r = new(@"(\.Assembly|\.)(?<Name>[^.]*)Attribute$", RegexOptions.IgnoreCase);
|
||||
|
||||
foreach (object attrib in a.GetCustomAttributes(false))
|
||||
{
|
||||
typeName = attrib.GetType().ToString();
|
||||
name = r.Match(typeName).Groups["Name"].ToString();
|
||||
value = string.Empty;
|
||||
switch (typeName)
|
||||
{
|
||||
case "System.CLSCompliantAttribute":
|
||||
value = ((CLSCompliantAttribute)attrib).IsCompliant.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Diagnostics.DebuggableAttribute":
|
||||
value = ((System.Diagnostics.DebuggableAttribute)attrib).IsJITTrackingEnabled.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyCompanyAttribute":
|
||||
value = ((AssemblyCompanyAttribute)attrib).Company.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyConfigurationAttribute":
|
||||
value = ((AssemblyConfigurationAttribute)attrib).Configuration.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyCopyrightAttribute":
|
||||
value = ((AssemblyCopyrightAttribute)attrib).Copyright.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyDefaultAliasAttribute":
|
||||
value = ((AssemblyDefaultAliasAttribute)attrib).DefaultAlias.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyDelaySignAttribute":
|
||||
value = ((AssemblyDelaySignAttribute)attrib).DelaySign.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyDescriptionAttribute":
|
||||
value = ((AssemblyDescriptionAttribute)attrib).Description.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyInformationalVersionAttribute":
|
||||
value = ((AssemblyInformationalVersionAttribute)attrib).InformationalVersion.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyKeyFileAttribute":
|
||||
value = ((AssemblyKeyFileAttribute)attrib).KeyFile.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyProductAttribute":
|
||||
value = ((AssemblyProductAttribute)attrib).Product.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyTrademarkAttribute":
|
||||
value = ((AssemblyTrademarkAttribute)attrib).Trademark.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Reflection.AssemblyTitleAttribute":
|
||||
value = ((AssemblyTitleAttribute)attrib).Title.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Resources.NeutralResourcesLanguageAttribute":
|
||||
value = ((System.Resources.NeutralResourcesLanguageAttribute)attrib).CultureName.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Resources.SatelliteContractVersionAttribute":
|
||||
value = ((System.Resources.SatelliteContractVersionAttribute)attrib).Version.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Runtime.InteropServices.ComCompatibleVersionAttribute":
|
||||
{
|
||||
System.Runtime.InteropServices.ComCompatibleVersionAttribute x;
|
||||
x = (System.Runtime.InteropServices.ComCompatibleVersionAttribute)attrib;
|
||||
value = x.MajorVersion + "." + x.MinorVersion + "." + x.RevisionNumber + "." + x.BuildNumber;
|
||||
break;
|
||||
}
|
||||
|
||||
case "System.Runtime.InteropServices.ComVisibleAttribute":
|
||||
value = ((System.Runtime.InteropServices.ComVisibleAttribute)attrib).Value.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Runtime.InteropServices.GuidAttribute":
|
||||
value = ((System.Runtime.InteropServices.GuidAttribute)attrib).Value.ToString(CultureInfo.InvariantCulture); break;
|
||||
case "System.Runtime.InteropServices.TypeLibVersionAttribute":
|
||||
{
|
||||
System.Runtime.InteropServices.TypeLibVersionAttribute x;
|
||||
x = (System.Runtime.InteropServices.TypeLibVersionAttribute)attrib;
|
||||
value = x.MajorVersion + "." + x.MinorVersion;
|
||||
break;
|
||||
}
|
||||
|
||||
case "System.Security.AllowPartiallyTrustedCallersAttribute":
|
||||
value = "(Present)"; break;
|
||||
default:
|
||||
// debug.writeline("** unknown assembly attribute '" + TypeName + "'")
|
||||
value = typeName; break;
|
||||
}
|
||||
|
||||
if (nvc[name] == null)
|
||||
{
|
||||
nvc.Add(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
// add some extra values that are not in the AssemblyInfo, but nice to have
|
||||
// codebase
|
||||
try
|
||||
{
|
||||
if (!a.IsDynamic)
|
||||
{
|
||||
nvc.Add("CodeBase", a.Location.Replace("file:///", string.Empty, StringComparison.InvariantCulture));
|
||||
}
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
nvc.Add("CodeBase", "(not supported)");
|
||||
}
|
||||
|
||||
// build date
|
||||
DateTime dt = AssemblyBuildDate(a, false);
|
||||
if (dt == DateTime.MaxValue)
|
||||
{
|
||||
nvc.Add("BuildDate", "(unknown)");
|
||||
}
|
||||
else
|
||||
{
|
||||
nvc.Add("BuildDate", dt.ToString("yyyy-MM-dd hh:mm tt", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
// location
|
||||
try
|
||||
{
|
||||
if (!a.IsDynamic)
|
||||
{
|
||||
nvc.Add("Location", a.Location);
|
||||
}
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
nvc.Add("Location", "(not supported)");
|
||||
}
|
||||
|
||||
string version = "(unknown)";
|
||||
AssemblyName assemblyName = a.GetName();
|
||||
if (assemblyName.Version != null &&
|
||||
(assemblyName.Version.Major != 0 || assemblyName.Version.Minor != 0))
|
||||
{
|
||||
if (!a.IsDynamic)
|
||||
{
|
||||
version = a.GetName().Version.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
nvc.Add("Version", version);
|
||||
|
||||
if (!a.IsDynamic)
|
||||
{
|
||||
nvc.Add("FullName", a.FullName);
|
||||
}
|
||||
|
||||
return nvc;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// reads an HKLM Windows Registry key value
|
||||
// </summary>
|
||||
private static string RegistryHklmValue(string keyName, string subKeyRef)
|
||||
{
|
||||
string strSysInfoPath = string.Empty;
|
||||
try
|
||||
{
|
||||
RegistryKey rk = Registry.LocalMachine.OpenSubKey(keyName);
|
||||
strSysInfoPath = (string)rk.GetValue(subKeyRef, string.Empty);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warn($"KeyName:'{keyName}' SubKeyRef:'{subKeyRef}'", ex);
|
||||
}
|
||||
|
||||
return strSysInfoPath;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// populate a listview with the specified key and value strings
|
||||
// </summary>
|
||||
private static void Populate(ListView lvw, string key, string value)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
ListViewItem lvi = new()
|
||||
{
|
||||
Text = key,
|
||||
};
|
||||
lvi.SubItems.Add(value);
|
||||
lvw.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// populate details for a single assembly
|
||||
// </summary>
|
||||
private static void PopulateAssemblyDetails(Assembly a, ListView lvw)
|
||||
{
|
||||
lvw.Items.Clear();
|
||||
|
||||
Populate(lvw, "Image Runtime Version", a.ImageRuntimeVersion);
|
||||
|
||||
NameValueCollection nvc = AssemblyAttribs(a);
|
||||
foreach (string strKey in nvc)
|
||||
{
|
||||
Populate(lvw, strKey, nvc[strKey]);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// matches assembly by Assembly.GetName.Name; returns nothing if no match
|
||||
// </summary>
|
||||
private static Assembly MatchAssemblyByName(string assemblyName)
|
||||
{
|
||||
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
if (a.GetName().Name == assemblyName)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void TabPanelDetails_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (TabPanelDetails.SelectedTab == TabPageAssemblyDetails)
|
||||
{
|
||||
AssemblyNamesComboBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// launch the MSInfo "system information" application (works on XP, 2003, and Vista)
|
||||
// </summary>
|
||||
private void ShowSysInfo()
|
||||
{
|
||||
string strSysInfoPath = RegistryHklmValue(@"SOFTWARE\Microsoft\Shared Tools Location", "MSINFO");
|
||||
if (string.IsNullOrEmpty(strSysInfoPath))
|
||||
{
|
||||
strSysInfoPath = RegistryHklmValue(@"SOFTWARE\Microsoft\Shared Tools\MSINFO", "PATH");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(strSysInfoPath))
|
||||
{
|
||||
MessageBox.Show(
|
||||
"System Information is unavailable at this time." +
|
||||
Environment.NewLine + Environment.NewLine +
|
||||
"(couldn't find path for Microsoft System Information Tool in the registry.)",
|
||||
Text,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Log.ProcessStart(strSysInfoPath);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// populates the Application Information listview
|
||||
// </summary>
|
||||
private void PopulateAppInfo()
|
||||
{
|
||||
AppDomain d = AppDomain.CurrentDomain;
|
||||
Populate(AppInfoListView, "Application Name", Assembly.GetEntryAssembly().GetName().Name);
|
||||
Populate(AppInfoListView, "Application Base", d.SetupInformation.ApplicationBase);
|
||||
Populate(AppInfoListView, "Friendly Name", d.FriendlyName);
|
||||
Populate(AppInfoListView, " ", " ");
|
||||
Populate(AppInfoListView, "Entry Assembly", entryAssemblyName);
|
||||
Populate(AppInfoListView, "Executing Assembly", executingAssemblyName);
|
||||
Populate(AppInfoListView, "Calling Assembly", callingAssemblyName);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// populate Assembly Information listview with ALL assemblies
|
||||
// </summary>
|
||||
private void PopulateAssemblies()
|
||||
{
|
||||
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
PopulateAssemblySummary(a);
|
||||
}
|
||||
|
||||
AssemblyNamesComboBox.SelectedIndex = AssemblyNamesComboBox.FindStringExact(entryAssemblyName);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// populate Assembly Information listview with summary view for a specific assembly
|
||||
// </summary>
|
||||
private void PopulateAssemblySummary(Assembly a)
|
||||
{
|
||||
NameValueCollection nvc = AssemblyAttribs(a);
|
||||
|
||||
string strAssemblyName = a.GetName().Name;
|
||||
|
||||
ListViewItem lvi = new()
|
||||
{
|
||||
Text = strAssemblyName,
|
||||
Tag = strAssemblyName,
|
||||
};
|
||||
if (strAssemblyName == callingAssemblyName)
|
||||
{
|
||||
lvi.Text += " (calling)";
|
||||
}
|
||||
|
||||
if (strAssemblyName == executingAssemblyName)
|
||||
{
|
||||
lvi.Text += " (executing)";
|
||||
}
|
||||
|
||||
if (strAssemblyName == entryAssemblyName)
|
||||
{
|
||||
lvi.Text += " (entry)";
|
||||
}
|
||||
|
||||
lvi.SubItems.Add(nvc["version"]);
|
||||
lvi.SubItems.Add(nvc["builddate"]);
|
||||
lvi.SubItems.Add(nvc["codebase"]);
|
||||
AssemblyInfoListView.Items.Add(lvi);
|
||||
AssemblyNamesComboBox.Items.Add(strAssemblyName);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// retrieves a cached value from the entry assembly attribute lookup collection
|
||||
// </summary>
|
||||
private string EntryAssemblyAttrib(string strName)
|
||||
{
|
||||
if (entryAssemblyAttribCollection[strName] == null)
|
||||
{
|
||||
return "<Assembly: Assembly" + strName + "(\"\")>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return entryAssemblyAttribCollection[strName].ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Populate all the form labels with tokenized text
|
||||
// </summary>
|
||||
private void PopulateLabels()
|
||||
{
|
||||
// get entry assembly attribs
|
||||
entryAssemblyAttribCollection = AssemblyAttribs(AppEntryAssembly);
|
||||
|
||||
// set icon from parent, if present
|
||||
if (Owner != null)
|
||||
{
|
||||
Icon = Owner.Icon;
|
||||
ImagePictureBox.Image = Icon.ToBitmap();
|
||||
}
|
||||
|
||||
// replace all labels and window title
|
||||
Text = ReplaceTokens(Text);
|
||||
AppTitleLabel.Text = ReplaceTokens(AppTitleLabel.Text);
|
||||
if (AppDescriptionLabel.Visible)
|
||||
{
|
||||
AppDescriptionLabel.Text = ReplaceTokens(AppDescriptionLabel.Text);
|
||||
}
|
||||
|
||||
if (AppCopyrightLabel.Visible)
|
||||
{
|
||||
AppCopyrightLabel.Text = ReplaceTokens(AppCopyrightLabel.Text);
|
||||
}
|
||||
|
||||
if (AppVersionLabel.Visible)
|
||||
{
|
||||
AppVersionLabel.Text = ReplaceTokens(AppVersionLabel.Text);
|
||||
}
|
||||
|
||||
if (AppDateLabel.Visible)
|
||||
{
|
||||
AppDateLabel.Text = ReplaceTokens(AppDateLabel.Text);
|
||||
}
|
||||
|
||||
if (MoreRichTextBox.Visible)
|
||||
{
|
||||
MoreRichTextBox.Text = ReplaceTokens(MoreRichTextBox.Text);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// perform assemblyinfo to string replacements on labels
|
||||
// </summary>
|
||||
private string ReplaceTokens(string s)
|
||||
{
|
||||
s = s.Replace("%title%", EntryAssemblyAttrib("title"), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%copyright%", EntryAssemblyAttrib("copyright"), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%description%", EntryAssemblyAttrib("description"), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%company%", EntryAssemblyAttrib("company"), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%product%", EntryAssemblyAttrib("product"), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%trademark%", EntryAssemblyAttrib("trademark"), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%year%", DateTime.Now.Year.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%version%", EntryAssemblyAttrib("version"), StringComparison.InvariantCulture);
|
||||
s = s.Replace("%builddate%", EntryAssemblyAttrib("builddate"), StringComparison.InvariantCulture);
|
||||
return s;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// things to do when form is loaded
|
||||
// </summary>
|
||||
private void AboutBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
// if the user didn't provide an assembly, try to guess which one is the entry assembly
|
||||
if (AppEntryAssembly == null)
|
||||
{
|
||||
AppEntryAssembly = Assembly.GetEntryAssembly();
|
||||
}
|
||||
|
||||
if (AppEntryAssembly == null)
|
||||
{
|
||||
AppEntryAssembly = Assembly.GetExecutingAssembly();
|
||||
}
|
||||
|
||||
executingAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
|
||||
callingAssemblyName = Assembly.GetCallingAssembly().GetName().Name;
|
||||
|
||||
// for web hosted apps, GetEntryAssembly = nothing
|
||||
entryAssemblyName = Assembly.GetEntryAssembly().GetName().Name;
|
||||
|
||||
TabPanelDetails.Visible = false;
|
||||
if (!MoreRichTextBox.Visible)
|
||||
{
|
||||
Height -= MoreRichTextBox.Height;
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// things to do when form is FIRST painted
|
||||
// </summary>
|
||||
private void AboutBox_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (!isPainted)
|
||||
{
|
||||
isPainted = true;
|
||||
Application.DoEvents();
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
PopulateLabels();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// expand about dialog to show additional advanced details
|
||||
// </summary>
|
||||
private void DetailsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
buttonDetails.Visible = false;
|
||||
SuspendLayout();
|
||||
MaximizeBox = true;
|
||||
FormBorderStyle = FormBorderStyle.Sizable;
|
||||
TabPanelDetails.Dock = DockStyle.Fill;
|
||||
tableLayoutPanel1.Dock = DockStyle.Fill;
|
||||
AutoSize = false;
|
||||
SizeGripStyle = SizeGripStyle.Show;
|
||||
Size = new Size(580, Size.Height);
|
||||
MoreRichTextBox.Visible = false;
|
||||
TabPanelDetails.Visible = true;
|
||||
buttonSystemInfo.Visible = true;
|
||||
PopulateAssemblies();
|
||||
PopulateAppInfo();
|
||||
CenterToParent();
|
||||
ResumeLayout();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// for detailed system info, launch the external Microsoft system info app
|
||||
// </summary>
|
||||
private void SysInfoButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowSysInfo();
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// if an assembly is double-clicked, go to the detail page for that assembly
|
||||
// </summary>
|
||||
private void AssemblyInfoListView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
string strAssemblyName;
|
||||
if (AssemblyInfoListView.SelectedItems.Count > 0)
|
||||
{
|
||||
strAssemblyName = Convert.ToString(AssemblyInfoListView.SelectedItems[0].Tag, CultureInfo.InvariantCulture);
|
||||
AssemblyNamesComboBox.SelectedIndex = AssemblyNamesComboBox.FindStringExact(strAssemblyName);
|
||||
TabPanelDetails.SelectedTab = TabPageAssemblyDetails;
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// if a new assembly is selected from the combo box, show details for that assembly
|
||||
// </summary>
|
||||
private void AssemblyNamesComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string strAssemblyName = Convert.ToString(AssemblyNamesComboBox.SelectedItem, CultureInfo.InvariantCulture);
|
||||
PopulateAssemblyDetails(MatchAssemblyByName(strAssemblyName), AssemblyDetailsListView);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// sort the assembly list by column
|
||||
// </summary>
|
||||
private void AssemblyInfoListView_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
int intTargetCol = e.Column + 1;
|
||||
|
||||
if (AssemblyInfoListView.Tag != null)
|
||||
{
|
||||
if (Math.Abs(Convert.ToInt32(AssemblyInfoListView.Tag, CultureInfo.InvariantCulture)) == intTargetCol)
|
||||
{
|
||||
intTargetCol = -Convert.ToInt32(AssemblyInfoListView.Tag, CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
AssemblyInfoListView.Tag = intTargetCol;
|
||||
AssemblyInfoListView.ListViewItemSorter = new ListViewItemComparer(intTargetCol, true);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// launch any http:// or mailto: links clicked in the body of the rich text box
|
||||
// </summary>
|
||||
private void MoreRichTextBox_LinkClicked(object sender, LinkClickedEventArgs e)
|
||||
{
|
||||
Log.ProcessStart(e.LinkText);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// things to do when the selected tab is changed
|
||||
// </summary>
|
||||
private class ListViewItemComparer : System.Collections.IComparer
|
||||
{
|
||||
private readonly int intCol;
|
||||
private readonly bool isAscending = true;
|
||||
|
||||
public ListViewItemComparer()
|
||||
{
|
||||
intCol = 0;
|
||||
isAscending = true;
|
||||
}
|
||||
|
||||
public ListViewItemComparer(int column, bool ascending)
|
||||
{
|
||||
if (column < 0)
|
||||
{
|
||||
isAscending = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isAscending = ascending;
|
||||
}
|
||||
|
||||
intCol = Math.Abs(column) - 1;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
int intResult = string.Compare(
|
||||
((ListViewItem)x).SubItems[intCol].Text,
|
||||
((ListViewItem)y).SubItems[intCol].Text,
|
||||
StringComparison.Ordinal);
|
||||
if (isAscending)
|
||||
{
|
||||
return intResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -intResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3354
FSI.BT.Tools/Global/UserInterface/AboutBox.resx
Normal file
3354
FSI.BT.Tools/Global/UserInterface/AboutBox.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,170 @@
|
||||
// <copyright file="FolderDialog.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using FSI.BT.Tools.Global.Utilities;
|
||||
using FSI.BT.Tools.SystemTrayMenu.Utilities;
|
||||
|
||||
public class FolderDialog : IFolderDialog, IDisposable
|
||||
{
|
||||
private bool isDisposed;
|
||||
|
||||
~FolderDialog() // the finalizer
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets /sets folder in which dialog will be open.
|
||||
/// </summary>
|
||||
public string InitialFolder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets /sets directory in which dialog will be open
|
||||
/// if there is no recent directory available.
|
||||
/// </summary>
|
||||
public string DefaultFolder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets selected folder.
|
||||
/// </summary>
|
||||
public string Folder { get; set; }
|
||||
|
||||
public DialogResult ShowDialog()
|
||||
{
|
||||
return ShowDialog(owner: new WindowWrapper(IntPtr.Zero));
|
||||
}
|
||||
|
||||
public DialogResult ShowDialog(IWin32Window owner)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major >= 6)
|
||||
{
|
||||
return ShowVistaDialog(owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ShowLegacyDialog(owner);
|
||||
}
|
||||
}
|
||||
|
||||
public DialogResult ShowVistaDialog(IWin32Window owner)
|
||||
{
|
||||
NativeMethods.IFileDialog frm = (NativeMethods.IFileDialog)new NativeMethods.FileOpenDialogRCW();
|
||||
frm.GetOptions(out uint options);
|
||||
options |= NativeMethods.FOS_PICKFOLDERS |
|
||||
NativeMethods.FOS_FORCEFILESYSTEM |
|
||||
NativeMethods.FOS_NOVALIDATE |
|
||||
NativeMethods.FOS_NOTESTFILECREATE |
|
||||
NativeMethods.FOS_DONTADDTORECENT;
|
||||
frm.SetOptions(options);
|
||||
if (InitialFolder != null)
|
||||
{
|
||||
Guid riid = new("43826D1E-E718-42EE-BC55-A1E261C37BFE"); // IShellItem
|
||||
if (NativeMethods.SHCreateItemFromParsingName(
|
||||
InitialFolder,
|
||||
IntPtr.Zero,
|
||||
ref riid,
|
||||
out NativeMethods.IShellItem directoryShellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
frm.SetFolder(directoryShellItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (DefaultFolder != null)
|
||||
{
|
||||
Guid riid = new("43826D1E-E718-42EE-BC55-A1E261C37BFE"); // IShellItem
|
||||
if (NativeMethods.SHCreateItemFromParsingName(
|
||||
DefaultFolder,
|
||||
IntPtr.Zero,
|
||||
ref riid,
|
||||
out NativeMethods.IShellItem directoryShellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
frm.SetDefaultFolder(directoryShellItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (owner != null && frm.Show(owner.Handle) == NativeMethods.S_OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (frm.GetResult(out NativeMethods.IShellItem shellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
if (shellItem.GetDisplayName(
|
||||
NativeMethods.SIGDN_FILESYSPATH,
|
||||
out IntPtr pszString) == NativeMethods.S_OK)
|
||||
{
|
||||
if (pszString != IntPtr.Zero)
|
||||
{
|
||||
try
|
||||
{
|
||||
Folder = Marshal.PtrToStringAuto(pszString);
|
||||
return DialogResult.OK;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeCoTaskMem(pszString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warn("Folder Dialog failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return DialogResult.Cancel;
|
||||
}
|
||||
|
||||
public DialogResult ShowLegacyDialog(IWin32Window owner)
|
||||
{
|
||||
using SaveFileDialog frm = new()
|
||||
{
|
||||
CheckFileExists = false,
|
||||
CheckPathExists = true,
|
||||
CreatePrompt = false,
|
||||
Filter = "|" + Guid.Empty.ToString(),
|
||||
FileName = "any",
|
||||
};
|
||||
if (InitialFolder != null)
|
||||
{
|
||||
frm.InitialDirectory = InitialFolder;
|
||||
}
|
||||
|
||||
frm.OverwritePrompt = false;
|
||||
frm.Title = Global.Utilities.Translator.GetText("Select directory");
|
||||
frm.ValidateNames = false;
|
||||
if (frm.ShowDialog(owner) == DialogResult.OK)
|
||||
{
|
||||
Folder = Path.GetDirectoryName(frm.FileName);
|
||||
return DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
|
||||
isDisposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// <copyright file="IFolderDialog.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
|
||||
{
|
||||
using System.Windows.Forms;
|
||||
|
||||
public interface IFolderDialog
|
||||
{
|
||||
string InitialFolder { get; set; }
|
||||
|
||||
string DefaultFolder { get; set; }
|
||||
|
||||
string Folder { get; set; }
|
||||
|
||||
DialogResult ShowDialog();
|
||||
|
||||
DialogResult ShowDialog(IWin32Window owner);
|
||||
|
||||
DialogResult ShowVistaDialog(IWin32Window owner);
|
||||
|
||||
DialogResult ShowLegacyDialog(IWin32Window owner);
|
||||
|
||||
void Dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
// <copyright file="NativeMethods.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal static class NativeMethods
|
||||
{
|
||||
public const uint FOS_PICKFOLDERS = 0x00000020;
|
||||
public const uint FOS_FORCEFILESYSTEM = 0x00000040;
|
||||
public const uint FOS_NOVALIDATE = 0x00000100;
|
||||
public const uint FOS_NOTESTFILECREATE = 0x00010000;
|
||||
public const uint FOS_DONTADDTORECENT = 0x02000000;
|
||||
|
||||
public const uint S_OK = 0x0000;
|
||||
|
||||
public const uint SIGDN_FILESYSPATH = 0x80058000;
|
||||
|
||||
[ComImport]
|
||||
[Guid("42F85136-DB7E-439C-85F1-E4075D135FC8")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IFileDialog
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
uint Show([In, Optional] IntPtr hwndOwner);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr rgFilterSpec);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileTypeIndex([In] uint iFileType);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetFileTypeIndex(out uint piFileType);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Advise(
|
||||
[In, MarshalAs(UnmanagedType.Interface)] IntPtr pfde,
|
||||
out uint pdwCookie);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Unadvise([In] uint dwCookie);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetOptions([In] uint fos);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetOptions(out uint fos);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, uint fdap);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)]
|
||||
string pszDefaultExtension);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Close([MarshalAs(UnmanagedType.Error)] uint hr);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetClientGuid([In] ref Guid guid);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint ClearClientData();
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
|
||||
}
|
||||
|
||||
[ComImport]
|
||||
[Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IShellItem
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint BindToHandler(
|
||||
[In] IntPtr pbc,
|
||||
[In] ref Guid rbhid,
|
||||
[In] ref Guid riid,
|
||||
[Out, MarshalAs(UnmanagedType.Interface)] out IntPtr ppvOut);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetDisplayName([In] uint sigdnName, out IntPtr ppszName);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, [In] uint hint, out int piOrder);
|
||||
}
|
||||
|
||||
[DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
|
||||
internal static extern int SHCreateItemFromParsingName(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszPath,
|
||||
IntPtr pbc,
|
||||
ref Guid riid,
|
||||
[MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
|
||||
|
||||
[ComImport]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[TypeLibType(TypeLibTypeFlags.FCanCreate)]
|
||||
[Guid("DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7")]
|
||||
internal class FileOpenDialogRCW
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// <copyright file="WindowWrapper.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
|
||||
{
|
||||
using System;
|
||||
|
||||
public class WindowWrapper : System.Windows.Forms.IWin32Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WindowWrapper"/> class.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to wrap.</param>
|
||||
public WindowWrapper(IntPtr handle)
|
||||
{
|
||||
Handle = handle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets original ptr.
|
||||
/// </summary>
|
||||
public IntPtr Handle { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// <copyright file="EventDelay.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.Global.UserInterface.HotkeyTextboxControl
|
||||
{
|
||||
using System;
|
||||
|
||||
public class EventDelay
|
||||
{
|
||||
private readonly long waitTime;
|
||||
private long lastCheck;
|
||||
|
||||
public EventDelay(long ticks)
|
||||
{
|
||||
waitTime = ticks;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
#pragma warning disable CA2002
|
||||
lock (this)
|
||||
#pragma warning restore CA2002
|
||||
{
|
||||
long now = DateTime.Now.Ticks;
|
||||
bool isPassed = now - lastCheck > waitTime;
|
||||
lastCheck = now;
|
||||
return isPassed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,604 @@
|
||||
// <copyright file="HotkeyControl.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.Global.UserInterface.HotkeyTextboxControl
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using FSI.BT.Tools.Global.DllImports;
|
||||
using FSI.BT.Tools.Global.Utilities;
|
||||
using FSI.BT.Tools.SystemTrayMenu.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// A simple control that allows the user to select pretty much any valid hotkey combination
|
||||
/// See: http://www.codeproject.com/KB/buttons/hotkeycontrol.aspx
|
||||
/// But is modified to fit in Greenshot, and have localized support.
|
||||
/// modfied to fit SystemTrayMenu.
|
||||
/// </summary>
|
||||
public sealed class HotkeyControl : TextBox
|
||||
{
|
||||
private static readonly bool IsWindows7OrOlder = Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1;
|
||||
private static readonly IntPtr HotkeyHwnd = (IntPtr)0x0000000000000000;
|
||||
|
||||
|
||||
// Holds the list of hotkeys
|
||||
private static readonly IDictionary<int, HotKeyHandler> KeyHandlers = new Dictionary<int, HotKeyHandler>();
|
||||
private static int hotKeyCounter = 1;
|
||||
|
||||
// ArrayLists used to enforce the use of proper modifiers.
|
||||
// Shift+A isn't a valid hotkey, for instance, as it would screw up when the user is typing.
|
||||
private readonly IList<int> needNonShiftModifier = new List<int>();
|
||||
private readonly IList<int> needNonAltGrModifier = new List<int>();
|
||||
|
||||
private readonly ContextMenuStrip dummy = new();
|
||||
|
||||
// These variables store the current hotkey and modifier(s)
|
||||
private Keys hotkey = Keys.None;
|
||||
private Keys modifiers = Keys.None;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HotkeyControl"/> class.
|
||||
/// </summary>
|
||||
public HotkeyControl()
|
||||
{
|
||||
ContextMenuStrip = dummy; // Disable right-clicking
|
||||
Text = string.Empty;
|
||||
|
||||
// Handle events that occurs when keys are pressed
|
||||
KeyPress += HotkeyControl_KeyPress;
|
||||
KeyUp += HotkeyControl_KeyUp;
|
||||
KeyDown += HotkeyControl_KeyDown;
|
||||
|
||||
PopulateModifierLists();
|
||||
}
|
||||
|
||||
public delegate void HotKeyHandler();
|
||||
|
||||
private enum Modifiers
|
||||
{
|
||||
NONE = 0,
|
||||
ALT = 1,
|
||||
CTRL = 2,
|
||||
SHIFT = 4,
|
||||
WIN = 8,
|
||||
NOREPEAT = 0x4000,
|
||||
}
|
||||
|
||||
private enum MapType : uint
|
||||
{
|
||||
MAPVK_VK_TO_VSC = 0, // The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If there is no translation, the function returns 0.
|
||||
MAPVK_VSC_TO_VK = 1, // The uCode parameter is a scan code and is translated into a virtual-key code that does not distinguish between left- and right-hand keys. If there is no translation, the function returns 0.
|
||||
MAPVK_VK_TO_CHAR = 2, // The uCode parameter is a virtual-key code and is translated into an unshifted character value in the low order word of the return value. Dead keys (diacritics) are indicated by setting the top bit of the return value. If there is no translation, the function returns 0.
|
||||
MAPVK_VSC_TO_VK_EX = 3, // The uCode parameter is a scan code and is translated into a virtual-key code that distinguishes between left- and right-hand keys. If there is no translation, the function returns 0.
|
||||
MAPVK_VK_TO_VSC_EX = 4, // The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If the scan code is an extended scan code, the high byte of the uCode value can contain either 0xe0 or 0xe1 to specify the extended scan code. If there is no translation, the function returns 0.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets used to make sure that there is no right-click menu available.
|
||||
/// </summary>
|
||||
public override ContextMenuStrip ContextMenuStrip
|
||||
{
|
||||
get => dummy;
|
||||
set => base.ContextMenuStrip = dummy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether forces the control to be non-multiline.
|
||||
/// </summary>
|
||||
public override bool Multiline
|
||||
{
|
||||
get => base.Multiline;
|
||||
set => base.Multiline = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets used to get/set the hotkey (e.g. Keys.A).
|
||||
/// </summary>
|
||||
public Keys Hotkey
|
||||
{
|
||||
get => hotkey;
|
||||
set
|
||||
{
|
||||
hotkey = value;
|
||||
Redraw(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets used to get/set the modifier keys (e.g. Keys.Alt | Keys.Control).
|
||||
/// </summary>
|
||||
public Keys HotkeyModifiers
|
||||
{
|
||||
get => modifiers;
|
||||
set
|
||||
{
|
||||
modifiers = value;
|
||||
Redraw(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static string HotkeyToString(Keys modifierKeyCode, Keys virtualKeyCode)
|
||||
{
|
||||
return HotkeyModifiersToString(modifierKeyCode) + virtualKeyCode;
|
||||
}
|
||||
|
||||
public static string HotkeyModifiersToString(Keys modifierKeyCode)
|
||||
{
|
||||
StringBuilder hotkeyString = new();
|
||||
if ((modifierKeyCode & Keys.Alt) > 0)
|
||||
{
|
||||
hotkeyString.Append("Alt").Append(" + ");
|
||||
}
|
||||
|
||||
if ((modifierKeyCode & Keys.Control) > 0)
|
||||
{
|
||||
hotkeyString.Append("Ctrl").Append(" + ");
|
||||
}
|
||||
|
||||
if ((modifierKeyCode & Keys.Shift) > 0)
|
||||
{
|
||||
hotkeyString.Append("Shift").Append(" + ");
|
||||
}
|
||||
|
||||
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
|
||||
{
|
||||
hotkeyString.Append("Win").Append(" + ");
|
||||
}
|
||||
|
||||
return hotkeyString.ToString();
|
||||
}
|
||||
|
||||
public static string HotkeyToLocalizedString(Keys modifierKeyCode, Keys virtualKeyCode)
|
||||
{
|
||||
return HotkeyModifiersToLocalizedString(modifierKeyCode) + GetKeyName(virtualKeyCode);
|
||||
}
|
||||
|
||||
public static string HotkeyModifiersToLocalizedString(Keys modifierKeyCode)
|
||||
{
|
||||
StringBuilder hotkeyString = new();
|
||||
if ((modifierKeyCode & Keys.Alt) > 0)
|
||||
{
|
||||
hotkeyString.Append(GetKeyName(Keys.Alt)).Append(" + ");
|
||||
}
|
||||
|
||||
if ((modifierKeyCode & Keys.Control) > 0)
|
||||
{
|
||||
hotkeyString.Append(GetKeyName(Keys.Control)).Append(" + ");
|
||||
}
|
||||
|
||||
if ((modifierKeyCode & Keys.Shift) > 0)
|
||||
{
|
||||
hotkeyString.Append(GetKeyName(Keys.Shift)).Append(" + ");
|
||||
}
|
||||
|
||||
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
|
||||
{
|
||||
hotkeyString.Append("Win").Append(" + ");
|
||||
}
|
||||
|
||||
return hotkeyString.ToString();
|
||||
}
|
||||
|
||||
public static Keys HotkeyModifiersFromString(string modifiersString)
|
||||
{
|
||||
Keys modifiers = Keys.None;
|
||||
if (!string.IsNullOrEmpty(modifiersString))
|
||||
{
|
||||
if (modifiersString.ToUpperInvariant().Contains("ALT+", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= Keys.Alt;
|
||||
}
|
||||
|
||||
if (modifiersString.ToUpperInvariant().Contains("CTRL+", StringComparison.InvariantCulture) ||
|
||||
modifiersString.ToUpperInvariant().Contains("STRG+", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= Keys.Control;
|
||||
}
|
||||
|
||||
if (modifiersString.ToUpperInvariant().Contains("SHIFT+", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= Keys.Shift;
|
||||
}
|
||||
|
||||
if (modifiersString.ToUpperInvariant().Contains("WIN+", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= Keys.LWin;
|
||||
}
|
||||
}
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public static Keys HotkeyFromString(string hotkey)
|
||||
{
|
||||
Keys key = Keys.None;
|
||||
if (!string.IsNullOrEmpty(hotkey))
|
||||
{
|
||||
if (hotkey.LastIndexOf('+') > 0)
|
||||
{
|
||||
hotkey = hotkey.Remove(0, hotkey.LastIndexOf('+') + 1).Trim();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
hotkey = hotkey.
|
||||
Replace("PgDn", "PageDown", StringComparison.InvariantCulture).
|
||||
Replace("PgUp", "PageUp", StringComparison.InvariantCulture);
|
||||
key = (Keys)Enum.Parse(typeof(Keys), hotkey);
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
Log.Warn($"{hotkey} can not be parsed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a hotkey.
|
||||
/// </summary>
|
||||
/// <param name="modifierKeyCode">The modifier, e.g.: Modifiers.CTRL, Modifiers.NONE or Modifiers.ALT .</param>
|
||||
/// <param name="virtualKeyCode">The virtual key code.</param>
|
||||
/// <param name="handler">A HotKeyHandler, this will be called to handle the hotkey press.</param>
|
||||
/// <returns>the hotkey number, -1 if failed.</returns>
|
||||
public static int RegisterHotKey(Keys modifierKeyCode, Keys virtualKeyCode, HotKeyHandler handler)
|
||||
{
|
||||
if (virtualKeyCode == Keys.None)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Convert Modifiers to fit HKM_SETHOTKEY
|
||||
uint modifiers = 0;
|
||||
if ((modifierKeyCode & Keys.Alt) > 0)
|
||||
{
|
||||
modifiers |= (uint)Modifiers.ALT;
|
||||
}
|
||||
|
||||
if ((modifierKeyCode & Keys.Control) > 0)
|
||||
{
|
||||
modifiers |= (uint)Modifiers.CTRL;
|
||||
}
|
||||
|
||||
if ((modifierKeyCode & Keys.Shift) > 0)
|
||||
{
|
||||
modifiers |= (uint)Modifiers.SHIFT;
|
||||
}
|
||||
|
||||
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
|
||||
{
|
||||
modifiers |= (uint)Modifiers.WIN;
|
||||
}
|
||||
|
||||
if (IsWindows7OrOlder)
|
||||
{
|
||||
modifiers |= (uint)Modifiers.NOREPEAT;
|
||||
}
|
||||
|
||||
if (NativeMethods.User32RegisterHotKey(HotkeyHwnd, hotKeyCounter, modifiers, (uint)virtualKeyCode))
|
||||
{
|
||||
KeyHandlers.Add(hotKeyCounter, handler);
|
||||
return hotKeyCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Info($"Couldn't register hotkey modifier {modifierKeyCode} virtualKeyCode {virtualKeyCode}");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnregisterHotkeys()
|
||||
{
|
||||
foreach (int hotkey in KeyHandlers.Keys)
|
||||
{
|
||||
NativeMethods.User32UnregisterHotKey(HotkeyHwnd, hotkey);
|
||||
}
|
||||
|
||||
KeyHandlers.Clear();
|
||||
}
|
||||
|
||||
public static string GetKeyName(Keys givenKey)
|
||||
{
|
||||
StringBuilder keyName = new();
|
||||
const uint numpad = 55;
|
||||
|
||||
Keys virtualKey = givenKey;
|
||||
string keyString = string.Empty;
|
||||
|
||||
// Make VC's to real keys
|
||||
switch (virtualKey)
|
||||
{
|
||||
case Keys.Alt:
|
||||
virtualKey = Keys.LMenu;
|
||||
break;
|
||||
case Keys.Control:
|
||||
virtualKey = Keys.ControlKey;
|
||||
break;
|
||||
case Keys.Shift:
|
||||
virtualKey = Keys.LShiftKey;
|
||||
break;
|
||||
case Keys.Multiply:
|
||||
if (NativeMethods.User32GetKeyNameText(numpad << 16, keyName, 100) > 0)
|
||||
{
|
||||
keyString = keyName.ToString().Replace("*", string.Empty, StringComparison.InvariantCulture).Trim().ToLowerInvariant();
|
||||
if (keyString.Contains('('))
|
||||
{
|
||||
return "* " + keyString;
|
||||
}
|
||||
|
||||
keyString = keyString[..1].ToUpperInvariant() + keyString[1..].ToLowerInvariant();
|
||||
}
|
||||
|
||||
return keyString + " *";
|
||||
case Keys.Divide:
|
||||
if (NativeMethods.User32GetKeyNameText(numpad << 16, keyName, 100) > 0)
|
||||
{
|
||||
keyString = keyName.ToString().Replace("*", string.Empty, StringComparison.InvariantCulture).Trim().ToLowerInvariant();
|
||||
if (keyString.Contains('('))
|
||||
{
|
||||
return "/ " + keyString;
|
||||
}
|
||||
|
||||
keyString = keyString[..1].ToUpperInvariant() + keyString[1..].ToLowerInvariant();
|
||||
}
|
||||
|
||||
return keyString + " /";
|
||||
}
|
||||
|
||||
uint scanCode = NativeMethods.User32MapVirtualKey((uint)virtualKey, (uint)MapType.MAPVK_VK_TO_VSC);
|
||||
|
||||
// because MapVirtualKey strips the extended bit for some keys
|
||||
switch (virtualKey)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Up:
|
||||
case Keys.Right:
|
||||
case Keys.Down: // arrow keys
|
||||
case Keys.Prior:
|
||||
case Keys.Next: // page up and page down
|
||||
case Keys.End:
|
||||
case Keys.Home:
|
||||
case Keys.Insert:
|
||||
case Keys.Delete:
|
||||
case Keys.NumLock:
|
||||
scanCode |= 0x100; // set extended bit
|
||||
break;
|
||||
case Keys.PrintScreen: // PrintScreen
|
||||
scanCode = 311;
|
||||
break;
|
||||
case Keys.Pause: // PrintScreen
|
||||
scanCode = 69;
|
||||
break;
|
||||
}
|
||||
|
||||
scanCode |= 0x200;
|
||||
if (NativeMethods.User32GetKeyNameText(scanCode << 16, keyName, 100) != 0)
|
||||
{
|
||||
string visibleName = keyName.ToString();
|
||||
if (visibleName.Length > 1)
|
||||
{
|
||||
visibleName = visibleName[..1] + visibleName[1..].ToLowerInvariant();
|
||||
}
|
||||
|
||||
return visibleName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return givenKey.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the current hotkey and resets the TextBox.
|
||||
/// </summary>
|
||||
public void ResetHotkey()
|
||||
{
|
||||
hotkey = Keys.None;
|
||||
modifiers = Keys.None;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to get/set the hotkey (e.g. Keys.A).
|
||||
/// </summary>
|
||||
/// <param name="hotkey">hotkey.</param>
|
||||
public void SetHotkey(string hotkey)
|
||||
{
|
||||
this.hotkey = HotkeyFromString(hotkey);
|
||||
modifiers = HotkeyModifiersFromString(hotkey);
|
||||
Redraw(true);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return HotkeyToString(HotkeyModifiers, Hotkey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles some misc keys, such as Ctrl+Delete and Shift+Insert.
|
||||
/// </summary>
|
||||
/// <param name="msg">msg.</param>
|
||||
/// <param name="keyData">keyData.</param>
|
||||
/// <returns>bool if handled.</returns>
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if (keyData == Keys.Delete || keyData == (Keys.Control | Keys.Delete))
|
||||
{
|
||||
ResetHotkey();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Paste
|
||||
if (keyData == (Keys.Shift | Keys.Insert))
|
||||
{
|
||||
return true; // Don't allow
|
||||
}
|
||||
|
||||
// Allow the rest
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Redraws the TextBox when necessary.
|
||||
/// </summary>
|
||||
/// <param name="bCalledProgramatically">Specifies whether this function was called by the Hotkey/HotkeyModifiers properties or by the user.</param>
|
||||
private void Redraw(bool bCalledProgramatically = false)
|
||||
{
|
||||
// No hotkey set
|
||||
if (hotkey == Keys.None)
|
||||
{
|
||||
Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
// Only validate input if it comes from the user
|
||||
if (bCalledProgramatically == false)
|
||||
{
|
||||
// No modifier or shift only, AND a hotkey that needs another modifier
|
||||
if ((modifiers == Keys.Shift || modifiers == Keys.None) && needNonShiftModifier.Contains((int)hotkey))
|
||||
{
|
||||
if (modifiers == Keys.None)
|
||||
{
|
||||
// Set Ctrl+Alt as the modifier unless Ctrl+Alt+<key> won't work...
|
||||
if (needNonAltGrModifier.Contains((int)hotkey) == false)
|
||||
{
|
||||
modifiers = Keys.Alt | Keys.Control;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ... in that case, use Shift+Alt instead.
|
||||
modifiers = Keys.Alt | Keys.Shift;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// User pressed Shift and an invalid key (e.g. a letter or a number),
|
||||
// that needs another set of modifier keys
|
||||
hotkey = Keys.None;
|
||||
Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check all Ctrl+Alt keys
|
||||
if ((modifiers == (Keys.Alt | Keys.Control)) && needNonAltGrModifier.Contains((int)hotkey))
|
||||
{
|
||||
// Ctrl+Alt+4 etc won't work; reset hotkey and tell the user
|
||||
hotkey = Keys.None;
|
||||
Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// I have no idea why this is needed, but it is. Without this code, pressing only Ctrl
|
||||
// will show up as "Control + ControlKey", etc.
|
||||
if (hotkey == Keys.Menu /* Alt */ || hotkey == Keys.ShiftKey || hotkey == Keys.ControlKey)
|
||||
{
|
||||
hotkey = Keys.None;
|
||||
}
|
||||
|
||||
Text = HotkeyToLocalizedString(modifiers, hotkey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populates the ArrayLists specifying disallowed hotkeys
|
||||
/// such as Shift+A, Ctrl+Alt+4 (would produce a dollar sign) etc.
|
||||
/// </summary>
|
||||
private void PopulateModifierLists()
|
||||
{
|
||||
// Shift + 0 - 9, A - Z
|
||||
for (Keys k = Keys.D0; k <= Keys.Z; k++)
|
||||
{
|
||||
needNonShiftModifier.Add((int)k);
|
||||
}
|
||||
|
||||
// Shift + Numpad keys
|
||||
for (Keys k = Keys.NumPad0; k <= Keys.NumPad9; k++)
|
||||
{
|
||||
needNonShiftModifier.Add((int)k);
|
||||
}
|
||||
|
||||
// Shift + Misc (,;<./ etc)
|
||||
for (Keys k = Keys.Oem1; k <= Keys.OemBackslash; k++)
|
||||
{
|
||||
needNonShiftModifier.Add((int)k);
|
||||
}
|
||||
|
||||
// Shift + Space, PgUp, PgDn, End, Home
|
||||
for (Keys k = Keys.Space; k <= Keys.Home; k++)
|
||||
{
|
||||
needNonShiftModifier.Add((int)k);
|
||||
}
|
||||
|
||||
// Misc keys that we can't loop through
|
||||
needNonShiftModifier.Add((int)Keys.Insert);
|
||||
needNonShiftModifier.Add((int)Keys.Help);
|
||||
needNonShiftModifier.Add((int)Keys.Multiply);
|
||||
needNonShiftModifier.Add((int)Keys.Add);
|
||||
needNonShiftModifier.Add((int)Keys.Subtract);
|
||||
needNonShiftModifier.Add((int)Keys.Divide);
|
||||
needNonShiftModifier.Add((int)Keys.Decimal);
|
||||
needNonShiftModifier.Add((int)Keys.Return);
|
||||
needNonShiftModifier.Add((int)Keys.Escape);
|
||||
needNonShiftModifier.Add((int)Keys.NumLock);
|
||||
|
||||
// Ctrl+Alt + 0 - 9
|
||||
for (Keys k = Keys.D0; k <= Keys.D9; k++)
|
||||
{
|
||||
needNonAltGrModifier.Add((int)k);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires when a key is pushed down. Here, we'll want to update the text in the box
|
||||
/// to notify the user what combination is currently pressed.
|
||||
/// </summary>
|
||||
private void HotkeyControl_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Clear the current hotkey
|
||||
if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete)
|
||||
{
|
||||
ResetHotkey();
|
||||
}
|
||||
else
|
||||
{
|
||||
modifiers = e.Modifiers;
|
||||
hotkey = e.KeyCode;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires when all keys are released. If the current hotkey isn't valid, reset it.
|
||||
/// Otherwise, do nothing and keep the text and hotkey as it was.
|
||||
/// </summary>
|
||||
private void HotkeyControl_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Somehow the PrintScreen only comes as a keyup, therefore we handle it here.
|
||||
if (e.KeyCode == Keys.PrintScreen)
|
||||
{
|
||||
modifiers = e.Modifiers;
|
||||
hotkey = e.KeyCode;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
if (hotkey == Keys.None && ModifierKeys == Keys.None)
|
||||
{
|
||||
ResetHotkey();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prevents the letter/whatever entered to show up in the TextBox
|
||||
/// Without this, a "A" key press would appear as "aControl, Alt + A".
|
||||
/// </summary>
|
||||
private void HotkeyControl_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
5523
FSI.BT.Tools/Global/UserInterface/Settings.Designer.cs
generated
Normal file
5523
FSI.BT.Tools/Global/UserInterface/Settings.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
1462
FSI.BT.Tools/Global/UserInterface/Settings.cs
Normal file
1462
FSI.BT.Tools/Global/UserInterface/Settings.cs
Normal file
File diff suppressed because it is too large
Load Diff
75
FSI.BT.Tools/Global/UserInterface/Settings.resx
Normal file
75
FSI.BT.Tools/Global/UserInterface/Settings.resx
Normal file
@@ -0,0 +1,75 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnFolder.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnRecursiveLevel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnOnlyFiles.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>42</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user