diff --git a/ContextMenuManager/AppString.cs b/ContextMenuManager/AppString.cs index 45b85d0..1b71a38 100644 --- a/ContextMenuManager/AppString.cs +++ b/ContextMenuManager/AppString.cs @@ -53,6 +53,7 @@ namespace ContextMenuManager public static string OpenWith => GetValue("OpenWith"); public static string WinX => GetValue("WinX"); public static string LnkFile => GetValue("LnkFile"); + public static string UwpLnk => GetValue("UwpLnk"); public static string ExeFile => GetValue("ExeFile"); public static string TextFile => GetValue("TextFile"); public static string ImageFile => GetValue("ImageFile"); @@ -90,6 +91,7 @@ namespace ContextMenuManager public static string OpenWith => GetValue("OpenWith"); public static string WinX => GetValue("WinX"); public static string LnkFile => GetValue("LnkFile"); + public static string UwpLnk => GetValue("UwpLnk"); public static string ExeFile => GetValue("ExeFile"); public static string TextFile => GetValue("TextFile"); public static string ImageFile => GetValue("ImageFile"); diff --git a/ContextMenuManager/ContextMenuManager.csproj b/ContextMenuManager/ContextMenuManager.csproj index 5afb157..b53f1ce 100644 --- a/ContextMenuManager/ContextMenuManager.csproj +++ b/ContextMenuManager/ContextMenuManager.csproj @@ -132,6 +132,9 @@ Component + + Component + Form diff --git a/ContextMenuManager/Controls/GuidBlockedItem.cs b/ContextMenuManager/Controls/GuidBlockedItem.cs index 56d598a..c2a7492 100644 --- a/ContextMenuManager/Controls/GuidBlockedItem.cs +++ b/ContextMenuManager/Controls/GuidBlockedItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using System; using System.Windows.Forms; diff --git a/ContextMenuManager/Controls/Interfaces/IBtnDeleteItem.cs b/ContextMenuManager/Controls/Interfaces/IBtnDeleteItem.cs index 0fe6af6..1d5792a 100644 --- a/ContextMenuManager/Controls/Interfaces/IBtnDeleteItem.cs +++ b/ContextMenuManager/Controls/Interfaces/IBtnDeleteItem.cs @@ -2,7 +2,7 @@ using BulePointLilac.Methods; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface IBtnDeleteItem { diff --git a/ContextMenuManager/Controls/Interfaces/IBtnMoveUpDownItem.cs b/ContextMenuManager/Controls/Interfaces/IBtnMoveUpDownItem.cs index e227251..7296763 100644 --- a/ContextMenuManager/Controls/Interfaces/IBtnMoveUpDownItem.cs +++ b/ContextMenuManager/Controls/Interfaces/IBtnMoveUpDownItem.cs @@ -1,6 +1,6 @@ using BulePointLilac.Controls; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface IBtnMoveUpDownItem { diff --git a/ContextMenuManager/Controls/Interfaces/IBtnOpenPathItem.cs b/ContextMenuManager/Controls/Interfaces/IBtnOpenPathItem.cs index 95bf2d8..54990bc 100644 --- a/ContextMenuManager/Controls/Interfaces/IBtnOpenPathItem.cs +++ b/ContextMenuManager/Controls/Interfaces/IBtnOpenPathItem.cs @@ -1,7 +1,7 @@ using BulePointLilac.Controls; using static BulePointLilac.Methods.ObjectPath; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface IBtnOpenPathItem { diff --git a/ContextMenuManager/Controls/Interfaces/IBtnShowMenuItem.cs b/ContextMenuManager/Controls/Interfaces/IBtnShowMenuItem.cs index 43bd7d2..52f0a32 100644 --- a/ContextMenuManager/Controls/Interfaces/IBtnShowMenuItem.cs +++ b/ContextMenuManager/Controls/Interfaces/IBtnShowMenuItem.cs @@ -1,7 +1,7 @@ using BulePointLilac.Controls; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface IBtnShowMenuItem { diff --git a/ContextMenuManager/Controls/Interfaces/IChkVisibleItem.cs b/ContextMenuManager/Controls/Interfaces/IChkVisibleItem.cs index c5578cc..516b3e2 100644 --- a/ContextMenuManager/Controls/Interfaces/IChkVisibleItem.cs +++ b/ContextMenuManager/Controls/Interfaces/IChkVisibleItem.cs @@ -1,7 +1,7 @@ using BulePointLilac.Controls; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface IChkVisibleItem { diff --git a/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs b/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs index 73d927d..002ad97 100644 --- a/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs +++ b/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs @@ -3,7 +3,7 @@ using System.Drawing; using System.Windows.Forms; using static BulePointLilac.Methods.ObjectPath; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface IFoldGroupItem { diff --git a/ContextMenuManager/Controls/Interfaces/ITsiCommandItem.cs b/ContextMenuManager/Controls/Interfaces/ITsiCommandItem.cs index b91dee8..9db164c 100644 --- a/ContextMenuManager/Controls/Interfaces/ITsiCommandItem.cs +++ b/ContextMenuManager/Controls/Interfaces/ITsiCommandItem.cs @@ -2,7 +2,7 @@ using BulePointLilac.Methods; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface ITsiCommandItem { diff --git a/ContextMenuManager/Controls/Interfaces/ITsiDeleteItem.cs b/ContextMenuManager/Controls/Interfaces/ITsiDeleteItem.cs index f982ef8..279fa88 100644 --- a/ContextMenuManager/Controls/Interfaces/ITsiDeleteItem.cs +++ b/ContextMenuManager/Controls/Interfaces/ITsiDeleteItem.cs @@ -1,7 +1,7 @@ using BulePointLilac.Methods; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface ITsiDeleteItem { diff --git a/ContextMenuManager/Controls/Interfaces/ITsiFilePathItem.cs b/ContextMenuManager/Controls/Interfaces/ITsiFilePathItem.cs index e243058..c5e89ff 100644 --- a/ContextMenuManager/Controls/Interfaces/ITsiFilePathItem.cs +++ b/ContextMenuManager/Controls/Interfaces/ITsiFilePathItem.cs @@ -3,7 +3,7 @@ using System.IO; using System.Windows.Forms; using static BulePointLilac.Methods.ObjectPath; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface ITsiFilePathItem { diff --git a/ContextMenuManager/Controls/Interfaces/ITsiIconItem.cs b/ContextMenuManager/Controls/Interfaces/ITsiIconItem.cs index 5ae52de..93ba40d 100644 --- a/ContextMenuManager/Controls/Interfaces/ITsiIconItem.cs +++ b/ContextMenuManager/Controls/Interfaces/ITsiIconItem.cs @@ -3,7 +3,7 @@ using BulePointLilac.Methods; using System.Drawing; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface ITsiIconItem { diff --git a/ContextMenuManager/Controls/Interfaces/ITsiRegPathItem.cs b/ContextMenuManager/Controls/Interfaces/ITsiRegPathItem.cs index 40f7674..c969cca 100644 --- a/ContextMenuManager/Controls/Interfaces/ITsiRegPathItem.cs +++ b/ContextMenuManager/Controls/Interfaces/ITsiRegPathItem.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using static BulePointLilac.Methods.ObjectPath; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface ITsiRegPathItem { diff --git a/ContextMenuManager/Controls/Interfaces/ITsiTextItem.cs b/ContextMenuManager/Controls/Interfaces/ITsiTextItem.cs index ebacf96..09fbb3b 100644 --- a/ContextMenuManager/Controls/Interfaces/ITsiTextItem.cs +++ b/ContextMenuManager/Controls/Interfaces/ITsiTextItem.cs @@ -2,7 +2,7 @@ using BulePointLilac.Methods; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface ITsiTextItem { diff --git a/ContextMenuManager/Controls/Interfaces/ITsiWebSearchItem.cs b/ContextMenuManager/Controls/Interfaces/ITsiWebSearchItem.cs index 3d6155b..04196d7 100644 --- a/ContextMenuManager/Controls/Interfaces/ITsiWebSearchItem.cs +++ b/ContextMenuManager/Controls/Interfaces/ITsiWebSearchItem.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.Windows.Forms; -namespace ContextMenuManager.Controls +namespace ContextMenuManager.Controls.Interfaces { interface ITsiWebSearchItem { diff --git a/ContextMenuManager/Controls/OpenWithItem.cs b/ContextMenuManager/Controls/OpenWithItem.cs index eb5f6e4..238d1ca 100644 --- a/ContextMenuManager/Controls/OpenWithItem.cs +++ b/ContextMenuManager/Controls/OpenWithItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using Microsoft.Win32; using System; using System.Diagnostics; diff --git a/ContextMenuManager/Controls/RegRuleItem.cs b/ContextMenuManager/Controls/RegRuleItem.cs index 098eecc..2fe25ff 100644 --- a/ContextMenuManager/Controls/RegRuleItem.cs +++ b/ContextMenuManager/Controls/RegRuleItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using Microsoft.Win32; using System.Drawing; using System.Windows.Forms; diff --git a/ContextMenuManager/Controls/SendToItem.cs b/ContextMenuManager/Controls/SendToItem.cs index f5293f2..bd33f65 100644 --- a/ContextMenuManager/Controls/SendToItem.cs +++ b/ContextMenuManager/Controls/SendToItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using Microsoft.Win32; using System.Drawing; using System.IO; diff --git a/ContextMenuManager/Controls/ShellExItem.cs b/ContextMenuManager/Controls/ShellExItem.cs index cd9d274..fc65188 100644 --- a/ContextMenuManager/Controls/ShellExItem.cs +++ b/ContextMenuManager/Controls/ShellExItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using Microsoft.Win32; using System; using System.Collections.Generic; diff --git a/ContextMenuManager/Controls/ShellItem.cs b/ContextMenuManager/Controls/ShellItem.cs index fe0e981..ce9e016 100644 --- a/ContextMenuManager/Controls/ShellItem.cs +++ b/ContextMenuManager/Controls/ShellItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using Microsoft.Win32; using System; using System.Collections.Generic; diff --git a/ContextMenuManager/Controls/ShellList.cs b/ContextMenuManager/Controls/ShellList.cs index 3fa7e52..b254a53 100644 --- a/ContextMenuManager/Controls/ShellList.cs +++ b/ContextMenuManager/Controls/ShellList.cs @@ -25,6 +25,7 @@ namespace ContextMenuManager.Controls public const string MENUPATH_EXEFILE = @"HKEY_CLASSES_ROOT\exefile";//可执行文件 public const string MENUPATH_SYSLNKFILE = @"HKEY_CLASSES_ROOT\SystemFileAssociations\.lnk"; public const string MENUPATH_SYSEXEFILE = @"HKEY_CLASSES_ROOT\SystemFileAssociations\.exe"; + public const string MENUPATH_UWPLNK = @"HKEY_CLASSES_ROOT\Launcher.ImmersiveApplication"; public const string MENUPATH_UNKNOWN = @"HKEY_CLASSES_ROOT\Unknown";//未知格式 public const string MENUPATH_TEXT = @"HKEY_CLASSES_ROOT\SystemFileAssociations\text";//通用文本文件 public const string MENUPATH_IMAGE = @"HKEY_CLASSES_ROOT\SystemFileAssociations\image";//通用图像文件 @@ -32,25 +33,21 @@ namespace ContextMenuManager.Controls public const string MENUPATH_AUDIO = @"HKEY_CLASSES_ROOT\SystemFileAssociations\audio";//通用音频文件 public const string MENUPATH_DIRECTORY_IMAGE = @"HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Image";//通用图像文件目录 public const string MENUPATH_DIRECTORY_VIDEO = @"HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Video";//通用视频文件目录 - public const string MENUPATH_DIRECTORY_AUDIO = @"HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Video";//通用音频文件目录 + public const string MENUPATH_DIRECTORY_AUDIO = @"HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Audio";//通用音频文件目录 public const string SYSFILEASSPATH = @"HKEY_CLASSES_ROOT\SystemFileAssociations";//系统扩展名注册表父项路径 public enum Scenes { - File, Folder, Directory, Background, Desktop, Drive, AllObjects, - Computer, RecycleBin, Library, LnkFile, ExeFile, Text, Image, Video, Audio, - ImageDirectory, VideoDirectory, AudioDirectory, Unknown, CustomExtension + File, Folder, Directory, Background, Desktop, Drive, AllObjects, Computer, RecycleBin, + Library, LnkFile, UwpLnk, ExeFile, TextFile, ImageFile, VideoFile, AudioFile, + ImageDirectory, VideoDirectory, AudioDirectory, UnknownType, CustomType } private Scenes scene; public Scenes Scene { get => scene; - set - { - scene = value; - LoadItems(); - } + set { scene = value; LoadItems(); } } private static string GetShellPath(string scenePath) => $@"{scenePath}\shell"; @@ -58,7 +55,7 @@ namespace ContextMenuManager.Controls public ShellList() { - TypeItem.ExtensionChanged += (sender, e) => this.Scene = Scenes.CustomExtension; + TypeItem.ExtensionChanged += (sender, e) => this.Scene = Scenes.CustomType; } private void LoadItems() @@ -89,15 +86,17 @@ namespace ContextMenuManager.Controls scenePath = MENUPATH_LIBRARY; break; case Scenes.LnkFile: scenePath = MENUPATH_LNKFILE; break; + case Scenes.UwpLnk: + scenePath = MENUPATH_UWPLNK; break; case Scenes.ExeFile: scenePath = MENUPATH_EXEFILE; break; - case Scenes.Text: + case Scenes.TextFile: scenePath = MENUPATH_TEXT; break; - case Scenes.Image: + case Scenes.ImageFile: scenePath = MENUPATH_IMAGE; break; - case Scenes.Video: + case Scenes.VideoFile: scenePath = MENUPATH_VIDEO; break; - case Scenes.Audio: + case Scenes.AudioFile: scenePath = MENUPATH_AUDIO; break; case Scenes.ImageDirectory: scenePath = MENUPATH_DIRECTORY_IMAGE; break; @@ -105,9 +104,9 @@ namespace ContextMenuManager.Controls scenePath = MENUPATH_DIRECTORY_VIDEO; break; case Scenes.AudioDirectory: scenePath = MENUPATH_DIRECTORY_AUDIO; break; - case Scenes.Unknown: + case Scenes.UnknownType: scenePath = MENUPATH_UNKNOWN; break; - case Scenes.CustomExtension: + case Scenes.CustomType: scenePath = TypeItem.SysAssExtPath; break; } this.AddNewItem(scenePath); @@ -115,6 +114,9 @@ namespace ContextMenuManager.Controls switch(scene) { + case Scenes.File: + this.AddItem(new SpecialItems.SkypeShareItem()); + break; case Scenes.Background: this.AddItem(new RegRuleItem(RegRuleItem.CustomFolder) { MarginRight = RegRuleItem.SysMarginRignt }); break; @@ -134,7 +136,7 @@ namespace ContextMenuManager.Controls case Scenes.ExeFile: this.AddItems(MENUPATH_SYSEXEFILE); break; - case Scenes.CustomExtension: + case Scenes.CustomType: this.InsertItem(new TypeItem(), 0); this.AddItems(TypeItem.AssExtPath); break; @@ -143,7 +145,7 @@ namespace ContextMenuManager.Controls private void AddItems(string scenePath) { - if(this.Scene == Scenes.CustomExtension && TypeItem.Extension == null) return; + if(this.Scene == Scenes.CustomType && TypeItem.Extension == null) return; this.AddShellItems(GetShellPath(scenePath)); this.AddShellExItems(GetShellExPath(scenePath)); } @@ -189,7 +191,7 @@ namespace ContextMenuManager.Controls AddCommonButton btnAddCommon = new AddCommonButton(); newItem.AddCtr(btnAddCommon); this.AddItem(newItem); - if(this.Scene == Scenes.CustomExtension) + if(this.Scene == Scenes.CustomType) { newItem.Visible = TypeItem.Extension != null; TypeItem.ExtensionChanged += (sender, e) => newItem.Visible = TypeItem.Extension != null; diff --git a/ContextMenuManager/Controls/ShellNewItem.cs b/ContextMenuManager/Controls/ShellNewItem.cs index 50c86c5..77fba55 100644 --- a/ContextMenuManager/Controls/ShellNewItem.cs +++ b/ContextMenuManager/Controls/ShellNewItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using Microsoft.Win32; using System; using System.Drawing; diff --git a/ContextMenuManager/Controls/ShellSubMenuDialog.cs b/ContextMenuManager/Controls/ShellSubMenuDialog.cs index ce407f4..7591023 100644 --- a/ContextMenuManager/Controls/ShellSubMenuDialog.cs +++ b/ContextMenuManager/Controls/ShellSubMenuDialog.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using System; using System.Collections.Generic; using System.Drawing; diff --git a/ContextMenuManager/Controls/SpecialItems/SkypeShareItem.cs b/ContextMenuManager/Controls/SpecialItems/SkypeShareItem.cs new file mode 100644 index 0000000..26596aa --- /dev/null +++ b/ContextMenuManager/Controls/SpecialItems/SkypeShareItem.cs @@ -0,0 +1,112 @@ +using BulePointLilac.Controls; +using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; +using Microsoft.Win32; +using System; +using System.Drawing; +using System.IO; +using System.Windows.Forms; + +namespace ContextMenuManager.Controls.SpecialItems +{ + //所有文件的右键菜单项目:共享到Skype + //目前仅发现这一个特殊例子,不符合所有通用规则 + sealed class SkypeShareItem : MyListItem, IChkVisibleItem, ITsiFilePathItem, ITsiRegPathItem, ITsiWebSearchItem, IBtnShowMenuItem + { + const string DllPath = @"Skype\SkypeContext.dll"; + const string GuidName = "{776DBC8D-7347-478C-8D71-791E12EF49D8}"; + const string PackageRegPath = @"HKEY_CLASSES_ROOT\PackagedCom\Package"; + const string AppxRegPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx"; + + public SkypeShareItem() + { + InitializeComponents(); + string path = ItemFilePath; + if(File.Exists(path)) + { + ChkVisible.Checked = this.ItemVisible; + this.Text = ResourceString.GetDirectString($"@{path},-101"); + string exePath = $@"{Path.GetDirectoryName(path)}\Skype.exe"; + this.Image = Icon.ExtractAssociatedIcon(exePath)?.ToBitmap(); + } + else this.Visible = false; + } + + public string ItemFilePath + { + get + { + string AppxDirPath = Registry.GetValue(AppxRegPath, "PackageRoot", null)?.ToString(); + if(!Directory.Exists(AppxDirPath)) return null; + foreach(DirectoryInfo di in new DirectoryInfo(AppxDirPath).GetDirectories()) + { + if(di.Name.StartsWith("Microsoft.SkypeApp", StringComparison.OrdinalIgnoreCase)) + { + string value = $@"{di.FullName}\{DllPath}"; + if(File.Exists(value)) return value; + } + } + return null; + } + } + + private string PackageName + { + get + { + if(!File.Exists(ItemFilePath)) return null; + string[] strs = ItemFilePath.Split('\\'); + return strs[strs.Length - 3]; + } + } + + public string RegPath + { + get + { + if(PackageName == null) return null; + return $@"{PackageRegPath}\{PackageName}\Class\{GuidName}"; + } + set { } + } + + public bool ItemVisible + { + get + { + using(RegistryKey key = RegistryEx.GetRegistryKey(RegPath)) + { + if(key == null) return true; + string value = key.GetValue("DllPath")?.ToString(); + return value.Equals(DllPath, StringComparison.OrdinalIgnoreCase); + } + } + set + { + Registry.SetValue(RegPath, "DllPath", value ? DllPath : string.Empty); + } + } + + public string SearchText => Text; + + public MenuButton BtnShowMenu { get; set; } + public VisibleCheckBox ChkVisible { get; set; } + public WebSearchMenuItem TsiSearch { get; set; } + public RegLocationMenuItem TsiRegLocation { get; set; } + public FileLocationMenuItem TsiFileLocation { get; set; } + public FilePropertiesMenuItem TsiFileProperties { get; set; } + + private void InitializeComponents() + { + BtnShowMenu = new MenuButton(this); + ChkVisible = new VisibleCheckBox(this); + TsiSearch = new WebSearchMenuItem(this); + TsiFileLocation = new FileLocationMenuItem(this); + TsiFileProperties = new FilePropertiesMenuItem(this); + TsiRegLocation = new RegLocationMenuItem(this); + + ContextMenuStrip.Items.AddRange(new ToolStripItem[] { TsiSearch, + new ToolStripSeparator(), TsiFileProperties, TsiFileLocation, TsiRegLocation }); + } + } +} \ No newline at end of file diff --git a/ContextMenuManager/Controls/ThirdRulesList.cs b/ContextMenuManager/Controls/ThirdRulesList.cs index f18e4d9..adcad67 100644 --- a/ContextMenuManager/Controls/ThirdRulesList.cs +++ b/ContextMenuManager/Controls/ThirdRulesList.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using Microsoft.Win32; using System; using System.IO; diff --git a/ContextMenuManager/Controls/WinXItem.cs b/ContextMenuManager/Controls/WinXItem.cs index 1886250..ddfa5ec 100644 --- a/ContextMenuManager/Controls/WinXItem.cs +++ b/ContextMenuManager/Controls/WinXItem.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using System.Drawing; using System.IO; using System.Windows.Forms; diff --git a/ContextMenuManager/Controls/WinXList.cs b/ContextMenuManager/Controls/WinXList.cs index fd1764a..f2af892 100644 --- a/ContextMenuManager/Controls/WinXList.cs +++ b/ContextMenuManager/Controls/WinXList.cs @@ -1,5 +1,6 @@ using BulePointLilac.Controls; using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; using System; using System.Collections.Generic; using System.IO; diff --git a/ContextMenuManager/MainForm.cs b/ContextMenuManager/MainForm.cs index cb6d03d..caaaeda 100644 --- a/ContextMenuManager/MainForm.cs +++ b/ContextMenuManager/MainForm.cs @@ -79,6 +79,7 @@ namespace ContextMenuManager static readonly string[] TypeItems = { AppString.SideBar.LnkFile, + AppString.SideBar.UwpLnk, AppString.SideBar.ExeFile, null, AppString.SideBar.TextFile, @@ -96,6 +97,7 @@ namespace ContextMenuManager }; static readonly string[] TypeItemInfos = { AppString.StatusBar.LnkFile, + AppString.StatusBar.UwpLnk, AppString.StatusBar.ExeFile, null, AppString.StatusBar.TextFile, @@ -128,6 +130,40 @@ namespace ContextMenuManager AppString.SideBar.Donate }; + static readonly ShellList.Scenes[] GeneralShellScenes = + { + ShellList.Scenes.File, + ShellList.Scenes.Folder, + ShellList.Scenes.Directory, + ShellList.Scenes.Background, + ShellList.Scenes.Desktop, + ShellList.Scenes.Drive, + ShellList.Scenes.AllObjects, + ShellList.Scenes.Computer, + ShellList.Scenes.RecycleBin, + ShellList.Scenes.Library + }; + + static readonly ShellList.Scenes?[] TypeShellScenes = + { + ShellList.Scenes.LnkFile, + ShellList.Scenes.UwpLnk, + ShellList.Scenes.ExeFile, + null, + ShellList.Scenes.TextFile, + ShellList.Scenes.ImageFile, + ShellList.Scenes.VideoFile, + ShellList.Scenes.AudioFile, + null, + ShellList.Scenes.ImageDirectory, + ShellList.Scenes.VideoDirectory, + ShellList.Scenes.AudioDirectory, + null, + ShellList.Scenes.UnknownType, + null, + ShellList.Scenes.CustomType + }; + private void HideAllParts() { shellList.Visible = shellNewList.Visible = sendToList.Visible = openWithList.Visible @@ -190,26 +226,6 @@ namespace ContextMenuManager { switch(SideBar.SelectIndex) { - case 0: - shellList.Scene = ShellList.Scenes.File; break; - case 1: - shellList.Scene = ShellList.Scenes.Folder; break; - case 2: - shellList.Scene = ShellList.Scenes.Directory; break; - case 3: - shellList.Scene = ShellList.Scenes.Background; break; - case 4: - shellList.Scene = ShellList.Scenes.Desktop; break; - case 5: - shellList.Scene = ShellList.Scenes.Drive; break; - case 6: - shellList.Scene = ShellList.Scenes.AllObjects; break; - case 7: - shellList.Scene = ShellList.Scenes.Computer; break; - case 8: - shellList.Scene = ShellList.Scenes.RecycleBin; break; - case 9: - shellList.Scene = ShellList.Scenes.Library; break; case 11: shellNewList.LoadItems(); shellNewList.Visible = true; break; case 12: @@ -218,37 +234,19 @@ namespace ContextMenuManager openWithList.LoadItems(); openWithList.Visible = true; break; case 15: winXList.LoadItems(); winXList.Visible = true; break; + default: + if(SideBar.SelectIndex <= 9) + { + shellList.Scene = GeneralShellScenes[SideBar.SelectIndex]; + shellList.Visible = true; + } + break; } - shellList.Visible = SideBar.SelectIndex <= 9; } private void SwitchTypeItem() { - switch(SideBar.SelectIndex) - { - case 0: - shellList.Scene = ShellList.Scenes.LnkFile; break; - case 1: - shellList.Scene = ShellList.Scenes.ExeFile; break; - case 3: - shellList.Scene = ShellList.Scenes.Text; break; - case 4: - shellList.Scene = ShellList.Scenes.Image; break; - case 5: - shellList.Scene = ShellList.Scenes.Video; break; - case 6: - shellList.Scene = ShellList.Scenes.Audio; break; - case 8: - shellList.Scene = ShellList.Scenes.ImageDirectory; break; - case 9: - shellList.Scene = ShellList.Scenes.VideoDirectory; break; - case 10: - shellList.Scene = ShellList.Scenes.AudioDirectory; break; - case 12: - shellList.Scene = ShellList.Scenes.Unknown; break; - case 14: - shellList.Scene = ShellList.Scenes.CustomExtension; break; - } + shellList.Scene = (ShellList.Scenes)TypeShellScenes[SideBar.SelectIndex]; shellList.Visible = true; } diff --git a/ContextMenuManager/Program.cs b/ContextMenuManager/Program.cs index 2706a2a..d7fc842 100644 --- a/ContextMenuManager/Program.cs +++ b/ContextMenuManager/Program.cs @@ -33,9 +33,11 @@ namespace ContextMenuManager DirectoryInfo di = new DirectoryInfo(LanguagesDir); if(value.Equals(string.Empty) && di.Exists) { + string sysLanguageName = new CultureInfo(GetUserDefaultUILanguage()).Name; foreach(FileInfo fi in di.GetFiles()) { - if(Path.GetFileNameWithoutExtension(fi.Name).Equals(new CultureInfo(GetUserDefaultUILanguage()).Name, StringComparison.OrdinalIgnoreCase)) + string fileName = Path.GetFileNameWithoutExtension(fi.Name); + if(fileName.Equals(sysLanguageName, StringComparison.OrdinalIgnoreCase)) { value = fi.FullName; break; } diff --git a/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini b/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini index 50e4be9..c434bb1 100644 --- a/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini +++ b/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini @@ -31,6 +31,7 @@ OpenWith = 打开方式 WinX = Win+X LnkFile = lnk文件 +UwpLnk = uwp lnk ExeFile = exe文件 TextFile = 文本文件 ImageFile = 图像文件 @@ -67,6 +68,7 @@ OpenWith = 所有文件右键 "打开方式" 的菜单项目 WinX = Win10 "开始" 按钮的右键Win+X菜单项目 LnkFile = 所有快捷方式的右键菜单 +UwpLnk = Win10 UWP应用快捷方式的右键菜单 ExeFile = 所有EXE可执行文件的右键菜单 TextFile = 通用文本格式(如.txt、.ini)文件的右键菜单 ImageFile = 通用图像格式(如.jpg、.png)文件的右键菜单 diff --git a/ContextMenuManager/Properties/Resources/Texts/GuidInfosDic.ini b/ContextMenuManager/Properties/Resources/Texts/GuidInfosDic.ini index 66bebe1..ef15cb9 100644 --- a/ContextMenuManager/Properties/Resources/Texts/GuidInfosDic.ini +++ b/ContextMenuManager/Properties/Resources/Texts/GuidInfosDic.ini @@ -255,4 +255,16 @@ Text=金山毒霸(32位)扫描 && 文件粉碎 Icon=.\kismain.exe,0 [8f556da3-987d-47b0-aa88-eb8d52fe1b9a] Text=迅雷播放组件 -Icon=..\Program\XMP\XMP.exe,0 \ No newline at end of file +Icon=..\Program\XMP\XMP.exe,0 +[dde4beeb-dde6-48fd-8eb5-035c09923f83] +Text=Unlocker +Icon=.\Unlocker.exe,0 +[9c5397bb-07be-4e38-98ba-395f94045091] +Text=福昕PDF编辑器 +Icon=..\FoxitPhantom.exe,0 +[eee949eb-c9ed-4967-98b0-ed4e543befa5] +Text=115网盘 +Icon=..\115chrome.exe,0 +[C49499AC-DC25-478B-B903-E005012B3DD1] +Text=使用智量扫描 +Icon=.\WiseVector.exe,0 \ No newline at end of file diff --git a/languages/zh-CN.ini b/languages/zh-CN.ini index 50e4be9..c434bb1 100644 --- a/languages/zh-CN.ini +++ b/languages/zh-CN.ini @@ -31,6 +31,7 @@ OpenWith = 打开方式 WinX = Win+X LnkFile = lnk文件 +UwpLnk = uwp lnk ExeFile = exe文件 TextFile = 文本文件 ImageFile = 图像文件 @@ -67,6 +68,7 @@ OpenWith = 所有文件右键 "打开方式" 的菜单项目 WinX = Win10 "开始" 按钮的右键Win+X菜单项目 LnkFile = 所有快捷方式的右键菜单 +UwpLnk = Win10 UWP应用快捷方式的右键菜单 ExeFile = 所有EXE可执行文件的右键菜单 TextFile = 通用文本格式(如.txt、.ini)文件的右键菜单 ImageFile = 通用图像格式(如.jpg、.png)文件的右键菜单