Example #1
0
 /// <summary>
 /// Check if the provided menu item exists for the provided file extension
 /// </summary>
 /// <param name="fileExtension">File extension</param>
 /// <param name="actionName">Action name</param>
 /// <returns>True if the action exists for the specified file extension</returns>
 public static bool ActionExists(string fileExtension, string actionName)
 {
     try
     {
         return(ShellFileType.GetType(fileExtension).MenuItems.ContainsKey(actionName));
     }
     catch (KeyNotFoundException) { return(false); }
 }
Example #2
0
 /// <summary>
 /// Remove the same menu item from the specified file extensions
 /// </summary>
 /// <param name="actionName">internal action name tp remove</param>
 /// <param name="fileExtensions">file type to remove action from</param>
 public static void RemoveAction(string fileExtension, string actionName)
 {
     try
     {
         using (ShellFileType fileType = ShellFileType.GetType(fileExtension))
         {
             fileType.MenuItems.Remove(actionName);
         }
     }
     catch (KeyNotFoundException) { /* Nothing to remove */ }
 }