diff --git a/Crypto Notepad/App.config b/Crypto Notepad/App.config index fe63d01..bb9430b 100644 --- a/Crypto Notepad/App.config +++ b/Crypto Notepad/App.config @@ -114,6 +114,9 @@ Enable + + 0 + diff --git a/Crypto Notepad/MainForm.Designer.cs b/Crypto Notepad/MainForm.Designer.cs index ad4deeb..071c0ef 100644 --- a/Crypto Notepad/MainForm.Designer.cs +++ b/Crypto Notepad/MainForm.Designer.cs @@ -1,4 +1,4 @@ -namespace Crypto_Notepad +namespace Crypto_Notepad { partial class MainForm { diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index 21137bb..b707b10 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -54,11 +54,11 @@ private void DecryptAES() if (ps.TheSalt != null) { - de = AES.Decrypt(opnfile, TypedPassword.Value, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize); + de = AES.Decrypt(opnfile, TypedPassword.Value, ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize); } else { - de = AES.Decrypt(opnfile, TypedPassword.Value, null, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize); + de = AES.Decrypt(opnfile, TypedPassword.Value, null, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize); } CustomRTB.Text = de; @@ -909,7 +909,7 @@ private void NewToolStripMenuItem_Click(object sender, EventArgs e) if (filePath != "") { PublicVar.openFileName = Path.GetFileName(filePath); - } + } TypedPassword.Value = null; return; } @@ -1481,7 +1481,7 @@ private void SearchTextBox_KeyDown(object sender, KeyEventArgs e) private void CloseSearchPanel_Click(object sender, EventArgs e) { FindToolStripMenuItem_Click(this, new EventArgs()); - } + } private void CloseSearchPanel_MouseHover(object sender, EventArgs e) { @@ -1524,7 +1524,8 @@ private void MainVariablesToolStripMenuItem_Click(object sender, EventArgs e) #endif } + /*Debug Menu*/ } - } \ No newline at end of file +} \ No newline at end of file diff --git a/Crypto Notepad/Properties/Settings.Designer.cs b/Crypto Notepad/Properties/Settings.Designer.cs index 0b3b3c1..0ac4d85 100644 --- a/Crypto Notepad/Properties/Settings.Designer.cs +++ b/Crypto Notepad/Properties/Settings.Designer.cs @@ -476,5 +476,18 @@ public string InserKey { this["InserKey"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public string CustomColor { + get { + return ((string)(this["CustomColor"])); + } + set { + this["CustomColor"] = value; + } + } } } diff --git a/Crypto Notepad/Properties/Settings.settings b/Crypto Notepad/Properties/Settings.settings index f32051d..2c85910 100644 --- a/Crypto Notepad/Properties/Settings.settings +++ b/Crypto Notepad/Properties/Settings.settings @@ -107,5 +107,8 @@ Enable + + 0 + \ No newline at end of file diff --git a/Crypto Notepad/SettingsForm.Designer.cs b/Crypto Notepad/SettingsForm.Designer.cs index 20f7a5f..f7ec3da 100644 --- a/Crypto Notepad/SettingsForm.Designer.cs +++ b/Crypto Notepad/SettingsForm.Designer.cs @@ -56,6 +56,8 @@ private void InitializeComponent() this.LNBackgroundColor = new System.Windows.Forms.Label(); this.LNVisibleLabel = new System.Windows.Forms.Label(); this.EditorGroupBox = new System.Windows.Forms.GroupBox(); + this.InserKeyComboBox = new System.Windows.Forms.ComboBox(); + this.InsertKeyLabel = new System.Windows.Forms.Label(); this.HighlightsColorPanel = new System.Windows.Forms.Panel(); this.FontNameComboBox = new System.Windows.Forms.ComboBox(); this.HighlightsColorLabel = new System.Windows.Forms.Label(); @@ -86,8 +88,6 @@ private void InitializeComponent() this.HashLabel = new System.Windows.Forms.Label(); this.ResetSettingsButton = new System.Windows.Forms.Button(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.InsertKeyLabel = new System.Windows.Forms.Label(); - this.InserKeyComboBox = new System.Windows.Forms.ComboBox(); this.SettingsTabControl.SuspendLayout(); this.MainTabPage.SuspendLayout(); this.LineNumbersGroupBox.SuspendLayout(); @@ -396,6 +396,27 @@ private void InitializeComponent() this.EditorGroupBox.TabStop = false; this.EditorGroupBox.Text = "Editor"; // + // InserKeyComboBox + // + this.InserKeyComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.InserKeyComboBox.FormattingEnabled = true; + this.InserKeyComboBox.Items.AddRange(new object[] { + "Enable", + "Disable"}); + this.InserKeyComboBox.Location = new System.Drawing.Point(137, 165); + this.InserKeyComboBox.Name = "InserKeyComboBox"; + this.InserKeyComboBox.Size = new System.Drawing.Size(100, 23); + this.InserKeyComboBox.TabIndex = 14; + // + // InsertKeyLabel + // + this.InsertKeyLabel.AutoSize = true; + this.InsertKeyLabel.Location = new System.Drawing.Point(9, 165); + this.InsertKeyLabel.Name = "InsertKeyLabel"; + this.InsertKeyLabel.Size = new System.Drawing.Size(58, 15); + this.InsertKeyLabel.TabIndex = 13; + this.InsertKeyLabel.Text = "Insert key"; + // // HighlightsColorPanel // this.HighlightsColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -499,7 +520,7 @@ private void InitializeComponent() this.ApplicationTabPage.Location = new System.Drawing.Point(4, 24); this.ApplicationTabPage.Name = "ApplicationTabPage"; this.ApplicationTabPage.Padding = new System.Windows.Forms.Padding(3); - this.ApplicationTabPage.Size = new System.Drawing.Size(278, 213); + this.ApplicationTabPage.Size = new System.Drawing.Size(278, 239); this.ApplicationTabPage.TabIndex = 2; this.ApplicationTabPage.Text = "Application"; // @@ -573,7 +594,7 @@ private void InitializeComponent() this.IntegrationTabPage.Location = new System.Drawing.Point(4, 24); this.IntegrationTabPage.Name = "IntegrationTabPage"; this.IntegrationTabPage.Padding = new System.Windows.Forms.Padding(3); - this.IntegrationTabPage.Size = new System.Drawing.Size(278, 213); + this.IntegrationTabPage.Size = new System.Drawing.Size(278, 239); this.IntegrationTabPage.TabIndex = 3; this.IntegrationTabPage.Text = "Integration"; this.IntegrationTabPage.UseVisualStyleBackColor = true; @@ -623,7 +644,7 @@ private void InitializeComponent() this.EncryptionTabPage.Location = new System.Drawing.Point(4, 24); this.EncryptionTabPage.Name = "EncryptionTabPage"; this.EncryptionTabPage.Padding = new System.Windows.Forms.Padding(3); - this.EncryptionTabPage.Size = new System.Drawing.Size(278, 213); + this.EncryptionTabPage.Size = new System.Drawing.Size(278, 239); this.EncryptionTabPage.TabIndex = 1; this.EncryptionTabPage.Text = "Encryption"; // @@ -721,27 +742,6 @@ private void InitializeComponent() this.ResetSettingsButton.UseVisualStyleBackColor = true; this.ResetSettingsButton.Click += new System.EventHandler(this.ResetSettingsButton_Click); // - // InsertKeyLabel - // - this.InsertKeyLabel.AutoSize = true; - this.InsertKeyLabel.Location = new System.Drawing.Point(9, 165); - this.InsertKeyLabel.Name = "InsertKeyLabel"; - this.InsertKeyLabel.Size = new System.Drawing.Size(58, 15); - this.InsertKeyLabel.TabIndex = 13; - this.InsertKeyLabel.Text = "Insert key"; - // - // InserKeyComboBox - // - this.InserKeyComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.InserKeyComboBox.FormattingEnabled = true; - this.InserKeyComboBox.Items.AddRange(new object[] { - "Enable", - "Disable"}); - this.InserKeyComboBox.Location = new System.Drawing.Point(137, 165); - this.InserKeyComboBox.Name = "InserKeyComboBox"; - this.InserKeyComboBox.Size = new System.Drawing.Size(100, 23); - this.InserKeyComboBox.TabIndex = 14; - // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -757,6 +757,7 @@ private void InitializeComponent() this.Name = "SettingsForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Settings"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SettingsForm_FormClosed); this.Load += new System.EventHandler(this.SettingsForm_Load); this.SettingsTabControl.ResumeLayout(false); this.MainTabPage.ResumeLayout(false); diff --git a/Crypto Notepad/SettingsForm.cs b/Crypto Notepad/SettingsForm.cs index c759326..1a52e89 100644 --- a/Crypto Notepad/SettingsForm.cs +++ b/Crypto Notepad/SettingsForm.cs @@ -1,7 +1,8 @@ -using Microsoft.Win32; +using Microsoft.Win32; using System; using System.Drawing; using System.Drawing.Drawing2D; +using System.Linq; using System.Reflection; using System.Windows.Forms; @@ -106,7 +107,7 @@ private void SetSettings(string value) ps.Save(); PublicVar.settingsChanged = true; - Hide(); + Close(); } if (value == "default") @@ -252,6 +253,10 @@ private void SettingsForm_Load(object sender, EventArgs e) SaltTextBox.Visible = true; SaltLabel.Visible = true; } + + string custom_colors = ps.CustomColor; + int[] array_of_colors = custom_colors.Split(';').Select(n => Convert.ToInt32(n)).ToArray(); + colorDialog1.CustomColors = array_of_colors; } /*Form Events*/ @@ -361,6 +366,13 @@ private void GLColorPanel_Click(object sender, EventArgs e) GLColorPanel.BackColor = colorDialog1.Color; } + private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e) + { + string result = string.Join(";", colorDialog1.CustomColors); + ps.CustomColor = result; + ps.Save(); + } + /*Settings Section*/ } }