Beispiel #1
0
 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 (string.IsNullOrWhiteSpace(item.Text))
         {
             item.Text = GuidInfo.GetText(guid);
         }
         if (string.IsNullOrWhiteSpace(item.DefaultKeyName))
         {
             item.DefaultKeyName = guid.ToString("B");
         }
         item.SetTip(itemXE.GetAttribute("Tip"));
         list.AddItem(item);
     }
 }
Beispiel #2
0
            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);
            }