From b8d9023efc9c755b2481854fafdeedb3e6ab47de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=93=9D=E7=82=B9lilac?= Date: Tue, 24 Nov 2020 05:21:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=B7=BB=E5=8A=A0=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A8=A1=E5=9D=97=E7=A7=BB=E5=8A=A8=E5=88=B0?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controls/AddCommonButton.cs | 12 - .../Controls/EnhanceMenusItem.cs | 109 +++++++++ .../Controls/EnhanceMenusList.cs | 197 +++++++++++++++ .../Controls/SelectItemsForm.cs | 65 ----- .../Controls/ShellCommonDialog.cs | 227 ------------------ .../Properties/Resources/Images/AddCommon.png | Bin 1028 -> 0 bytes ...ShellCommonDic.xml => EnhanceMenusDic.xml} | 66 +++-- 7 files changed, 352 insertions(+), 324 deletions(-) delete mode 100644 ContextMenuManager/Controls/AddCommonButton.cs create mode 100644 ContextMenuManager/Controls/EnhanceMenusItem.cs create mode 100644 ContextMenuManager/Controls/EnhanceMenusList.cs delete mode 100644 ContextMenuManager/Controls/SelectItemsForm.cs delete mode 100644 ContextMenuManager/Controls/ShellCommonDialog.cs delete mode 100644 ContextMenuManager/Properties/Resources/Images/AddCommon.png rename ContextMenuManager/Properties/Resources/Texts/{ShellCommonDic.xml => EnhanceMenusDic.xml} (81%) diff --git a/ContextMenuManager/Controls/AddCommonButton.cs b/ContextMenuManager/Controls/AddCommonButton.cs deleted file mode 100644 index e7f5302..0000000 --- a/ContextMenuManager/Controls/AddCommonButton.cs +++ /dev/null @@ -1,12 +0,0 @@ -using BulePointLilac.Controls; - -namespace ContextMenuManager.Controls -{ - sealed class AddCommonButton : PictureButton - { - public AddCommonButton() : base(AppImage.AddCommon) - { - MyToolTip.SetToolTip(this, AppString.Tip.AddCommonItems); - } - } -} \ No newline at end of file diff --git a/ContextMenuManager/Controls/EnhanceMenusItem.cs b/ContextMenuManager/Controls/EnhanceMenusItem.cs new file mode 100644 index 0000000..17a7a1a --- /dev/null +++ b/ContextMenuManager/Controls/EnhanceMenusItem.cs @@ -0,0 +1,109 @@ +using BulePointLilac.Controls; +using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml; + +namespace ContextMenuManager.Controls +{ + sealed class EnhanceShellItem : MyListItem, IFoldSubItem, IChkVisibleItem + { + public string RegPath { get; set; } + public XmlElement ItemXE { get; set; } + public VisibleCheckBox ChkVisible { get; set; } + public IFoldGroupItem FoldGroupItem { get; set; } + public bool ItemVisible + { + get + { + using(RegistryKey key = RegistryEx.GetRegistryKey(RegPath)) + return key != null; + } + set + { + if(value) WriteSubKeysValue(ItemXE, RegPath); + else RegistryEx.DeleteKeyTree(RegPath); + } + } + + public EnhanceShellItem() + { + ChkVisible = new VisibleCheckBox(this); + } + + private static void WriteAttributesValue(XmlNode valueXN, string regPath) + { + if(valueXN == null) return; + XmlNode szXN = valueXN.SelectSingleNode("REG_SZ"); + XmlNode dwordXN = valueXN.SelectSingleNode("REG_DWORD"); + XmlNode expand_szXN = valueXN.SelectSingleNode("REG_EXPAND_SZ"); + if(szXN != null) + foreach(XmlAttribute a in szXN.Attributes) + Registry.SetValue(regPath, a.Name, a.Value, RegistryValueKind.String); + if(expand_szXN != null) + foreach(XmlAttribute a in expand_szXN.Attributes) + Registry.SetValue(regPath, a.Name, a.Value, RegistryValueKind.ExpandString); + if(dwordXN != null) + foreach(XmlAttribute a in dwordXN.Attributes) + { + int value = a.Value.StartsWith("0x", StringComparison.OrdinalIgnoreCase) + ? Convert.ToInt32(a.Value, 16) : Convert.ToInt32(a.Value); + Registry.SetValue(regPath, a.Name, value, RegistryValueKind.DWord); + } + } + + private static void WriteSubKeysValue(XmlElement keyXE, string regPath) + { + if(keyXE == null) return; + string defaultValue = keyXE.GetAttribute("Default"); + if(!defaultValue.IsNullOrWhiteSpace()) Registry.SetValue(regPath, "", defaultValue); + WriteAttributesValue(keyXE.SelectSingleNode("Value"), regPath); + + XmlNode subKeyXN = keyXE.SelectSingleNode("SubKey"); + if(subKeyXN != null) + { + foreach(XmlElement xe in subKeyXN.ChildNodes) + WriteSubKeysValue(xe, $@"{regPath}\{xe.Name}"); + } + } + } + + sealed class EnhanceShellExItem : MyListItem, IFoldSubItem, IChkVisibleItem + { + public string ShellExPath { get; set; } + public string DefaultKeyName { get; set; } + public Guid Guid { get; set; } + public VisibleCheckBox ChkVisible { get; set; } + public IFoldGroupItem FoldGroupItem { get; set; } + public bool ItemVisible + { + get => ShellExItem.GetPathAndGuids(ShellExPath).Values.Contains(Guid); + set + { + if(value) + { + string regPath = ObjectPath.GetNewPathWithIndex + ($@"{ShellExPath}\ContextMenuHandlers\{DefaultKeyName}", ObjectPath.PathType.Registry); + Registry.SetValue(regPath, "", this.Guid.ToString("B")); + } + else + { + Dictionary dic = ShellExItem.GetPathAndGuids(ShellExPath); + foreach(string regPath in dic.Keys) + { + if(dic[regPath].Equals(this.Guid)) + RegistryEx.DeleteKeyTree(regPath); + } + } + } + } + + public EnhanceShellExItem() + { + ChkVisible = new VisibleCheckBox(this); + } + } +} \ No newline at end of file diff --git a/ContextMenuManager/Controls/EnhanceMenusList.cs b/ContextMenuManager/Controls/EnhanceMenusList.cs new file mode 100644 index 0000000..5f67f72 --- /dev/null +++ b/ContextMenuManager/Controls/EnhanceMenusList.cs @@ -0,0 +1,197 @@ +using BulePointLilac.Controls; +using BulePointLilac.Methods; +using ContextMenuManager.Controls.Interfaces; +using System; +using System.Drawing; +using System.IO; +using System.Text; +using System.Xml; + +namespace ContextMenuManager.Controls +{ + sealed class EnhanceMenusList : MyList + { + public void LoadItems() + { + this.ClearItems(); + XmlDocument doc = ReadXml(); + foreach(XmlNode xn in doc.DocumentElement.ChildNodes) + { + string path = null; + string text = null; + Image image = null; + switch(xn.Name) + { + case "File": + path = ShellList.MENUPATH_FILE; + text = AppString.SideBar.File; + image = AppImage.File; + break; + case "Folder": + path = ShellList.MENUPATH_FOLDER; + text = AppString.SideBar.Folder; + image = AppImage.Folder; + break; + case "Directory": + path = ShellList.MENUPATH_FOLDER; + text = AppString.SideBar.Directory; + image = AppImage.Directory; + break; + case "Background": + path = ShellList.MENUPATH_BACKGROUND; + text = AppString.SideBar.Background; + image = AppImage.Background; + break; + case "Desktop": + path = ShellList.MENUPATH_DESKTOP; + //Vista没有桌面右键菜单的独立注册表项 + if(WindowsOsVersion.IsEqualVista) path = ShellList.MENUPATH_BACKGROUND; + text = AppString.SideBar.Desktop; + image = AppImage.Desktop; + break; + case "Drive": + path = ShellList.MENUPATH_DRIVE; + text = AppString.SideBar.Drive; + image = AppImage.Drive; + break; + case "AllObjects": + path = ShellList.MENUPATH_ALLOBJECTS; + text = AppString.SideBar.AllObjects; + image = AppImage.AllObjects; + break; + case "Computer": + path = ShellList.MENUPATH_COMPUTER; + text = AppString.SideBar.Computer; + image = AppImage.Computer; + break; + case "RecycleBin": + path = ShellList.MENUPATH_RECYCLEBIN; + text = AppString.SideBar.RecycleBin; + image = AppImage.RecycleBin; + break; + default: + XmlElement xe = (XmlElement)xn; + path = xe.GetAttribute("RegPath"); + text = ResourceString.GetDirectString(xe.GetAttribute("Text")); + image = ResourceIcon.GetIcon(xe.GetAttribute("Icon"))?.ToBitmap() ?? AppImage.NotFound; + break; + } + if(string.IsNullOrEmpty(path) || string.IsNullOrEmpty(text)) continue; + GroupPathItem groupItem = new GroupPathItem + { + PathType = ObjectPath.PathType.Registry, + TargetPath = path, + Image = image, + Text = text, + }; + this.AddItem(groupItem); + XmlElement shellXE = (XmlElement)xn.SelectSingleNode("Shell"); + XmlElement shellExXE = (XmlElement)xn.SelectSingleNode("ShellEx"); + if(shellXE != null) LoadShellItems(shellXE, groupItem); + if(shellExXE != null) LoadShellExItems(shellExXE, groupItem); + groupItem.IsFold = true; + } + + } + + private XmlDocument ReadXml() + { + XmlDocument doc1 = new XmlDocument(); + //如果没有网络下载的,则将程序内置的写入 + if(!File.Exists(Program.AppDataEnhanceMenusDicPath)) + { + File.WriteAllText(Program.AppDataEnhanceMenusDicPath, Properties.Resources.EnhanceMenusDic, Encoding.UTF8); + } + doc1.Load(Program.AppDataEnhanceMenusDicPath); + if(File.Exists(Program.EnhanceMenusDicPath)) + { + XmlDocument doc2 = new XmlDocument(); + doc2.Load(Program.EnhanceMenusDicPath); + foreach(XmlNode xn in doc2.DocumentElement.ChildNodes) + { + XmlNode node = doc1.ImportNode(xn, true); + doc1.DocumentElement.AppendChild(node); + } + } + return doc1; + } + + private void LoadShellItems(XmlElement shellXE, GroupPathItem groupItem) + { + foreach(XmlElement itemXE in shellXE.GetElementsByTagName("Item")) + { + XmlElement verXE = (XmlElement)itemXE.SelectSingleNode("OSVersion"); + if(!JudgeOSVersion(verXE)) continue; + XmlElement szXE = (XmlElement)itemXE.SelectSingleNode("Value/REG_SZ"); + string keyName = itemXE.GetAttribute("KeyName"); + if(keyName.IsNullOrWhiteSpace()) continue; + string regPath = $@"{groupItem.TargetPath}\shell\{keyName}"; + EnhanceShellItem item = new EnhanceShellItem() + { + RegPath = $@"{groupItem.TargetPath}\shell\{keyName}", + FoldGroupItem = groupItem, + ItemXE = itemXE + }; + if(szXE != null) + { + item.Text = ResourceString.GetDirectString(szXE.GetAttribute("MUIVerb")); + if(szXE.HasAttribute("Icon")) item.Image = ResourceIcon.GetIcon(szXE.GetAttribute("Icon"))?.ToBitmap(); + else if(szXE.HasAttribute("HasLUAShield")) item.Image = AppImage.Shield; + } + if(item.Image == null) item.Image = AppImage.NotFound; + if(item.Text.IsNullOrWhiteSpace()) item.Text = keyName; + item.ChkVisible.Checked = item.ItemVisible; + MyToolTip.SetToolTip(item.ChkVisible, itemXE.GetAttribute("Tip")); + this.AddItem(item); + } + } + + private void LoadShellExItems(XmlElement shellExXE, GroupPathItem groupItem) + { + foreach(XmlElement itemXE in shellExXE.GetElementsByTagName("Item")) + { + XmlElement verXE = (XmlElement)itemXE.SelectSingleNode("OSVersion"); + if(!JudgeOSVersion(verXE)) continue; + if(!GuidInfo.TryGetGuid(itemXE.GetAttribute("Guid"), out Guid guid)) continue; + EnhanceShellExItem item = new EnhanceShellExItem + { + FoldGroupItem = groupItem, + ShellExPath = $@"{groupItem.TargetPath}\ShellEx", + Image = ResourceIcon.GetIcon(itemXE.GetAttribute("Icon"))?.ToBitmap() ?? AppImage.DllDefaultIcon, + Text = ResourceString.GetDirectString(itemXE.GetAttribute("Text")), + DefaultKeyName = itemXE.GetAttribute("KeyName"), + Guid = guid + }; + if(item.Text.IsNullOrWhiteSpace()) item.Text = GuidInfo.GetText(guid); + if(item.DefaultKeyName.IsNullOrWhiteSpace()) item.DefaultKeyName = guid.ToString("B"); + item.ChkVisible.Checked = item.ItemVisible; + MyToolTip.SetToolTip(item.ChkVisible, itemXE.GetAttribute("Tip")); + this.AddItem(item); + } + } + + public static bool JudgeOSVersion(XmlElement osXE) + { + if(osXE == null) return true; + Version ver = new Version(osXE.InnerText); + Version osVer = Environment.OSVersion.Version; + int compare = osVer.CompareTo(ver); + string symbol = osXE.GetAttribute("Compare"); + switch(symbol) + { + case ">": + return compare > 0; + case "<": + return compare < 0; + case "=": + return compare == 0; + case ">=": + return compare >= 0; + case "<=": + return compare <= 0; + default: + return true; + } + } + } +} \ No newline at end of file diff --git a/ContextMenuManager/Controls/SelectItemsForm.cs b/ContextMenuManager/Controls/SelectItemsForm.cs deleted file mode 100644 index 818b3e1..0000000 --- a/ContextMenuManager/Controls/SelectItemsForm.cs +++ /dev/null @@ -1,65 +0,0 @@ -using BulePointLilac.Controls; -using BulePointLilac.Methods; -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace ContextMenuManager.Controls -{ - class SelectItemsForm : Form - { - public SelectItemsForm() - { - this.AcceptButton = btnOk; - this.CancelButton = btnCancel; - this.Font = SystemFonts.MessageBoxFont; - this.ShowIcon = this.ShowInTaskbar = false; - this.StartPosition = FormStartPosition.CenterParent; - this.MinimumSize = this.Size = new Size(652, 425).DpiZoom(); - list.Owner = listBox; - InitializeComponents(); - } - - protected MyList list = new MyList(); - protected MyListBox listBox = new MyListBox(); - protected Panel pnlBorder = new Panel - { - BackColor = Color.FromArgb(200, 200, 200) - }; - protected Button btnOk = new Button - { - Anchor = AnchorStyles.Bottom | AnchorStyles.Right, - DialogResult = DialogResult.OK, - Text = AppString.Dialog.Ok, - AutoSize = true - }; - protected Button btnCancel = new Button - { - Anchor = AnchorStyles.Bottom | AnchorStyles.Right, - DialogResult = DialogResult.Cancel, - Text = AppString.Dialog.Cancel, - AutoSize = true - }; - - private void InitializeComponents() - { - this.Controls.AddRange(new Control[] { listBox, pnlBorder, btnOk, btnCancel }); - int a = 20.DpiZoom(); - listBox.Location = new Point(a, a); - pnlBorder.Location = new Point(a - 1, a - 1); - btnOk.Top = btnCancel.Top = this.ClientSize.Height - btnCancel.Height - a; - btnCancel.Left = this.ClientSize.Width - btnCancel.Width - a; - btnOk.Left = btnCancel.Left - btnOk.Width - a; - this.OnResize(null); - } - - protected override void OnResize(EventArgs e) - { - base.OnResize(e); - listBox.Width = ClientSize.Width - 2 * listBox.Left; - listBox.Height = btnOk.Top - 2 * listBox.Top; - pnlBorder.Width = listBox.Width + 2; - pnlBorder.Height = listBox.Height + 2; - } - } -} \ No newline at end of file diff --git a/ContextMenuManager/Controls/ShellCommonDialog.cs b/ContextMenuManager/Controls/ShellCommonDialog.cs deleted file mode 100644 index 7c70fd3..0000000 --- a/ContextMenuManager/Controls/ShellCommonDialog.cs +++ /dev/null @@ -1,227 +0,0 @@ -using BulePointLilac.Controls; -using BulePointLilac.Methods; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Xml; -using static Microsoft.Win32.Registry; - -namespace ContextMenuManager.Controls -{ - sealed class ShellCommonDialog : CommonDialog - { - public List SelectedShellPaths { get; private set; } - public Dictionary SelectedShellExPathAndGuids { get; private set; } - public string ShellExPath { get; set; } - public string ShellPath { get; set; } - public string ScenePath { get; set; } - public override void Reset() { } - - protected override bool RunDialog(IntPtr hwndOwner) - { - using(ShellCommonForm frm = new ShellCommonForm(ScenePath, ShellPath, ShellExPath)) - { - if(frm.ShowDialog() == DialogResult.OK) - { - this.SelectedShellPaths = frm.SelectedShellPaths; - this.SelectedShellExPathAndGuids = frm.SelectedShellExPathAndGuids; - return true; - } - return false; - } - } - - sealed class ShellCommonForm : SelectItemsForm - { - public ShellCommonForm(string scenePath, string shellPath, string shellExPath) - { - this.ScenePath = scenePath; - this.ShellPath = shellPath; - this.ShellExPath = shellExPath; - this.Text = AppString.Dialog.CheckCommon; - btnOk.Click += (sender, e) => GetSelectedItems(); - LoadItems(); - } - - public List SelectedShellPaths { get; private set; } = new List(); - public Dictionary SelectedShellExPathAndGuids { get; private set; } = new Dictionary(); - public string ScenePath { get; set; } - public string ShellPath { get; set; } - public string ShellExPath { get; set; } - private XmlElement shellXE; - private XmlElement shellExXE; - - public void LoadItems() - { - XmlDocument doc1 = new XmlDocument(); - if(!File.Exists(Program.AppDataShellCommonDicPath)) - { - File.WriteAllText(Program.AppDataShellCommonDicPath, Properties.Resources.ShellCommonDic, Encoding.UTF8); - } - doc1.Load(Program.AppDataShellCommonDicPath); - - if(File.Exists(Program.ShellCommonDicPath)) - { - XmlDocument doc2 = new XmlDocument(); - doc2.Load(Program.ShellCommonDicPath); - foreach(XmlNode xn in doc2.DocumentElement.ChildNodes) - { - XmlNode node = doc1.ImportNode(xn, true); - doc1.DocumentElement.AppendChild(node); - } - } - - foreach(XmlElement groupXE in doc1.DocumentElement.ChildNodes) - { - string scenePath = groupXE.GetAttribute("RegPath"); - if(ScenePath.Equals(scenePath, StringComparison.OrdinalIgnoreCase)) - { - shellXE = (XmlElement)groupXE.SelectSingleNode("Shell"); - shellExXE = (XmlElement)groupXE.SelectSingleNode("ShellEx"); - if(shellXE != null) LoadShellItems(); - if(ShellExPath != null && shellExXE != null) LoadShellExItems(); - } - } - } - - private void LoadShellItems() - { - foreach(XmlElement itemXE in shellXE.GetElementsByTagName("Item")) - { - XmlElement szXE = (XmlElement)itemXE.SelectSingleNode("Value/REG_SZ"); - string keyName = itemXE.GetAttribute("KeyName"); - if(keyName.IsNullOrWhiteSpace()) continue; - ShellCommonItem item = new ShellCommonItem - { - DefaultKeyName = keyName, - ItemXE = itemXE - }; - if(szXE != null) - { - item.Text = ResourceString.GetDirectString(szXE.GetAttribute("MUIVerb")); - if(szXE.HasAttribute("Icon")) item.Image = ResourceIcon.GetIcon(szXE.GetAttribute("Icon"))?.ToBitmap(); - else if(szXE.HasAttribute("HasLUAShield")) item.Image = AppImage.Shield; - } - if(item.Image == null) item.Image = AppImage.NotFound; - if(item.Text.IsNullOrWhiteSpace()) item.Text = item.DefaultKeyName; - item.SetTip(itemXE.GetAttribute("Tip")); - list.AddItem(item); - } - } - - private void LoadShellExItems() - { - foreach(XmlElement itemXE in shellExXE.GetElementsByTagName("Item")) - { - if(!GuidInfo.TryGetGuid(itemXE.GetAttribute("Guid"), out Guid guid)) continue; - if(ShellExItem.GetPathAndGuids(ShellExPath).Values.Contains(guid)) continue; - ShellExCommonItem item = new ShellExCommonItem - { - Image = ResourceIcon.GetIcon(itemXE.GetAttribute("Icon"))?.ToBitmap() ?? AppImage.DllDefaultIcon, - Text = ResourceString.GetDirectString(itemXE.GetAttribute("Text")), - DefaultKeyName = itemXE.GetAttribute("KeyName"), - Guid = guid - }; - if(item.Text.IsNullOrWhiteSpace()) item.Text = GuidInfo.GetText(guid); - if(item.DefaultKeyName.IsNullOrWhiteSpace()) item.DefaultKeyName = guid.ToString("B"); - item.SetTip(itemXE.GetAttribute("Tip")); - list.AddItem(item); - } - } - - private void GetSelectedItems() - { - foreach(Control ctr in list.Controls) - { - if(ctr.GetType() == typeof(ShellCommonItem)) CreateShellItem((ShellCommonItem)ctr); - else if(ctr.GetType() == typeof(ShellExCommonItem)) CreateShellExItem((ShellExCommonItem)ctr); - } - } - - private void CreateShellItem(ShellCommonItem item) - { - if(!item.IsSelected) return; - string regPath = ObjectPath.GetNewPathWithIndex - ($@"{ShellPath}\{item.DefaultKeyName}", ObjectPath.PathType.Registry); - ShellCommonItem.WriteSubKeysValue(item.ItemXE, regPath); - SelectedShellPaths.Add(regPath); - } - - private void CreateShellExItem(ShellExCommonItem item) - { - if(!item.IsSelected) return; - string regPath = ObjectPath.GetNewPathWithIndex - ($@"{ShellExPath}\ContextMenuHandlers\{item.DefaultKeyName}", ObjectPath.PathType.Registry); - SetValue(regPath, "", item.Guid.ToString("B")); - SelectedShellExPathAndGuids.Add(regPath, item.Guid); - } - } - } - - class CheckBoxItem : MyListItem - { - readonly CheckBox chkSelected = new CheckBox { AutoSize = true }; - public bool IsSelected => chkSelected.Checked; - - public CheckBoxItem() - { - this.AddCtr(chkSelected); - } - - public void SetTip(string tip) - { - MyToolTip.SetToolTip(chkSelected, tip); - } - } - - sealed class ShellCommonItem : CheckBoxItem - { - public string DefaultKeyName { get; set; } - public XmlElement ItemXE { get; set; } - - public static void WriteAttributesValue(XmlNode valueXN, string regPath) - { - if(valueXN == null) return; - XmlNode szXN = valueXN.SelectSingleNode("REG_SZ"); - XmlNode dwordXN = valueXN.SelectSingleNode("REG_DWORD"); - XmlNode expand_szXN = valueXN.SelectSingleNode("REG_EXPAND_SZ"); - if(szXN != null) - foreach(XmlAttribute a in szXN.Attributes) - SetValue(regPath, a.Name, a.Value, Microsoft.Win32.RegistryValueKind.String); - if(expand_szXN != null) - foreach(XmlAttribute a in expand_szXN.Attributes) - SetValue(regPath, a.Name, a.Value, Microsoft.Win32.RegistryValueKind.ExpandString); - if(dwordXN != null) - foreach(XmlAttribute a in dwordXN.Attributes) - { - int value = a.Value.StartsWith("0x", StringComparison.OrdinalIgnoreCase) - ? Convert.ToInt32(a.Value, 16) : Convert.ToInt32(a.Value); - SetValue(regPath, a.Name, value, Microsoft.Win32.RegistryValueKind.DWord); - } - } - - public static void WriteSubKeysValue(XmlElement keyXE, string regPath) - { - if(keyXE == null) return; - string defaultValue = keyXE.GetAttribute("Default"); - if(!defaultValue.IsNullOrWhiteSpace()) SetValue(regPath, "", defaultValue); - WriteAttributesValue(keyXE.SelectSingleNode("Value"), regPath); - - XmlNode subKeyXN = keyXE.SelectSingleNode("SubKey"); - if(subKeyXN != null) - { - foreach(XmlElement xe in subKeyXN.ChildNodes) - WriteSubKeysValue(xe, $@"{regPath}\{xe.Name}"); - } - } - } - - sealed class ShellExCommonItem : CheckBoxItem - { - public string DefaultKeyName { get; set; } - public Guid Guid { get; set; } - } -} \ No newline at end of file diff --git a/ContextMenuManager/Properties/Resources/Images/AddCommon.png b/ContextMenuManager/Properties/Resources/Images/AddCommon.png deleted file mode 100644 index 3b6704cbe1ca28b2635e3d26fe9aa6a7ed8ce5fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1028 zcmV+f1pE7mP) zUx*cT6vsbj_aPs8=&3R@`ty)wB_&uAi3>sWvKiHG*50|fL|WoQh@e!sTMxa2R^V1b zY%^mjD<<|Bkz0gl-q$DfQ!Hdgi~DQG^27p*WK4A5ncq=LhSoD!bOzt5YAGQ<9U9v z=;3ENNFT2Q8w-Wn3*}#6KXuuY;R1aQV&C;`ePNo2{k$Y!y0}&`zK$X6?GR|;>$7Qz#ZNk=xHMBqpu5$|gk|Qma}={;DjBXfSnHuVV`Bcuim8v) zjL3!F7`pI2r1ui>Q|d8mVl;F2Wbq}~MeIsYhu_4^0Qbd#=D3kjxm+n|6{kRr*Z9q5 zt$>dr497pO{Wc8~aWoYZ*UX#1JMn{Vk9C!7xITdzuko9GDulWT!5;z|VC9^L(4R3u_zgU|-t$uieEL>K7 z)fv8KB7}aX+{T>W7?W;l^Kes8*$lZ;W9M|n6J7&W+@ +子元素SubKey的所有子元素是该项的子项,项名即为元素名; 每一Item项和SubKey的所有子元素的属性Default为该注册表项默认值,不放在Value\REG_SZ元素里面是为了防止与可能存在的键名为Default的键产生冲突--> - + @@ -14,6 +14,7 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 + 6.2 @@ -25,6 +26,7 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 + 6.3 @@ -33,11 +35,15 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 - - - + + + + + + + 6.2 @@ -50,22 +56,25 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 - + - + + 6.2 - + + 6.2 + 6.1 @@ -89,29 +98,28 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 - + - + - - + - - + + 6.1 @@ -127,7 +135,8 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 - + + 10.0 @@ -135,10 +144,19 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 + + + + + + + + + - + - + @@ -157,18 +175,20 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 - + - + + 6.2 + 6.2 @@ -181,5 +201,11 @@ Tip属性为鼠标悬浮在开关上时的提示信息,从每个Item节点开 - + + + + + + + \ No newline at end of file