// Create the Menu protected override ContextMenuStrip CreateMenu() { CheckUserSettings(); // Main Menu using (Menu = new ContextMenuStrip()) { Menu.Name = "xMenuToolsMenu"; using (xMenuToolsMenu = new ToolStripMenuItem()) { xMenuToolsMenu.Name = "xMenuToolsMenu"; // CommandLine using (CommandLine = new ToolStripMenuItem()) { CommandLine.Text = Resources.CommandLines; CommandLine.Name = "CommandLine"; // OpenTerminalAsUser using (OpenTerminalAsUser = new ToolStripMenuItem()) { OpenTerminalAsUser.Text = Resources.OpenTerminal; OpenTerminalAsUser.Name = "OpenTerminalAsUser"; } // OpenTerminalAsAdmin using (OpenTerminalAsAdmin = new ToolStripMenuItem()) { OpenTerminalAsAdmin.Text = Resources.OpenTerminalElevated; OpenTerminalAsAdmin.Name = "OpenTerminalAsAdmin"; } // OpenCmdAsUser using (OpenCmdAsUser = new ToolStripMenuItem()) { OpenCmdAsUser.Text = Resources.CommandPrompt; OpenCmdAsUser.Name = "OpenCmdAsUser"; } // OpenCmdAsAdmin using (OpenCmdAsAdmin = new ToolStripMenuItem()) { OpenCmdAsAdmin.Text = Resources.CommandPromptElevated; OpenCmdAsAdmin.Name = "OpenCmdAsAdmin"; } // OpenGitAsUser using (OpenGitAsUser = new ToolStripMenuItem()) { OpenGitAsUser.Text = Resources.OpenGitAsUser; OpenGitAsUser.Name = "OpenGitAsUser"; } // OpenGitAsAdmin using (OpenGitAsAdmin = new ToolStripMenuItem()) { OpenGitAsAdmin.Text = Resources.OpenGitAsAdmin; OpenGitAsAdmin.Name = "OpenGitAsAdmin"; } // OpenPSAsUser using (OpenPSAsUser = new ToolStripMenuItem()) { OpenPSAsUser.Text = Resources.OpenPSAsUser; OpenPSAsUser.Name = "OpenPSAsUser"; } // OpenPSAsAdmin using (OpenPSAsAdmin = new ToolStripMenuItem()) { OpenPSAsAdmin.Text = Resources.OpenPSAsAdmin; OpenPSAsAdmin.Name = "OpenPSAsAdmin"; } } // Attributes using (Attributes = new ToolStripMenuItem()) { Attributes.Text = Resources.AttributesText; Attributes.Name = "Attributes"; using (AttributesMenu = new ToolStripMenuItem()) { AttributesMenu.Text = Resources.AttributesMenu; AttributesMenu.Name = "AttributesMenu"; } try { AttributesInfo.GetFileAttributes(FolderPath); } catch (Exception ex) { StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler"); } SetInternalAttributes(); } // System Folders using (SystemFolders = new ToolStripMenuItem()) { SystemFolders.Text = "System Folders"; SystemFolders.Name = "SystemFolders"; using (AppDataFolder = new ToolStripMenuItem()) { AppDataFolder.Text = "AppData Folder"; AppDataFolder.Name = "AppDataFolder"; } using (ProgramDataFolder = new ToolStripMenuItem()) { ProgramDataFolder.Text = "ProgramData Folder"; ProgramDataFolder.Name = "ProgramDataFolder"; } using (UserStartMenuFolder = new ToolStripMenuItem()) { UserStartMenuFolder.Text = "Start Menu Folder"; UserStartMenuFolder.Name = "UserStartMenuFolder"; } using (AllUsersStartMenuFolder = new ToolStripMenuItem()) { AllUsersStartMenuFolder.Text = "All Users Start Menu Folder"; AllUsersStartMenuFolder.Name = "AllUsersStartMenuFolder"; } using (UserTempFolder = new ToolStripMenuItem()) { UserTempFolder.Text = "Temp Folder"; UserTempFolder.Name = "UserTempFolder"; } } // FindWallpaper using (FindWallpaper = new ToolStripMenuItem()) { FindWallpaper.Text = Resources.FindWallpaperText; FindWallpaper.Name = "FindWallpaper"; } // Paste Contents using (PasteContents = new ToolStripMenuItem()) { PasteContents.Text = "Paste clipboard text to file"; PasteContents.Name = "PasteContents"; } } } MenuDeveloper(); return(Menu); }
protected override ContextMenuStrip CreateMenu() { CheckUserSettings(); // Main Menu using (Menu = new ContextMenuStrip()) { Menu.Name = "xMenuToolsFiles"; using (xMenuToolsMenu = new ToolStripMenuItem()) { xMenuToolsMenu.Name = "xMenuToolsMenu"; // OpenNotepad using (OpenNotepad = new ToolStripMenuItem()) { OpenNotepad.Text = Resources.OpenNotepad; OpenNotepad.Name = "OpenNotepad"; } // BlockFirewall using (BlockFirewall = new ToolStripMenuItem()) { BlockFirewall.Text = Resources.BlockText; BlockFirewall.Name = "BlockFirewall"; } // CopyPath using (CopyPath = new ToolStripMenuItem()) { CopyPath.Text = Resources.CopyPathText; CopyPath.Name = "CopyPath"; } // CopyName using (CopyName = new ToolStripMenuItem()) { CopyName.Text = Resources.CopyNameText; CopyName.Name = "CopyName"; } // Attributes using (Attributes = new ToolStripMenuItem()) { Attributes.Name = "Attributes"; Attributes.Text = Resources.AttributesText; // AttributesMenu using (AttributesMenu = new ToolStripMenuItem()) { AttributesMenu.Text = Resources.AttributesMenu; AttributesMenu.Name = "AttributesMenu"; } // Get : Set Attributes string[] SelectedPath = SelectedItemPaths.Cast <string>().ToArray(); if (SelectedPath.Length > 1) { foreach (string item in SelectedPath) { try { AttributesInfo.GetFileAttributes(item); } catch (Exception ex) { StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler"); } } } else { try { AttributesInfo.GetFileAttributes(SelectedPath.ToStringArray(false)); } catch (Exception ex) { StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler"); } } SetFileAttributes(); } // SymLink using (SymLink = new ToolStripMenuItem()) { SymLink.Text = Resources.CreateSymbolicLink; SymLink.Name = "SymLink"; } // TakeOwnership using (TakeOwnership = new ToolStripMenuItem()) { TakeOwnership.Text = Resources.TakeOwnershipText; TakeOwnership.Name = "TakeOwnership"; } } } MenuDeveloper(); return(Menu); }
// Create the Menu protected override ContextMenuStrip CreateMenu() { CheckUserSettings(); // Main Menu using (Menu = new ContextMenuStrip()) { Menu.Name = "MenuToolsDirectory"; using (MenuToolsMenu = new ToolStripMenuItem()) { MenuToolsMenu.Name = "MenuToolsMenu"; // BlockFirewall using (BlockFirewall = new ToolStripMenuItem()) { BlockFirewall.Text = Resources.BlockAllText; BlockFirewall.Name = "BlockFirewall"; } // CopyPath using (CopyPath = new ToolStripMenuItem()) { CopyPath.Text = Resources.CopyPathText; CopyPath.Name = "CopyPath"; } // CopyName using (CopyName = new ToolStripMenuItem()) { CopyName.Text = Resources.CopyNameText; CopyName.Name = "CopyName"; } // Attributes using (Attributes = new ToolStripMenuItem()) { Attributes.Text = Resources.AttributesText; Attributes.Name = "Attributes"; // AttributesMenu using (AttributesMenu = new ToolStripMenuItem()) { AttributesMenu.Text = Resources.AttributesMenu; AttributesMenu.Name = "AttributesMenu"; } // Get : Set Attributes string[] SelectedPath = SelectedItemPaths.Cast <string>().ToArray(); if (SelectedPath.Length > 1) { foreach (var item in SelectedPath) { AttributesInfo.GetFileAttributes(item); } } else { AttributesInfo.GetFileAttributes(SelectedPath.ToStringArray(false)); } SetFileAttributes(); } // SymLink using (SymLink = new ToolStripMenuItem()) { SymLink.Text = Resources.CreateSymbolicLink; SymLink.Name = "SymLink"; } // TakeOwnership using (TakeOwnership = new ToolStripMenuItem()) { TakeOwnership.Text = Resources.TakeOwnershipText; TakeOwnership.Name = "TakeOwnership"; } } } MenuDeveloper(); return(Menu); }
// Create the Menu protected override ContextMenuStrip CreateMenu() { CheckUserSettings(); // Main Menu using (Menu = new ContextMenuStrip()) { Menu.Name = "MenuToolsMenu"; using (MenuToolsMenu = new ToolStripMenuItem()) { MenuToolsMenu.Name = "MenuToolsMenu"; // CommandLine using (CommandLine = new ToolStripMenuItem()) { CommandLine.Text = Resources.CommandLines; CommandLine.Name = "CommandLine"; // OpenAsUser using (OpenAsUser = new ToolStripMenuItem()) { OpenAsUser.Text = Resources.CommandPrompt; OpenAsUser.Name = "OpenAsUser"; } // OpenAsAdmin using (OpenAsAdmin = new ToolStripMenuItem()) { OpenAsAdmin.Text = Resources.CommandPromptElevated; OpenAsAdmin.Name = "OpenAsAdmin"; } // OpenGitAsUser using (OpenGitAsUser = new ToolStripMenuItem()) { OpenGitAsUser.Text = Resources.OpenGitAsUser; OpenGitAsUser.Name = "OpenGitAsUser"; } // OpenGitAsAdmin using (OpenGitAsAdmin = new ToolStripMenuItem()) { OpenGitAsAdmin.Text = Resources.OpenGitAsAdmin; OpenGitAsAdmin.Name = "OpenGitAsAdmin"; } // OpenPSAsUser using (OpenPSAsUser = new ToolStripMenuItem()) { OpenPSAsUser.Text = Resources.OpenPSAsUser; OpenPSAsUser.Name = "OpenPSAsUser"; } // OpenPSAsAdmin using (OpenPSAsAdmin = new ToolStripMenuItem()) { OpenPSAsAdmin.Text = Resources.OpenPSAsAdmin; OpenPSAsAdmin.Name = "OpenPSAsAdmin"; } } // Attributes using (Attributes = new ToolStripMenuItem()) { Attributes.Text = Resources.AttributesText; Attributes.Name = "Attributes"; using (AttributesMenu = new ToolStripMenuItem()) { AttributesMenu.Text = Resources.AttributesMenu; AttributesMenu.Name = "AttributesMenu"; } AttributesInfo.GetFileAttributes(FolderPath); SetInternalAttributes(); } // System Folders using (SystemFolders = new ToolStripMenuItem()) { SystemFolders.Text = "System Folders"; SystemFolders.Name = "SystemFolders"; using (AppDataFolder = new ToolStripMenuItem()) { AppDataFolder.Text = "AppData Folder"; AppDataFolder.Name = "AppDataFolder"; } using (ProgramDataFolder = new ToolStripMenuItem()) { ProgramDataFolder.Text = "ProgramData Folder"; ProgramDataFolder.Name = "ProgramDataFolder"; } using (UserStartMenuFolder = new ToolStripMenuItem()) { UserStartMenuFolder.Text = "Start Menu Folder"; UserStartMenuFolder.Name = "UserStartMenuFolder"; } using (AllUsersStartMenuFolder = new ToolStripMenuItem()) { AllUsersStartMenuFolder.Text = "All Users Start Menu Folder"; AllUsersStartMenuFolder.Name = "AllUsersStartMenuFolder"; } using (UserTempFolder = new ToolStripMenuItem()) { UserTempFolder.Text = "Temp Folder"; UserTempFolder.Name = "UserTempFolder"; } } // FindWallpaper using (FindWallpaper = new ToolStripMenuItem()) { FindWallpaper.Text = Resources.FindWallpaperText; FindWallpaper.Name = "FindWallpaper"; } // Paste Contents using (PasteContents = new ToolStripMenuItem()) { PasteContents.Text = "Paste clipboard text to file"; PasteContents.Name = "PasteContents"; } } } MenuDeveloper(); return(Menu); }