コード例 #1
0
ファイル: AttributesMenu.cs プロジェクト: yoeria/xMenuTools
 public AttributesMenu(string[] args)
 {
     if (args != null)
     {
         Thread thread = new Thread(WaitingForFileTimes)
         {
             IsBackground = true
         };
         thread.Start();
         InitializeComponent();
         BringToFront();
         Activate();
         Focus();
         FormClosing += AttributesMenu_FormClosing;
         // Get : Set Attributes
         foreach (string arg in args)
         {
             try
             {
                 AttributesInfo.GetFileAttributes(arg);
             }
             catch (Exception ex)
             {
                 StartProcess.StartInfo(AppDomain.CurrentDomain.BaseDirectory + "xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler");
             }
             ThePaths = args;
             FilePath = arg;
             DirectoryInfo DirectoryPath = new DirectoryInfo(FilePath);
             if (DirectoryPath.Parent == null)
             {
                 FolderPathName = FilePath;
             }
             else
             {
                 FolderPathName = Path.GetFileName(FilePath);
             }
             if (File.Exists(arg) && args.Length < 2)
             {
                 Text = Resources.labelFileName + FolderPathName;
             }
             else if (Directory.Exists(arg) && args.Length < 2)
             {
                 Text = Resources.labelFolderName + FolderPathName;
             }
             else
             {
                 Text = Resources.MultipleFiles;
             }
             SetFileAttributes();
         }
     }
     else
     {
         throw new ArgumentNullException(Resources.ErrorTitle);
     }
 }
コード例 #2
0
ファイル: Settings.cs プロジェクト: louismoura/xMenuTools
        public Settings()
        {
            InitializeComponent();
            key = Registry.CurrentUser.CreateSubKey(SoftwarexMenuTools);
            key = Registry.CurrentUser.OpenSubKey(SoftwarexMenuTools, true);
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fvi.FileVersion;

            label1.Text = Resources.Version + version;

            RegistryKey subKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\xMenuTools");

            if (subKey == null)
            {
                StartProcess.StartInfo(GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "-install", false, true);
                Environment.Exit(0);
            }
            GetSettings();
        }
コード例 #3
0
        internal static void InstallerUnelevated()
        {
            try
            {
                RegistryKey subKey = null;
                if (ArchitectureCheck.ProcessorIs64Bit())
                {
                    subKey = Registry.LocalMachine.OpenSubKey(Resources.RegUninstallKey64String);
                }
                else
                {
                    subKey = Registry.LocalMachine.OpenSubKey(Resources.RegUninstallKey32String);
                }
                if (subKey == null)
                {
                    DialogResult results = MessageForm(Resources.InstallQuestion + Resources.xMenuTools + Resources.InstallNotice, Resources.xMenuTools, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (results == DialogResult.Yes)
                    {
                        StartProcess.StartInfo(GetAssembly.AssemblyInformation("filelocation"), "-install", false, true);
                        Environment.Exit(0);
                    }
                }
                else
                {
                    DialogResult results = MessageForm(Resources.UninstallQuestion + Resources.xMenuTools + Resources.UninstallNotice, Resources.xMenuTools, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (results == DialogResult.Yes)
                    {
                        StartProcess.StartInfo(GetAssembly.AssemblyInformation("filelocation"), "-uninstall", false, true);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);

                Environment.Exit(0);
            }
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: yoeria/xMenuTools
        private void AddToFirewall(string operation)
        {
            TryAgain :;
            try
            {
                int dotCount = 0;
                FilesCount = 0;
                Thread thread = new Thread(() => EnumerateFiles())
                {
                    IsBackground = true
                };
                thread.Start();
                progressBar1.Value = 0;
                current            = 0;

                if (operation == Resources.FirewallArgs && RootPath != null)
                {
                    while (CountingFilesOperation)
                    {
                        Thread.Sleep(500);

                        dotCount++;
                        if (dotCount == 2)
                        {
                            label1.Text = Operation;
                        }

                        if (dotCount == 4)
                        {
                            label1.Text = Operation + ".";
                        }

                        if (dotCount == 6)
                        {
                            label1.Text = Operation + "..";
                        }
                        if (dotCount == 8)
                        {
                            label1.Text = Operation + "...";
                            dotCount    = 0;
                        }
                        Application.DoEvents();
                    }
                    label1.Text = Resources.Blocking + Resources.outbound;
                    foreach (string item in RootPath)
                    {
                        try
                        {
                            while (PauseOperation)
                            {
                                Thread.Sleep(500);
                            }

                            current++;
                            string path      = Path.GetDirectoryName(item);
                            string title     = Path.GetFileName(path) + " - " + Path.GetFileName(item);
                            string arguments = "advfirewall firewall add rule name=" + "\"" + MainFolderName + " - " + title + "\"" + " dir=out program=" + "\"" + item + "\"" + " action=block";
                            progressBar1.Value = (current * 100) / FilesCount;
                            try
                            {
                                Text = Resources.BlockingFilesTitle + progressBar1.Value + Resources.Percentage;
                            }
                            catch (ArgumentOutOfRangeException ex)
                            {
                                EasyLogger.Error(ex);
                                continue;
                            }
                            label2.Text = Path.GetFileName(Path.GetDirectoryName(item)) + ": " + Path.GetFileName(item);
                            Application.DoEvents();
                            StartProcess.StartInfo("netsh.exe", arguments, true, true, true);
                        }
                        catch (ArgumentOutOfRangeException ex)
                        {
                            EasyLogger.Error(ex);
                            continue;
                        }
                    }
                    current            = 0;
                    progressBar1.Value = 0;
                    label1.Text        = Resources.Blocking + Resources.inbound;
                    foreach (string item in RootPath)
                    {
                        try
                        {
                            while (PauseOperation)
                            {
                                Thread.Sleep(500);
                            }

                            current++;
                            string path      = Path.GetDirectoryName(item);
                            string title     = Path.GetFileName(path) + " - " + Path.GetFileName(item);
                            string arguments = "advfirewall firewall add rule name=" + "\"" + MainFolderName + " - " + title + "\"" + " dir=in program=" + "\"" + item + "\"" + " action=block";
                            progressBar1.Value = (current * 100) / FilesCount;
                            try
                            {
                                Text = Resources.BlockingFilesTitle + progressBar1.Value + Resources.Percentage;
                            }
                            catch (ArgumentOutOfRangeException ex)
                            {
                                EasyLogger.Error(ex);
                                continue;
                            }
                            label2.Text = Path.GetFileName(Path.GetDirectoryName(item)) + ": " + Path.GetFileName(item);
                            Application.DoEvents();
                            StartProcess.StartInfo("netsh.exe", arguments, true, true, true);
                        }
                        catch (ArgumentOutOfRangeException ex)
                        {
                            EasyLogger.Error(ex);
                            continue;
                        }
                    }
                    Thread.Sleep(1500);
                    if (current > 0 && NoMoreThreads)
                    {
                        Hide();

                        DialogResult results = MessageForm(Resources.DialogMessageBlockFolder, Resources.DialogTitleSuccess, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                        if (results == DialogResult.Yes)
                        {
                            StartProcess.StartInfo("wf.msc");
                        }
                    }
                    else if (current == 0)
                    {
                        Hide();

                        MessageForm(Resources.DialogMessageFail, Resources.DialogTitleFail, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                ThreadRunning = false;
                if (NoMoreThreads)
                {
                    ExplorerRefresh.RefreshWindowsExplorer();
                    Environment.Exit(0);
                }
            }
            catch (Exception ex)
            {
                EasyLogger.Error(ex);
                goto TryAgain;
            }
        }
コード例 #5
0
ファイル: Main.cs プロジェクト: yoeria/xMenuTools
        private void MultiSelectFirewallFiles(string[] array)
        {
            try
            {
                // wait for the form to load
                while (!Ready)
                {
                    Thread.Sleep(200);
                    Application.DoEvents();
                }
                try
                {
                    Invoke(new Action(() =>
                    {
                        progressBar1.Enabled = true;

                        progressBar1.Style = ProgressBarStyle.Marquee;

                        PauseButton.Enabled = false;
                        StopButton.Enabled  = false;

                        label3.Text = "Task:";

                        label2.Text = "Firewall";

                        label1.Text = "Add files to Windows Defender Firewall inbound and outbound rules.";
                    }));
                }
                catch (Exception ex)
                {
                    EasyLogger.Error(ex);
                }

                foreach (string item in array)
                {
                    try
                    {
                        MainFolderName = Path.GetFileName(item);

                        string path      = Path.GetDirectoryName(item);
                        string title     = Path.GetFileName(path) + " - " + Path.GetFileName(item);
                        string arguments = "advfirewall firewall add rule name=" + "\"" + MainFolderName + " - " + title + "\"" + " dir=out program=" + "\"" + item + "\"" + " action=block";

                        StartProcess.StartInfo("netsh.exe", arguments, true, true, true);

                        path      = Path.GetDirectoryName(item);
                        title     = Path.GetFileName(path) + " - " + Path.GetFileName(item);
                        arguments = "advfirewall firewall add rule name=" + "\"" + MainFolderName + " - " + title + "\"" + " dir=in program=" + "\"" + item + "\"" + " action=block";

                        StartProcess.StartInfo("netsh.exe", arguments, true, true, true);
                    }
                    catch (Exception ex)
                    {
                        MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        NoErrors = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NoErrors = false;
            }

            try
            {
                // wait for the form to load
                while (!Ready)
                {
                    Thread.Sleep(200);
                    Application.DoEvents();
                }
                try
                {
                    Invoke(new Action(() =>
                    {
                        Hide();
                        if (NoErrors)
                        {
                            DialogResult results = MessageForm(Resources.DialogMessageBlockFiles, Resources.DialogTitleSuccess, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                            if (results == DialogResult.Yes)
                            {
                                StartProcess.StartInfo("wf.msc");
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                    EasyLogger.Error(ex);
                }
            }
            catch (Exception ex)
            {
                MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Environment.Exit(0);
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: yoeria/xMenuTools
        private void ExecuteCommands(string[] args)
        {
            try
            {
                if (args[1] == Resources.MakeLink)
                {
                    string[]      selectPaths  = args[0].Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    int           items        = 0;
                    string        selectedItem = string.Empty;
                    List <string> Paths        = new List <string>();
                    string        PathName     = string.Empty;
                    try
                    {
                        foreach (string selected in selectPaths)
                        {
                            selectedItem = selected;
                            items++;
                        }
                        if (items == 1)
                        {
                            using (new InputBox())
                            {
                                new InputBox(Path.GetFileName(selectedItem)).ShowDialog();
                            }

                            using (FolderBrowserDialog ofd = new FolderBrowserDialog())
                            {
                                ofd.Description = Path.GetFileName(selectedItem);
                                if (ofd.ShowDialog() == DialogResult.OK)
                                {
                                    PathName = ofd.SelectedPath + @"\" + JunctionName;
                                    StartProcess.StartInfo("cmd.exe", "/c mklink /J " + "\"" + PathName + "\"" + " " + "\"" + selectedItem + "\"", true, true, true);
                                    Paths.Add(PathName);
                                }
                            }
                            if (PathName != string.Empty)
                            {
                                StartProcess.StartInfo(PathName);
                            }
                        }
                        else
                        {
                            MessageForm("Please try again only selecting one directory at a time while creating junctions.", "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (Win32Exception ex)
                    {
                        MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                if (args[1] == Resources.CatchHandlerArgs)
                {
                    MessageLogging(args[0], Resources.xMenuTools, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (args[1] == Resources.AttributesMenuArgs)
                {
                    string[]       array = args[0].Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    AttributesMenu menu  = new AttributesMenu(array);
                    using (menu)
                    {
                        menu.ShowDialog();
                    }
                    Environment.Exit(0);
                }
                if (args[1] == Resources.FirewallFilesArgs)
                {
                    try
                    {
                        KeepAlive = true;
                        NoErrors  = true;
                        string[] array = args[0].Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                        Thread thread = new Thread(() => MultiSelectFirewallFiles(array))
                        {
                            IsBackground = true
                        };
                        thread.Start();
                    }
                    catch (Exception ex)
                    {
                        MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                if (args[1] == Resources.FirewallFolderArgs)
                {
                    KeepAlive = true;
                    Text      = Resources.BlockingFilesTitle;
                    Thread thread = new Thread(() => FirewallDirectory(args[0], Resources.FirewallArgs))
                    {
                        IsBackground = true
                    };
                    thread.Start();
                }
                if (args[1] == Resources.OwnershipArgs)
                {
                    string[] array = args[0].Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    foreach (string item in array)
                    {
                        if (File.Exists(item))
                        {
                            StartProcess.StartInfo("cmd.exe", "/c takeown /f " + "\"" + item + "\"" + " /SKIPSL && icacls " + "\"" + item + "\"" + " /grant:r " + "\"" + CurrentUser + "\"" + ":F /t /l /c /q", false, true);
                        }
                        if (Directory.Exists(item))
                        {
                            StartProcess.StartInfo("cmd.exe", "/c takeown /f " + "\"" + item + "\"" + " /r /SKIPSL /d y && icacls " + "\"" + item + "\"" + " /grant:r " + "\"" + CurrentUser + "\"" + ":F /t /l /c /q", false, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }
コード例 #7
0
        internal static void Install(string location)
        {
            try
            {
                System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
                string version = fvi.FileVersion;

                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\xMenuTools");
                File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\xMenuTools\\Version.txt", version);

                RegistryKey xMenuToolsSettings = Registry.CurrentUser.CreateSubKey("SOFTWARE\\xMenuTools\\Settings");
                RegistryKey InstallInfo        = null;
                if (ArchitectureCheck.ProcessorIs64Bit())
                {
                    RegistryKey RegUninstallKey64 = Registry.LocalMachine.CreateSubKey(Resources.RegUninstallKey64String);
                    InstallInfo = RegUninstallKey64;
                }
                if (!ArchitectureCheck.ProcessorIs64Bit())
                {
                    RegistryKey RegUninstallKey32 = Registry.LocalMachine.CreateSubKey(Resources.RegUninstallKey32String);
                    InstallInfo = RegUninstallKey32;
                }
                StartProcess.StartInfo(@"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe", "\"" + location + "\\xMenuTools.dll" + "\"" + " -codebase", true, true, true);

                // Adds Information to Uninstall - Change to 32 bit for compiling x86
                InstallInfo.SetValue("InstallLocation", "\"" + location + "\"", RegistryValueKind.String);
                InstallInfo.SetValue("InstallFileLocation", "\"" + location + @"\xMenuTools.exe" + "\"", RegistryValueKind.String);
                InstallInfo.SetValue("UninstallString", "\"" + location + @"\xMenuTools.exe" + "\"" + " -uninstall", RegistryValueKind.String);
                InstallInfo.SetValue("DisplayIcon", location + @"\xMenuTools.exe", RegistryValueKind.String);
                InstallInfo.SetValue("Publisher", "xCONFLiCTiONx", RegistryValueKind.String);
                InstallInfo.SetValue("HelpLink", website, RegistryValueKind.String);
                InstallInfo.SetValue("DisplayName", Resources.xMenuTools, RegistryValueKind.String);
                InstallInfo.SetValue("DisplayVersion", GetAssembly.AssemblyInformation("version"), RegistryValueKind.String);
                /* User Settings */

                // All Files
                xMenuToolsSettings.SetValue("OpenNotepadFiles", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("BlockWithFirewallFiles", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("CopyPathFiles", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("CopyNameFiles", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("AttributesFiles", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("SymlinkFiles", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("TakeOwnershipFiles", 0x00000001, RegistryValueKind.DWord);
                // All Files Shorcuts
                xMenuToolsSettings.SetValue("AttributesShortcuts", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("OpenNotepadShort", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("CopyPathShortFiles", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("CopyNameShortFiles", 0x00000001, RegistryValueKind.DWord);
                // Directories
                xMenuToolsSettings.SetValue("BlockWithFirewallDirectory", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("CopyPathDirectory", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("CopyNameDirectory", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("AttributesDirectory", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("SymlinkDirectory", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("TakeOwnershipDirectory", 0x00000001, RegistryValueKind.DWord);
                // Directory Background
                xMenuToolsSettings.SetValue("AttributesDirectoryBack", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("CommandLinesDirectoryBack", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("FindWallpaperDirectoryBack", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("SystemFoldersDirectoryBack", 0x00000001, RegistryValueKind.DWord);
                xMenuToolsSettings.SetValue("PasteContentsDirectoryBack", 0x00000001, RegistryValueKind.DWord);

                // Create Shorcut in All Users Start Menu Programs
                StringBuilder allUserProfile = new StringBuilder(260);
                NativeMethods.SHGetSpecialFolderPath(IntPtr.Zero, allUserProfile, NativeMethods.CSIDL_COMMON_STARTMENU, false);

                string programs_path = Path.Combine(allUserProfile.ToString(), "Programs");

                string shortcutFolder = Path.Combine(programs_path, @"xMenuTools");
                if (!Directory.Exists(shortcutFolder))
                {
                    Directory.CreateDirectory(shortcutFolder);
                }

                using (new Settings())
                {
                    new Settings().ShowDialog();
                }

                Shortcut.Create(shortcutFolder, InstallInfo.ToString());

                Environment.Exit(0);
            }
            catch (Exception ex)
            {
                MessageForm(ex.Message + Environment.NewLine + ex.StackTrace, Resources.xMenuTools, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }
コード例 #8
0
        internal static void Uninstall()
        {
            try
            {
                RegistryKey RegUninstallKey64 = Registry.LocalMachine.OpenSubKey(Resources.Uninstall64Bit, true);
                RegistryKey RegUninstallKey32 = Registry.LocalMachine.OpenSubKey(Resources.Uninstall32Bit, true);
                RegistryKey RegistrySoftware  = Registry.CurrentUser.OpenSubKey("SOFTWARE", true);
                RegistryKey UninstallInfo     = RegUninstallKey64;
                if (ArchitectureCheck.ProcessorIs64Bit())
                {
                    UninstallInfo = RegUninstallKey64;
                }
                if (!ArchitectureCheck.ProcessorIs64Bit())
                {
                    UninstallInfo = RegUninstallKey32;
                }
                StartProcess.StartInfo(@"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe", "-unregister " + "\"" + GetAssembly.AssemblyInformation("directory") + "\\xMenuTools.dll" + "\"", true, true, true);

                UninstallInfo.DeleteSubKeyTree("xMenuTools", false);
                RegistrySoftware.DeleteSubKey("xMenuTools\\Settings", false);
                RegistrySoftware.DeleteSubKey("xMenuTools", false);

                // Restart Explorer
                DialogResult dialog = SendMessage.MessageForm(Resources.UninstallComplete, Resources.xMenuTools, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialog == DialogResult.Yes)
                {
                    foreach (Process proc in Process.GetProcessesByName("explorer"))
                    {
                        proc.Kill();

                        proc.WaitForExit();
                    }
                }

                try
                {
                    // Delete shortcut
                    StringBuilder allUserProfile = new StringBuilder(260);
                    NativeMethods.SHGetSpecialFolderPath(IntPtr.Zero, allUserProfile, NativeMethods.CSIDL_COMMON_STARTMENU, false);
                    string programs_path  = Path.Combine(allUserProfile.ToString(), "Programs");
                    string shortcutFolder = Path.Combine(programs_path, @"xMenuTools");
                    foreach (string file in Directory.GetFiles(shortcutFolder))
                    {
                        try
                        {
                            File.Delete(file);
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    Directory.Delete(shortcutFolder, true);
                }
                catch (Exception ex)
                {
                    EasyLogger.Error(ex);
                }

                try
                {
                    File.Copy(GetAssembly.AssemblyInformation("directory") + @"\Deleter.exe", Path.GetTempPath() + "Deleter.exe", true);

                    using (Process p = new Process())
                    {
                        p.StartInfo.Arguments = "\"" + GetAssembly.AssemblyInformation("directory") + "\"";
                        p.StartInfo.FileName  = Path.GetTempPath() + @"\Deleter.exe";
                        p.Start();
                    }
                }
                catch (Exception ex)
                {
                    EasyLogger.Error(ex);
                }

                Environment.Exit(0);
            }
            catch (Exception ex)
            {
                MessageForm(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite, "xMenuTools", MessageBoxButtons.OK, MessageBoxIcon.Error);

                Environment.Exit(0);
            }
        }