mirror of
https://github.com/Crypto-Notepad/Crypto-Notepad.git
synced 2026-03-11 08:55:25 +00:00
Registry entry for new function
This commit is contained in:
parent
92933ebc34
commit
ad6b903caa
1 changed files with 48 additions and 4 deletions
|
|
@ -55,16 +55,24 @@ private void SetSettings(string value)
|
|||
{
|
||||
if (value == "Save")
|
||||
{
|
||||
if (checkBox1.Checked == true)
|
||||
if (checkBox1.Checked)
|
||||
{
|
||||
AssociateExtension(Assembly.GetEntryAssembly().Location, "cnp");
|
||||
}
|
||||
|
||||
if (checkBox1.Checked == false)
|
||||
else
|
||||
{
|
||||
DissociateExtension(Assembly.GetEntryAssembly().Location, "cnp");
|
||||
}
|
||||
|
||||
if (checkBox7.Checked)
|
||||
{
|
||||
MenuIntegrate("enable");
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuIntegrate("disable");
|
||||
}
|
||||
|
||||
ps.RichForeColor = panel1.BackColor;
|
||||
ps.RichBackColor = panel2.BackColor;
|
||||
ps.HighlightsColor = panel3.BackColor;
|
||||
|
|
@ -123,7 +131,7 @@ public static void AssociateExtension(string applicationExecutablePath, string e
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void DissociateExtension(string applicationExecutablePath, string extension)
|
||||
{
|
||||
try
|
||||
|
|
@ -138,6 +146,42 @@ public static void DissociateExtension(string applicationExecutablePath, string
|
|||
}
|
||||
}
|
||||
|
||||
public static void MenuIntegrate(string action)
|
||||
{
|
||||
string appExePath = Assembly.GetEntryAssembly().Location;
|
||||
try
|
||||
{
|
||||
if (action == "enable")
|
||||
{
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\*\shell\", true);
|
||||
|
||||
key.CreateSubKey("Crypto Notepad").SetValue("icon", appExePath);
|
||||
key.CreateSubKey("Crypto Notepad").SetValue("SubCommands", "");
|
||||
key.CreateSubKey(@"Crypto Notepad\shell");
|
||||
|
||||
key.CreateSubKey(@"Crypto Notepad\shell\cmd1\").SetValue("MUIVerb", "Encrypt current file");
|
||||
key.CreateSubKey(@"Crypto Notepad\shell\cmd1\command").SetValue(string.Empty, "\"" + appExePath + "\" \"%1\" /e");
|
||||
|
||||
key.CreateSubKey(@"Crypto Notepad\shell\cmd2\").SetValue("MUIVerb", "Decrypt current file");
|
||||
key.CreateSubKey(@"Crypto Notepad\shell\cmd2\command").SetValue(string.Empty, "\"" + appExePath + "\" \"%1\" /o");
|
||||
|
||||
key.CreateSubKey(@"Crypto Notepad\shell\cmd3\").SetValue("MUIVerb", "Encrypt and replace current file");
|
||||
key.CreateSubKey(@"Crypto Notepad\shell\cmd3\command").SetValue(string.Empty, "\"" + appExePath + "\" \"%1\" /er");
|
||||
}
|
||||
|
||||
if (action == "disable")
|
||||
{
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\*\shell\", true);
|
||||
key.DeleteSubKeyTree("Crypto Notepad");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void panel1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
colorDialog1.Color = panel1.BackColor;
|
||||
|
|
|
|||
Loading…
Reference in a new issue