mirror of
https://github.com/Crypto-Notepad/Crypto-Notepad.git
synced 2026-03-11 08:55:25 +00:00
Added feature #11
This commit is contained in:
parent
e442c1888c
commit
839d4d9298
6 changed files with 102 additions and 52 deletions
|
|
@ -72,6 +72,9 @@
|
|||
<setting name="AutoSave" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="SendTo" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</Crypto_Notepad.Properties.Settings>
|
||||
<EncryptPad.Properties.Settings>
|
||||
<setting name="TopPosition" serializeAs="String">
|
||||
|
|
|
|||
|
|
@ -119,38 +119,52 @@ private void openAsotiations()
|
|||
{
|
||||
Form2 Form2 = new Form2();
|
||||
Form2.StartPosition = FormStartPosition.CenterScreen;
|
||||
string fileExtension = Path.GetExtension(args[1]);
|
||||
|
||||
try
|
||||
if (fileExtension == ".cnp")
|
||||
{
|
||||
try
|
||||
{
|
||||
string NameWithotPath = Path.GetFileName(args[1]);
|
||||
string opnfile = File.ReadAllText(args[1]);
|
||||
|
||||
Form2.ShowDialog();
|
||||
if (publicVar.okPressed == false)
|
||||
{
|
||||
OpenFile.FileName = "";
|
||||
return;
|
||||
}
|
||||
publicVar.okPressed = false;
|
||||
|
||||
string de = AES.Decrypt(opnfile, publicVar.encryptionKey.Get(), ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize);
|
||||
customRTB.Text = de;
|
||||
|
||||
this.Text = appName + NameWithotPath;
|
||||
|
||||
filename = args[1];
|
||||
string cc = customRTB.Text.Length.ToString(CultureInfo.InvariantCulture);
|
||||
customRTB.Select(Convert.ToInt32(cc), 0);
|
||||
}
|
||||
catch (CryptographicException)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Invalid key!", "Crypto Notepad", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
|
||||
if (dialogResult == DialogResult.Retry)
|
||||
{
|
||||
openAsotiations();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
string NameWithotPath = Path.GetFileName(args[1]);
|
||||
string opnfile = File.ReadAllText(args[1]);
|
||||
|
||||
Form2.ShowDialog();
|
||||
if (publicVar.okPressed == false)
|
||||
{
|
||||
OpenFile.FileName = "";
|
||||
return;
|
||||
}
|
||||
publicVar.okPressed = false;
|
||||
|
||||
string de = AES.Decrypt(opnfile, publicVar.encryptionKey.Get(), ps.TheSalt, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize);
|
||||
customRTB.Text = de;
|
||||
|
||||
string NameWithotPath = Path.GetFileName(args[1]);
|
||||
customRTB.Text = opnfile;
|
||||
this.Text = appName + NameWithotPath;
|
||||
|
||||
filename = args[1];
|
||||
string cc = customRTB.Text.Length.ToString(CultureInfo.InvariantCulture);
|
||||
customRTB.Select(Convert.ToInt32(cc), 0);
|
||||
string cc2 = customRTB.Text.Length.ToString(CultureInfo.InvariantCulture);
|
||||
customRTB.Select(Convert.ToInt32(cc2), 0);
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Invalid key!", "Crypto Notepad", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
|
||||
if (dialogResult == DialogResult.Retry)
|
||||
{
|
||||
openAsotiations();
|
||||
}
|
||||
}
|
||||
currentFilename = Path.GetFileName(OpenFile.FileName);
|
||||
}
|
||||
|
||||
|
|
|
|||
14
Crypto Notepad/Properties/Settings.Designer.cs
generated
14
Crypto Notepad/Properties/Settings.Designer.cs
generated
|
|
@ -283,6 +283,7 @@ public bool AutoLock {
|
|||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AutoSave {
|
||||
|
|
@ -293,5 +294,18 @@ public bool AutoSave {
|
|||
this["AutoSave"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool SendTo {
|
||||
get {
|
||||
return ((bool)(this["SendTo"]));
|
||||
}
|
||||
set {
|
||||
this["SendTo"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,11 @@
|
|||
<Setting Name="WindowState" Provider="PortableSettingsProvider" Type="System.Windows.Forms.FormWindowState" Scope="User">
|
||||
<Value Profile="(Default)">Normal</Value>
|
||||
</Setting>
|
||||
<Setting Name="AutoSave" Type="System.Boolean" Scope="User">
|
||||
<Setting Name="AutoSave" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="SendTo" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
63
Crypto Notepad/SettingsForm.Designer.cs
generated
63
Crypto Notepad/SettingsForm.Designer.cs
generated
|
|
@ -46,8 +46,8 @@ private void InitializeComponent()
|
|||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.comboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.comboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
|
|
@ -61,6 +61,7 @@ private void InitializeComponent()
|
|||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.checkBox6 = new System.Windows.Forms.CheckBox();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
|
|
@ -128,7 +129,7 @@ private void InitializeComponent()
|
|||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(252, 205);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Fonts and Colors";
|
||||
this.tabPage1.Text = "Editor";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panel3
|
||||
|
|
@ -236,7 +237,7 @@ private void InitializeComponent()
|
|||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(252, 205);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Encrypt/Decrypt";
|
||||
this.tabPage2.Text = "Encryption";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox2
|
||||
|
|
@ -246,16 +247,6 @@ private void InitializeComponent()
|
|||
this.textBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox2.TabIndex = 7;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label7.Location = new System.Drawing.Point(7, 86);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(98, 13);
|
||||
this.label7.TabIndex = 6;
|
||||
this.label7.Text = "Password iterations";
|
||||
//
|
||||
// comboBox4
|
||||
//
|
||||
this.comboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
|
|
@ -268,6 +259,16 @@ private void InitializeComponent()
|
|||
this.comboBox4.Size = new System.Drawing.Size(100, 21);
|
||||
this.comboBox4.TabIndex = 5;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label7.Location = new System.Drawing.Point(7, 86);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(98, 13);
|
||||
this.label7.TabIndex = 6;
|
||||
this.label7.Text = "Password iterations";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(136, 116);
|
||||
|
|
@ -321,11 +322,12 @@ private void InitializeComponent()
|
|||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.checkBox5);
|
||||
this.tabPage3.Controls.Add(this.checkBox4);
|
||||
this.tabPage3.Controls.Add(this.checkBox3);
|
||||
this.tabPage3.Controls.Add(this.checkBox2);
|
||||
this.tabPage3.Controls.Add(this.checkBox6);
|
||||
this.tabPage3.Controls.Add(this.checkBox5);
|
||||
this.tabPage3.Controls.Add(this.checkBox1);
|
||||
this.tabPage3.Controls.Add(this.checkBox2);
|
||||
this.tabPage3.Controls.Add(this.checkBox4);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
|
||||
|
|
@ -337,27 +339,27 @@ private void InitializeComponent()
|
|||
// checkBox5
|
||||
//
|
||||
this.checkBox5.AutoSize = true;
|
||||
this.checkBox5.Location = new System.Drawing.Point(7, 126);
|
||||
this.checkBox5.Location = new System.Drawing.Point(7, 110);
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.Size = new System.Drawing.Size(112, 17);
|
||||
this.checkBox5.TabIndex = 4;
|
||||
this.checkBox5.Text = "Auto-save on lock";
|
||||
this.checkBox5.Text = "Auto save on lock";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
this.checkBox4.AutoSize = true;
|
||||
this.checkBox4.Location = new System.Drawing.Point(7, 99);
|
||||
this.checkBox4.Location = new System.Drawing.Point(7, 64);
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.Size = new System.Drawing.Size(128, 17);
|
||||
this.checkBox4.TabIndex = 3;
|
||||
this.checkBox4.Text = "Auto-lock on minimize";
|
||||
this.checkBox4.Text = "Auto lock on minimize";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
this.checkBox3.AutoSize = true;
|
||||
this.checkBox3.Location = new System.Drawing.Point(7, 45);
|
||||
this.checkBox3.Location = new System.Drawing.Point(7, 133);
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.Size = new System.Drawing.Size(88, 17);
|
||||
this.checkBox3.TabIndex = 2;
|
||||
|
|
@ -367,11 +369,11 @@ private void InitializeComponent()
|
|||
// checkBox2
|
||||
//
|
||||
this.checkBox2.AutoSize = true;
|
||||
this.checkBox2.Location = new System.Drawing.Point(7, 72);
|
||||
this.checkBox2.Location = new System.Drawing.Point(7, 87);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(119, 17);
|
||||
this.checkBox2.Size = new System.Drawing.Size(122, 17);
|
||||
this.checkBox2.TabIndex = 1;
|
||||
this.checkBox2.Text = "Enable auto-update";
|
||||
this.checkBox2.Text = "Auto check updates";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox1
|
||||
|
|
@ -394,11 +396,21 @@ private void InitializeComponent()
|
|||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// checkBox6
|
||||
//
|
||||
this.checkBox6.AutoSize = true;
|
||||
this.checkBox6.Location = new System.Drawing.Point(7, 41);
|
||||
this.checkBox6.Name = "checkBox6";
|
||||
this.checkBox6.Size = new System.Drawing.Size(143, 17);
|
||||
this.checkBox6.TabIndex = 5;
|
||||
this.checkBox6.Text = "Show in \"Send to\" menu";
|
||||
this.checkBox6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(262, 270);
|
||||
this.ClientSize = new System.Drawing.Size(260, 270);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Controls.Add(this.saveSettingsButton);
|
||||
|
|
@ -454,5 +466,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.CheckBox checkBox4;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private System.Windows.Forms.CheckBox checkBox5;
|
||||
private System.Windows.Forms.CheckBox checkBox6;
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@ private void SettingsForm_Load(object sender, EventArgs e)
|
|||
checkBox3.Checked = ps.ShowToolbar;
|
||||
checkBox4.Checked = ps.AutoLock;
|
||||
checkBox5.Checked = ps.AutoSave;
|
||||
checkBox6.Checked = ps.SendTo;
|
||||
|
||||
if (ps.TheSalt != "")
|
||||
{
|
||||
|
|
@ -77,6 +78,7 @@ private void SetSettings(string value)
|
|||
ps.AutoCheckUpdate = checkBox2.Checked;
|
||||
ps.AutoLock = checkBox4.Checked;
|
||||
ps.AutoSave = checkBox5.Checked;
|
||||
ps.SendTo = checkBox6.Checked;
|
||||
ps.Save();
|
||||
publicVar.settingsChanged = true;
|
||||
|
||||
|
|
@ -95,6 +97,7 @@ private void SetSettings(string value)
|
|||
checkBox3.Checked = true;
|
||||
checkBox4.Checked = false;
|
||||
checkBox5.Checked = true;
|
||||
checkBox6.Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue