From a350fd6a0f0380187e9af139c70cbeecb716d97e Mon Sep 17 00:00:00 2001 From: Roman U Date: Fri, 7 Apr 2023 20:48:03 +0700 Subject: [PATCH] Add files via upload --- src/App.config | 6 + src/FRun.csproj | 94 ++++++++ src/NewApp.Designer.cs | 263 +++++++++++++++++++++++ src/NewApp.cs | 140 ++++++++++++ src/NewApp.resx | 120 +++++++++++ src/Program.cs | 310 +++++++++++++++++++++++++++ src/Properties/AssemblyInfo.cs | 36 ++++ src/Properties/Resources.Designer.cs | 63 ++++++ src/Properties/Resources.resx | 120 +++++++++++ src/RC/add.png | Bin 0 -> 1565 bytes src/RC/remove.png | Bin 0 -> 1590 bytes src/Settings.Designer.cs | 295 +++++++++++++++++++++++++ src/Settings.cs | 114 ++++++++++ src/Settings.resx | 175 +++++++++++++++ src/Types.cs | 18 ++ src/frun.ico | Bin 0 -> 26622 bytes 16 files changed, 1754 insertions(+) create mode 100644 src/App.config create mode 100644 src/FRun.csproj create mode 100644 src/NewApp.Designer.cs create mode 100644 src/NewApp.cs create mode 100644 src/NewApp.resx create mode 100644 src/Program.cs create mode 100644 src/Properties/AssemblyInfo.cs create mode 100644 src/Properties/Resources.Designer.cs create mode 100644 src/Properties/Resources.resx create mode 100644 src/RC/add.png create mode 100644 src/RC/remove.png create mode 100644 src/Settings.Designer.cs create mode 100644 src/Settings.cs create mode 100644 src/Settings.resx create mode 100644 src/Types.cs create mode 100644 src/frun.ico diff --git a/src/App.config b/src/App.config new file mode 100644 index 0000000..5754728 --- /dev/null +++ b/src/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/FRun.csproj b/src/FRun.csproj new file mode 100644 index 0000000..d757590 --- /dev/null +++ b/src/FRun.csproj @@ -0,0 +1,94 @@ + + + + + Debug + AnyCPU + {489EC9CC-F2B7-4168-A0EE-9989494B53FB} + WinExe + FRun + FRun + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + frun.ico + + + + + + + + + + + + + + + + Form + + + NewApp.cs + + + + + True + True + Resources.resx + + + Form + + + Settings.cs + + + + + + + + + NewApp.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + + + Settings.cs + + + + + + + \ No newline at end of file diff --git a/src/NewApp.Designer.cs b/src/NewApp.Designer.cs new file mode 100644 index 0000000..dbf9ad9 --- /dev/null +++ b/src/NewApp.Designer.cs @@ -0,0 +1,263 @@ + +namespace FRun +{ + partial class NewApp + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button2 = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.radioButton3 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.SuspendLayout(); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(12, 287); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(355, 23); + this.button2.TabIndex = 5; + this.button2.Text = "Добавить"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.button1); + this.groupBox1.Controls.Add(this.textBox2); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.textBox1); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(355, 147); + this.groupBox1.TabIndex = 6; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Основное"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(15, 112); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(323, 23); + this.button1.TabIndex = 9; + this.button1.Text = "Выбрать файл"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox2 + // + this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox2.Location = new System.Drawing.Point(15, 86); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(323, 20); + this.textBox2.TabIndex = 8; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 70); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(31, 13); + this.label2.TabIndex = 7; + this.label2.Text = "Путь"; + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1.Location = new System.Drawing.Point(15, 32); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(323, 20); + this.textBox1.TabIndex = 6; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 16); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(57, 13); + this.label1.TabIndex = 5; + this.label1.Text = "Название"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.groupBox4); + this.groupBox2.Controls.Add(this.groupBox3); + this.groupBox2.Location = new System.Drawing.Point(12, 165); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(353, 116); + this.groupBox2.TabIndex = 7; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Дополнительно"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.checkBox1); + this.groupBox4.Controls.Add(this.textBox3); + this.groupBox4.Controls.Add(this.label3); + this.groupBox4.Location = new System.Drawing.Point(131, 19); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(216, 88); + this.groupBox4.TabIndex = 1; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Параметры запуска"; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Location = new System.Drawing.Point(6, 62); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(198, 17); + this.checkBox1.TabIndex = 2; + this.checkBox1.Text = "Запуск от имени администратора"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // textBox3 + // + this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox3.Location = new System.Drawing.Point(6, 36); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(204, 20); + this.textBox3.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 20); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(63, 13); + this.label3.TabIndex = 0; + this.label3.Text = "Аргументы"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.radioButton3); + this.groupBox3.Controls.Add(this.radioButton2); + this.groupBox3.Controls.Add(this.radioButton1); + this.groupBox3.Location = new System.Drawing.Point(15, 19); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(110, 88); + this.groupBox3.TabIndex = 0; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Тип"; + // + // radioButton3 + // + this.radioButton3.AutoSize = true; + this.radioButton3.Location = new System.Drawing.Point(6, 62); + this.radioButton3.Name = "radioButton3"; + this.radioButton3.Size = new System.Drawing.Size(57, 17); + this.radioButton3.TabIndex = 2; + this.radioButton3.TabStop = true; + this.radioButton3.Text = "Папка"; + this.radioButton3.UseVisualStyleBackColor = true; + this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged); + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.Checked = true; + this.radioButton2.Location = new System.Drawing.Point(6, 16); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(54, 17); + this.radioButton2.TabIndex = 1; + this.radioButton2.TabStop = true; + this.radioButton2.Text = "Файл"; + this.radioButton2.UseVisualStyleBackColor = true; + this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.Location = new System.Drawing.Point(6, 39); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(99, 17); + this.radioButton1.TabIndex = 0; + this.radioButton1.Text = "Сайт / Ссылка"; + this.radioButton1.UseVisualStyleBackColor = true; + this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); + // + // NewApp + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(377, 322); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.button2); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "NewApp"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Новое приложение [FRun]"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Button button2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.RadioButton radioButton3; + private System.Windows.Forms.RadioButton radioButton2; + private System.Windows.Forms.RadioButton radioButton1; + } +} \ No newline at end of file diff --git a/src/NewApp.cs b/src/NewApp.cs new file mode 100644 index 0000000..edc2700 --- /dev/null +++ b/src/NewApp.cs @@ -0,0 +1,140 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FRun +{ + public partial class NewApp : Form + { + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); + const int EM_SETCUEBANNER = 0x1501; + + public NewApp() + { + InitializeComponent(); + SendMessage(textBox1.Handle, EM_SETCUEBANNER, 1, "Укажите название которые вы будете указывать для запуска"); + SendMessage(textBox2.Handle, EM_SETCUEBANNER, 1, @"[Путь до файла, Пример: C:\Path\to\File.exe]"); + SendMessage(textBox3.Handle, EM_SETCUEBANNER, 1, @"[Пример: -o test.exe]"); + } + + Types.runType rType = Types.runType.FILE; + + private void button1_Click(object sender, EventArgs e) + { + switch (rType) + { + case Types.runType.FILE: + using (OpenFileDialog fileChoose = new OpenFileDialog()) + { + fileChoose.Filter = "Исполняемые файлы | *.exe"; + fileChoose.Title = "Выберите файл который будет открываться"; + + if (fileChoose.ShowDialog() == DialogResult.OK) + { + textBox2.Text = fileChoose.FileName; + textBox2.SelectionStart = textBox2.Text.Length; + textBox2.ScrollToCaret(); + } + } + break; + + case Types.runType.FOLDER: + using (FolderBrowserDialog folderChoose = new FolderBrowserDialog()) + { + folderChoose.Description = "Выберите папку которая будет открыватся"; + + if (folderChoose.ShowDialog() == DialogResult.OK) + { + textBox2.Text = folderChoose.SelectedPath; + textBox2.SelectionStart = textBox2.Text.Length; + textBox2.ScrollToCaret(); + } + } + break; + } + } + + private void button2_Click(object sender, EventArgs e) + { + if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text)) + { + MessageBox.Show("Вы не указали один из параметров!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Stop); + return; + } + + using (RegistryKey AppsKey = Registry.CurrentUser.CreateSubKey($@"SOFTWARE\FRun", true)) + { + if (AppsKey.GetSubKeyNames().Any(x => x == textBox1.Text.ToLower())) + { + MessageBox.Show($"Название \"{textBox1.Text.ToLower()}\" уже используется"); + return; + } + using (RegistryKey appKey = AppsKey.CreateSubKey(textBox1.Text.ToLower(), true)) + { + appKey.SetValue("ExecParam", textBox2.Text); + appKey.SetValue("RunType", (int)rType); + + if (rType == Types.runType.FILE) + { + appKey.SetValue("Args", textBox3.Text != "" ? textBox3.Text : ""); + appKey.SetValue("UAC", checkBox1.Checked ? 1 : 0); + } + } + } + + this.DialogResult = DialogResult.OK; + Close(); + } + + private void radioButton2_CheckedChanged(object sender, EventArgs e) + { + if (radioButton2.Checked) + { + rType = Types.runType.FILE; + textBox2.Text = @""; + SendMessage(textBox2.Handle, EM_SETCUEBANNER, 1, @"[Путь до файла, Пример: C:\Path\to\File.exe]"); + button1.Text = "Выберите файл"; + button1.Enabled = true; + textBox3.Enabled = true; + checkBox1.Enabled = true; + } + } + + private void radioButton3_CheckedChanged(object sender, EventArgs e) + { + if (radioButton3.Checked) + { + rType = Types.runType.FOLDER; + textBox2.Text = @""; + SendMessage(textBox2.Handle, EM_SETCUEBANNER, 1, @"[Путь до папки, Пример: C:\Path\to\Folder]"); + button1.Text = "Выберите папку"; + button1.Enabled = true; + textBox3.Enabled = false; + checkBox1.Enabled = false; + } + } + + private void radioButton1_CheckedChanged(object sender, EventArgs e) + { + if (radioButton1.Checked) + { + rType = Types.runType.LINK; + textBox2.Text = @""; + SendMessage(textBox2.Handle, EM_SETCUEBANNER, 1, @"[Пример: https://ya.ru или tg://resolve?domain=ds1nc]"); + button1.Text = "Выберите ссылку"; + button1.Enabled = false; + textBox3.Enabled = false; + checkBox1.Enabled = false; + } + } + } +} diff --git a/src/NewApp.resx b/src/NewApp.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/src/NewApp.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/Program.cs b/src/Program.cs new file mode 100644 index 0000000..8239d7a --- /dev/null +++ b/src/Program.cs @@ -0,0 +1,310 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Security.Principal; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Microsoft.Win32; + +namespace FRun +{ + class Program + { + const int HWND_BROADCAST = 0xffff; + const uint WM_SETTINGCHANGE = 0x001a; + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + static extern bool SendNotifyMessage(IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam); + + public static string ShowVersion(int VersionNumbers) + { + string[] ver = Application.ProductVersion.Split('.'); + string[] builderVer = new string[VersionNumbers]; + + for (int i = 0; i < VersionNumbers; i++) + { + builderVer.SetValue(ver[i], i); + } + + return string.Join(".", builderVer); + } + + public static void RunFile(string FilePath, string Arguments, bool UAC, bool Hidden, bool WaitForExit) + { + Process process = new Process(); + ProcessStartInfo processStartInfo = new ProcessStartInfo(); + + processStartInfo.WindowStyle = !Hidden ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden; + processStartInfo.FileName = FilePath; + processStartInfo.Arguments = Arguments; + + if (UAC) processStartInfo.Verb = "runas"; + + process.StartInfo = processStartInfo; + process.Start(); + + if (WaitForExit) process.WaitForExit(); + } + public static bool IsAdministrator() + { + return (new WindowsPrincipal(WindowsIdentity.GetCurrent())) + .IsInRole(WindowsBuiltInRole.Administrator); + } + public static void HelpMsg() + { + MessageBox.Show($"FastRun [FRun] v{ShowVersion(2)} beta\nРазработчик: DesConnet\nСайт: https://ds1nc.ru\n\nДля быстрого запуска программы можно использовать окно выполнить или командную строку.\n\nПример использования: frun dnspy(Регистр не важен)\n\nДоступные аргументы:\n--about - Открывает окно помощи\n--settings - Открывает окно настроек\n--add - Добавить новую программу\n--clear - Очистить список программ\n--install - Выполнить установку FRun в данной директории\n--uninstall - Удаление FRun\n--prefix [prefix] - Изменение префикса", $"FRun v{ShowVersion(2)} beta (c0d9d by DesConnet)", MessageBoxButtons.OK, MessageBoxIcon.Information); + Environment.Exit(1); + } + + [STAThread] + static void Main(string[] args) + { + if (args.Length == 0) HelpMsg(); + + #region Команды + switch (args[0]) + { + case "--about": + HelpMsg(); + break; + + case "--settings": + if (IsAdministrator()) new Settings().ShowDialog(); + else + { + RunFile(Application.ExecutablePath, "--settings", true, false, false); + Environment.Exit(1); + } + break; + + case "--add": + if (IsAdministrator()) + { + new NewApp().ShowDialog(); + Environment.Exit(1); + } + else + { + RunFile(Application.ExecutablePath, "--add", true, false, false); + Environment.Exit(1); + } + break; + + case "--clear": + if (IsAdministrator()) + { + if (MessageBox.Show("Вы действительно хотите удалить все приложения из FRun?", "Очистка программ [FRun]", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + using (RegistryKey frun = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\FRun", true)) + { + try + { + string[] Apps = frun.GetSubKeyNames(); + + foreach (string app in Apps) + { + frun.DeleteSubKeyTree(app); + } + MessageBox.Show("Очистка прошла успешно!", "Очистка программ [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + } + Environment.Exit(1); + } + else + { + RunFile(Application.ExecutablePath, "--clear", true, false, false); + Environment.Exit(1); + } + break; + + case "--install": + if (IsAdministrator()) + { + using (RegistryKey frun = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\FRun", true)) + { + if (frun.GetValue("InstalledPath") == null) + { + if (MessageBox.Show("Вы действительно хотите установить FRun в данной директории?", "Установка [FRun]", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + try + { + frun.SetValue("InstalledPath", Application.ExecutablePath); + using (RegistryKey Env = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", true)) + { + string oldEnv = Env.GetValue("Path").ToString(); + Env.SetValue("Path", $"{(oldEnv.EndsWith(";") ? oldEnv : $"{oldEnv};")}{Path.GetDirectoryName(Application.ExecutablePath)};"); + SendNotifyMessage((IntPtr)HWND_BROADCAST, WM_SETTINGCHANGE, (UIntPtr)0, "Environment"); + } + + MessageBox.Show("Установка прошла успешно!\nТеперь вы можете вызывать FRun из окна выполнить и командной строки!", "Установка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + } + else + { + MessageBox.Show("FRun уже установлен!", "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + + Environment.Exit(1); + } + else + { + RunFile(Application.ExecutablePath, "--install", true, false, false); + Environment.Exit(1); + } + break; + + case "--uninstall": + if (IsAdministrator()) + { + using (RegistryKey frun = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\FRun", true)) + { + if (frun.GetValue("InstalledPath") != null) + { + if (MessageBox.Show("Вы действительно хотите удалить FRun?", "Установка [FRun]", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + try + { + frun.DeleteValue("InstalledPath"); + using (RegistryKey Env = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", true)) + { + string[] oldEnv = Env.GetValue("Path").ToString().Split(';'); + oldEnv = oldEnv.Where(x => x != Path.GetDirectoryName(Application.ExecutablePath)).ToArray(); + + + + Env.SetValue("Path", $"{string.Join(";", oldEnv)}"); + SendNotifyMessage((IntPtr)HWND_BROADCAST, WM_SETTINGCHANGE, (UIntPtr)0, "Environment"); + } + + MessageBox.Show("Удаление прошло успешно!", "Установка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + } + else + { + MessageBox.Show("FRun ещё не установлен!", "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + + Environment.Exit(1); + } + else + { + RunFile(Application.ExecutablePath, "--uninstall", true, false, false); + Environment.Exit(1); + } + break; + + case "--prefix": + if (IsAdministrator()) + { + if (args[1] == null) + { + MessageBox.Show("Не указан префикс", "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + Environment.Exit(1); + } + + File.Move(Application.ExecutablePath, $@"{Path.GetDirectoryName(Application.ExecutablePath)}\{args[1]}.exe"); + return; + } + else + { + RunFile(Application.ExecutablePath, $"--prefix {(args[1] != null ? args[1] : "")}", true, false, false); + Environment.Exit(1); + } + break; + + case "--remove": + if (IsAdministrator()) + { + if (args[1] == null) + { + MessageBox.Show("Не указана программа", "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + Environment.Exit(1); + } + + using (RegistryKey frun = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\FRun", true)) + { + string[] Apps = frun.GetSubKeyNames(); + + if (Apps.Any(x => x == args[1])) + { + frun.DeleteSubKeyTree(args[1]); + } + else + { + MessageBox.Show($"Не удалось найти программу с названием \"{args[1]}\"", "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + return; + } + else + { + RunFile(Application.ExecutablePath, $"--remove {(args[1] != null ? args[1] : "")}", true, false, false); + Environment.Exit(1); + } + break; + } + #endregion + + #region Запуск приложений + using (RegistryKey frun = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\FRun", true)) + { + try + { + string[] Apps = frun.GetSubKeyNames(); + + if (Apps.Any(x => x == args[0])) + { + using (RegistryKey AppKey = frun.OpenSubKey(Apps.Single(x => x == args[0]), true)) + { + switch ((int)AppKey.GetValue("RunType")) + { + case (int)Types.runType.FILE: + RunFile(AppKey.GetValue("ExecParam").ToString(), AppKey.GetValue("Args") != null ? AppKey.GetValue("Args").ToString() : "", AppKey.GetValue("UAC") != null ? (int)AppKey.GetValue("UAC") == 0 ? false : true : false, false, false); + Environment.Exit(1); + break; + + case (int)Types.runType.FOLDER: + RunFile("explorer.exe", AppKey.GetValue("ExecParam").ToString(), false, false, false); + Environment.Exit(1); + break; + + case (int)Types.runType.LINK: + RunFile(AppKey.GetValue("ExecParam").ToString(), "", false, false, false); + Environment.Exit(1); + break; + } + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка [FRun]", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + } + #endregion + + HelpMsg(); + } + } +} diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6b36579 --- /dev/null +++ b/src/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанные с этой сборкой. +[assembly: AssemblyTitle("Fast run applications [FRun]")] +[assembly: AssemblyDescription("Fast run applications")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("[DS1NC] DesConnet")] +[assembly: AssemblyProduct("FRun")] +[assembly: AssemblyCopyright("Copyright © DesConnet 2023")] +[assembly: AssemblyTrademark("[DS1NC] DesConnet")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// из модели COM задайте для атрибута ComVisible этого типа значение true. +[assembly: ComVisible(false)] + +// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM +[assembly: Guid("489ec9cc-f2b7-4168-a0ee-9989494b53fb")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Номер редакции +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.1.0.0")] +[assembly: AssemblyFileVersion("0.1.0.0")] diff --git a/src/Properties/Resources.Designer.cs b/src/Properties/Resources.Designer.cs new file mode 100644 index 0000000..302cb76 --- /dev/null +++ b/src/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace FRun.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FRun.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/Properties/Resources.resx b/src/Properties/Resources.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/src/Properties/Resources.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/RC/add.png b/src/RC/add.png new file mode 100644 index 0000000000000000000000000000000000000000..26214e881f851ff8bba8c52478fd8802946c34cc GIT binary patch literal 1565 zcmZ{kdpOez7{`B>TP`J>+{z+Kht))Aqq+RBB_pk9lw5MZl*?+`Dw>*f*cxSN z#TGS}cu1|eP3fLnO2`q%%y8EE>-=+`_xZk`_ws!I{bu=MJvG$~)c^p{#GpYxIdy+a zRaxGzW^L4zLow3D+XVo)G<8{sl6>D3hW7IYfV3?DaGnAHQu*opHvmY51Hkw(06-J~ zfZmCchW(E6hjOTwCkU+kt}+2TSAJQ20)04HPV~R>=#1SXA5>B>-tH=63d&ll8=%KB zS^z*v0|UC?99|y05f~Tb|Hs89L04h&SHjmJZsdf)dy`b^U9&rs%ar_Xv6icGhVD^6 zJVRR{hNZUm@;lWwBQ$-z(lt{>$ACYdI)k{p^2(|(9AAkAxfJS#(M2YVv=Owo@;Ypi zry>)LCz2Le!FYTx{zq`{)&bm7rq$M|72~GHS@rE_$rmS4_cfhn8C?_5@pn8n{rk8I z*cTl5l!ve<4octa^!WronaR36*{xTaMoWk8{@~D~>W-b7B0N@ix7zOJOi4~_aqie$2Hm!P*7my36F2V#v@}8kr-x+s&5ubS?R0hS}PWnp`Y@6kWri- z2)(z`Lc!cQ(d>%*z5+$be&-T!gby{yHQSme^_!_>xhSm zoug(W5G)<5)^=XpzCQ4JcNS8@rRfnLGrUSbv-GLxg&#v46gH=`{ntXgfG}JMi${bM zA9}EiN-$wI^X&3Xl_np!BPBIR7o!73;%e!2hDyVwR}D_nz8)jIv@9>nsC7E)zF+eV zWNKumF>;Ov8ll^|)ru$>P(M?`pg|?4x!JItb1`?958G^hbf)%om9LVZEw2~^!Frs|(x)_=>F^X$#MHv8%yW=(tOsJbkP^+)j z1VJWsbkvib@PR1@vkAT7Y0IXpAOjOyKQ$&@BcFGjpAFPr*zzm(QSr~1+V$0hLs1>x zj{W5Z_pJ)~g5uneZ_why_CnN-Tjsa&Mv}JFSG!y1ju|1(Jv%YK2Z-=zJIr+rR}*1~ z1dy#WSg*E`MTKzQh~F`*gd^Ux*Cdcc%iYCQv%|J9hnU}AtcNodOJvV#^m_hU^>?{~m9#8m57CEVnF8`rRsU6;rd^{tsRrH!(x{{+tI1 zM_RB3`hI0-YHEgw6{Qy2RYUN&dL~Ct^t-L&>65%U7r|wI<>yP$f#QEsod~Hos7+k;kodS zbPyJO87_2+S#Rre{&j6Sb-y8`tKrdUK3VofB+!Xuv*CA9w)K)_$XKZpac(v<%ZrR% znSza`m*VeZw;gPKsBtBZDonlhc1=Fa#aTBtfuopwv*xqo@@uYTWaIR`j!K7ZS45A? z(*{OHESttG*FsCl@#8y&qxb9P9In#i#5B?;*JJO1?IKf+D3!*>#-y>=pKAo?(uQWl zHlH1*2iin>^9MwQAC?I+C@K1BLBt@X>$w+_I6QEseYt0mKqgIxsqpE%2^iZ_lcE*- z=_705t1Nhh5H>E8RCS(OOO8E7ni4*-H5NXYE>UT2Qjm#bS+{qM-jGM7d5U{LN_a@h zaYR_saXEmU@SQd=xHSxJhqJarz#S0Q_Lgus0uIk-hstC7KZf|k@aPEQ{~N}n@0R2S N0OO7Y@4Ft$_y<#h*`ELa literal 0 HcmV?d00001 diff --git a/src/RC/remove.png b/src/RC/remove.png new file mode 100644 index 0000000000000000000000000000000000000000..f2d1f147cab9517037074013d0c5411b5474b8d7 GIT binary patch literal 1590 zcmV-62Fdw}P)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 zVoOIv0RI600RN!9r;`8x00(qQO+^Ri0R|8W1B-LMbpQYb6-h)vR5;5`luc+|Wg5qS z?|IKT_ndp~x%cKKZ4=W>+DuB5F2;qVOihboIz(ZJTBRCL2LuPiS_`2RK!&kydU z$F}*~_U!gdteo_X=bPg`4CPc_!ppJ=SFKhfISdUDT8FMTp~^ysVQ za(TT9LlRBnz5V+iKxL0@^Ul6~oE;hAPiN1Hr|ar=H#aqXwasZ$T2sg&4HJb~soR0ao8D=VbHN|Jnh6 z!`J0o=g)KN$dOmFzW=eI!Xre)n!_p5222Vqp1;FIf9m zAM*BX5?u!=N#Yowy~VOjeQT*?Cd zV^~6v778TQD#_|9QKdp+7==d~8VtScd8sNEeNEHQTo>uO$XpKPIEbA)QMI-BK>$jj z+&p5(qi|suS*;=r1EjqB9h&CPmCLDqVsPE%SBc`7sAD_+wrvQ~R=;*z>`E0K?njdAhXwL6>EukXxev%fHk zMReODbo0o?A1TevVHFDKxg43bHG*oDB#dxoXOUq@9LL;Ak_$uA)9(jgeYGZM#>Y9b zxLEm3bF*JlEbca4H)A;t*4ip=l3ZBy?fLD3=bcl4T66Ly6z{2f$2Dyu8YWK?;b0kN6Y0f3k5Q+OPa~x zYnpd$b@dDjWyZy(G^$mvMo%!#-CubPQt%gC)Fv!F)=YqhSymIAoDVO`k zv~49!v!HZ6lYorkSb1w}{_?`Y_1T%3flDJJfBpMspZ#|z3|D>yG~V-}xGz|Ms_(O@ zriMd{i`rw5@7lGirFqMiEpDl_4k1`wUM|m!k58WY^2_OASn0K_bRi6}GZ_E|JdX#m z`?nSfSA*FoK8Sp#+egeD#PgVFgQ9jIV&(QIxsLo(ii3c001R)MObuX zVRU6WZEs|0W_bWIFfubOFflDKHdHY-IxsjoH90FVFgh?WGmo!Y0000PbVXQnQ*UN; ocVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUy07*qoM6N<$f;ao+I{*Lx literal 0 HcmV?d00001 diff --git a/src/Settings.Designer.cs b/src/Settings.Designer.cs new file mode 100644 index 0000000..f1971ff --- /dev/null +++ b/src/Settings.Designer.cs @@ -0,0 +1,295 @@ + +namespace FRun +{ + partial class Settings + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Settings)); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabControl2 = new System.Windows.Forms.TabControl(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.listView1 = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.tabPage4 = new System.Windows.Forms.TabPage(); + this.listView2 = new System.Windows.Forms.ListView(); + this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.tabPage5 = new System.Windows.Forms.TabPage(); + this.listView3 = new System.Windows.Forms.ListView(); + this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.tabControl1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabControl2.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.tabPage4.SuspendLayout(); + this.tabPage5.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(12, 12); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(527, 298); + this.tabControl1.TabIndex = 0; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.tabControl2); + this.tabPage2.Controls.Add(this.toolStrip1); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(519, 272); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Программы"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // tabControl2 + // + this.tabControl2.Controls.Add(this.tabPage3); + this.tabControl2.Controls.Add(this.tabPage4); + this.tabControl2.Controls.Add(this.tabPage5); + this.tabControl2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl2.Location = new System.Drawing.Point(3, 28); + this.tabControl2.Name = "tabControl2"; + this.tabControl2.SelectedIndex = 0; + this.tabControl2.Size = new System.Drawing.Size(513, 241); + this.tabControl2.TabIndex = 2; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.listView1); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(505, 215); + this.tabPage3.TabIndex = 0; + this.tabPage3.Text = "Файлы"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // listView1 + // + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.columnHeader3, + this.columnHeader4}); + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.FullRowSelect = true; + this.listView1.GridLines = true; + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(3, 3); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(499, 209); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.View = System.Windows.Forms.View.Details; + // + // columnHeader1 + // + this.columnHeader1.Text = "Название"; + this.columnHeader1.Width = 72; + // + // columnHeader2 + // + this.columnHeader2.Text = "Путь"; + this.columnHeader2.Width = 196; + // + // columnHeader3 + // + this.columnHeader3.Text = "Аргументы"; + this.columnHeader3.Width = 167; + // + // columnHeader4 + // + this.columnHeader4.Text = "UAC"; + // + // tabPage4 + // + this.tabPage4.Controls.Add(this.listView2); + this.tabPage4.Location = new System.Drawing.Point(4, 22); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Padding = new System.Windows.Forms.Padding(3); + this.tabPage4.Size = new System.Drawing.Size(505, 215); + this.tabPage4.TabIndex = 1; + this.tabPage4.Text = "Ссылки \\ Сайты"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // listView2 + // + this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader5, + this.columnHeader6}); + this.listView2.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView2.FullRowSelect = true; + this.listView2.GridLines = true; + this.listView2.HideSelection = false; + this.listView2.Location = new System.Drawing.Point(3, 3); + this.listView2.Name = "listView2"; + this.listView2.Size = new System.Drawing.Size(499, 209); + this.listView2.TabIndex = 0; + this.listView2.UseCompatibleStateImageBehavior = false; + this.listView2.View = System.Windows.Forms.View.Details; + // + // columnHeader5 + // + this.columnHeader5.Text = "Название"; + this.columnHeader5.Width = 95; + // + // columnHeader6 + // + this.columnHeader6.Text = "Путь"; + this.columnHeader6.Width = 393; + // + // tabPage5 + // + this.tabPage5.Controls.Add(this.listView3); + this.tabPage5.Location = new System.Drawing.Point(4, 22); + this.tabPage5.Name = "tabPage5"; + this.tabPage5.Size = new System.Drawing.Size(505, 215); + this.tabPage5.TabIndex = 2; + this.tabPage5.Text = "Папки"; + this.tabPage5.UseVisualStyleBackColor = true; + // + // listView3 + // + this.listView3.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader7, + this.columnHeader8}); + this.listView3.FullRowSelect = true; + this.listView3.GridLines = true; + this.listView3.HideSelection = false; + this.listView3.Location = new System.Drawing.Point(3, 3); + this.listView3.Name = "listView3"; + this.listView3.Size = new System.Drawing.Size(499, 209); + this.listView3.TabIndex = 1; + this.listView3.UseCompatibleStateImageBehavior = false; + this.listView3.View = System.Windows.Forms.View.Details; + // + // columnHeader7 + // + this.columnHeader7.Text = "Название"; + this.columnHeader7.Width = 95; + // + // columnHeader8 + // + this.columnHeader8.Text = "Путь"; + this.columnHeader8.Width = 393; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2}); + this.toolStrip1.Location = new System.Drawing.Point(3, 3); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(513, 25); + this.toolStrip1.TabIndex = 1; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "Добавить программу"; + this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = "Удалить программу"; + this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click); + // + // Settings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(551, 319); + this.Controls.Add(this.tabControl1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.Name = "Settings"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Настройки [FRun]"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Settings_FormClosing); + this.Load += new System.EventHandler(this.Settings_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); + this.tabControl2.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); + this.tabPage4.ResumeLayout(false); + this.tabPage5.ResumeLayout(false); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.ToolStripButton toolStripButton2; + private System.Windows.Forms.TabControl tabControl2; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.ColumnHeader columnHeader3; + private System.Windows.Forms.ColumnHeader columnHeader4; + private System.Windows.Forms.TabPage tabPage4; + private System.Windows.Forms.ListView listView2; + private System.Windows.Forms.ColumnHeader columnHeader5; + private System.Windows.Forms.ColumnHeader columnHeader6; + private System.Windows.Forms.TabPage tabPage5; + private System.Windows.Forms.ListView listView3; + private System.Windows.Forms.ColumnHeader columnHeader7; + private System.Windows.Forms.ColumnHeader columnHeader8; + } +} \ No newline at end of file diff --git a/src/Settings.cs b/src/Settings.cs new file mode 100644 index 0000000..2fb252d --- /dev/null +++ b/src/Settings.cs @@ -0,0 +1,114 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FRun +{ + public partial class Settings : Form + { + public Settings() + { + InitializeComponent(); + } + + public void getListApplications() + { + listView1.Items.Clear(); + listView2.Items.Clear(); + listView3.Items.Clear(); + using (RegistryKey frun = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\FRun", true)) + { + try + { + foreach (string keyName in frun.GetSubKeyNames()) + { + using (RegistryKey appKey = frun.OpenSubKey(keyName, true)) + { + var row = new string[5]; + var listview = new ListViewItem(); + + switch ((int)appKey.GetValue("RunType")) + { + case (int)Types.runType.FILE: + row = new string[] { keyName, appKey.GetValue("ExecParam").ToString(), appKey.GetValue("Args") != null ? appKey.GetValue("Args").ToString() : "", appKey.GetValue("UAC") != null ? (int)appKey.GetValue("UAC") == 0 ? "False" : "True" : "False" }; + listview = new ListViewItem(row); + + + listview.Tag = appKey.Name.Split('\\')[3]; + listView1.Items.Add(listview); + break; + + case (int)Types.runType.LINK: + row = new string[] { keyName, appKey.GetValue("ExecParam").ToString() }; + listview = new ListViewItem(row); + + + listview.Tag = appKey.Name.Split('\\')[3]; + listView2.Items.Add(listview); + break; + + case (int)Types.runType.FOLDER: + row = new string[] { keyName, appKey.GetValue("ExecParam").ToString() }; + listview = new ListViewItem(row); + + + listview.Tag = appKey.Name.Split('\\')[3]; + listView3.Items.Add(listview); + break; + } + + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString()); + } + } + } + + private void Settings_Load(object sender, EventArgs e) + { + getListApplications(); + } + + private void Settings_FormClosing(object sender, FormClosingEventArgs e) + { + if (e.CloseReason == CloseReason.UserClosing) + { + Environment.Exit(1); + } + } + + private void toolStripButton2_Click(object sender, EventArgs e) + { + string item = ""; + + if (tabControl2.SelectedTab == tabPage3 && listView1.SelectedIndices.Count != 0 || tabControl2.SelectedTab == tabPage4 && listView2.SelectedIndices.Count != 0 || tabControl2.SelectedTab == tabPage5 && listView3.SelectedIndices.Count != 0) + { + if (tabControl2.SelectedTab == tabPage3) item = (string)listView1.FocusedItem.Tag; + if (tabControl2.SelectedTab == tabPage4) item = (string)listView2.FocusedItem.Tag; + if (tabControl2.SelectedTab == tabPage5) item = (string)listView3.FocusedItem.Tag; + + using (RegistryKey AppsKey = Registry.CurrentUser.CreateSubKey($@"SOFTWARE\FRun", true)) + { + AppsKey.DeleteSubKeyTree(item); + } + + getListApplications(); + } + } + + private void toolStripButton1_Click(object sender, EventArgs e) + { + if (new NewApp().ShowDialog() == DialogResult.OK) getListApplications(); + } + } +} diff --git a/src/Settings.resx b/src/Settings.resx new file mode 100644 index 0000000..55e54d1 --- /dev/null +++ b/src/Settings.resx @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + 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 + + + \ No newline at end of file diff --git a/src/Types.cs b/src/Types.cs new file mode 100644 index 0000000..326bf49 --- /dev/null +++ b/src/Types.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FRun +{ + internal class Types + { + public enum runType + { + FILE = 0, + LINK = 1, + FOLDER = 2 + } + } +} diff --git a/src/frun.ico b/src/frun.ico new file mode 100644 index 0000000000000000000000000000000000000000..c34d0cf2a417570c70f51b86c628472e51f86781 GIT binary patch literal 26622 zcmeI4Nlz3(7>3)k2M;EmJ^DL9(P+Y=KtP#c6A&0-Kp=qxA_fpagDe8FD2pJ5MP!i~ zmV+iP2TjzN2u8u9NB=?DZ$XpJq>Jh4rAC==NX-ibFM zcafr;P!#2q8q_3ZL=8yiud9l3{OE4jO`vxoKm>>Y5g-CY;9nrH`Q|yJAZ8Hm8i8F_ zVjKkn24F+{tZRe#S!ahiN&JXkG}mU*AL)G2Msb<^poi{}7Pj^?z{iI%h6dzyjWpZR z4(2ZG4$pTV8h&6m9vI-`0;31xt*oNl!*bKk@ldJ8d(^bG?G;{TEb!1WL#%=8+d+Pv z@-r{E%21a6x<^|$m&MO>tgIwcI3|DTWw!Wbj+ccFjpmG*w6Q=xx6#yAW!Z+Ac4Y9w zdZ+2(Aa+`R!4NuxPJI^F!-hs5=Qs6gK~|i1(NTu6zzEqwlDf0{y}I3eri#f zNYhL5Q+GA3-VNLg z*na5iiQ+Q&p>6oCpeNkRAH)#;LHJlv7QTK_zpbV>w^wo7V=MiR*p|i5n{t{x3GVst zRUKk3!=IItc9sXMcVG<7fgODPZahEB&p6N4)b?>tSL98y%}^FU=miYH2)<}AG7888 zTQ}HgnjN0+;%(pQwEv7)CO@tJSP!wMz^@wITIK<9q`}v(m2>N}wyu!#!@0n28`0or zx6gL#V;(H+J)^?27CZK0kso;B88N=+foGk>FM8iUidFsD(VV_6@w2C0;z#`S^GSA` z^hf%WtvP*rq(9Q1UJtV4q(9Q1Y|ZK0BmK$IA2?GmW?<&`ONgB@JG1kb_z^$1G(huL ztSvLli68MZqZ7Bvkp4)2ZfVPmUD6-v&x}soDnt5nSAXI7Qa%wN0z`la5CI}!p8(r` jDaw9S{gvoQ