public void LoadItems(string parentPath) { this.ParentPath = parentPath; string sckValue = GetValue(parentPath, "ExtendedSubCommandsKey", null)?.ToString(); if (!sckValue.IsNullOrWhiteSpace()) { this.ShellPath = $@"HKEY_CLASSES_ROOT\{sckValue}\shell"; } else { this.ShellPath = $@"{parentPath}\shell"; } using (var shellKey = RegistryEx.GetRegistryKey(ShellPath)) { if (shellKey == null) { return; } RegTrustedInstaller.TakeRegTreeOwnerShip(shellKey.Name); Array.ForEach(shellKey.GetSubKeyNames(), keyName => { string regPath = $@"{ShellPath}\{keyName}"; int value = Convert.ToInt32(GetValue(regPath, "CommandFlags", 0)); if (value % 16 >= 8) { this.AddItem(new SeparatorItem(this, regPath)); } else { this.AddItem(new SubShellItem(this, regPath)); } }); } }
public StoreShellItem(string regPath, bool isPublic) : base(regPath) { this.IsPublic = isPublic; this.AddCtr(chkSelected); ChkVisible.Visible = BtnSubItems.Visible = false; RegTrustedInstaller.TakeRegTreeOwnerShip(regPath); }
public void LoadItems(string parentPath) { this.ParentPath = parentPath; using (var shellKey = RegistryEx.GetRegistryKey(ShellPath)) { if (shellKey == null) { return; } RegTrustedInstaller.TakeRegTreeOwnerShip(shellKey.Name); Array.ForEach(shellKey.GetSubKeyNames(), keyName => { string regPath = $@"{ShellPath}\{keyName}"; int value = Convert.ToInt32(GetValue(regPath, "CommandFlags", 0)); if (value % 16 >= 8) { this.AddItem(new SeparatorItem(this, regPath)); } else { this.AddItem(new SubShellItem(this, regPath)); } }); } }
public StoreShellItem(string regPath, bool isPublic, bool isSelect = true) : base(regPath) { this.IsPublic = isPublic; if (isSelect) { this.AddCtr(chkSelected, 40.DpiZoom()); ChkVisible.Visible = BtnShowMenu.Visible = BtnSubItems.Visible = false; } RegTrustedInstaller.TakeRegTreeOwnerShip(regPath); }
public StoreShellItem(string regPath, bool isPublic, bool isSelect = true) : base(regPath) { this.IsPublic = isPublic; if (isSelect) { this.ContextMenuStrip = null; this.AddCtr(chkSelected); ChkVisible.Visible = BtnShowMenu.Visible = BtnSubItems.Visible = false; this.MouseClick += (sender, e) => chkSelected.Checked = !chkSelected.Checked; chkSelected.CheckedChanged += (sender, e) => SelectedChanged?.Invoke(); } RegTrustedInstaller.TakeRegTreeOwnerShip(regPath); }
private void LoadItems() { using (var shellKey = RegistryEx.GetRegistryKey(ShellItem.CommandStorePath)) { Array.ForEach(Array.FindAll(shellKey.GetSubKeyNames(), itemName => !SystemItemNames.Contains(itemName, StringComparer.OrdinalIgnoreCase)), itemName => { string regPath = $@"{ShellItem.CommandStorePath}\{itemName}"; list.AddItem(new StoreShellItem(regPath)); RegTrustedInstaller.TakeRegTreeOwnerShip(regPath); }); } }
private void LoadShellItems(string shellPath) { using (RegistryKey shellKey = RegistryEx.GetRegistryKey(shellPath)) { if (shellKey == null) { return; } RegTrustedInstaller.TakeRegTreeOwnerShip(shellKey.Name); Array.ForEach(shellKey.GetSubKeyNames(), keyName => { this.AddItem(new ShellItem($@"{shellPath}\{keyName}")); }); } }
public void LoadItems(string parentPath) { this.ParentPath = parentPath; using (var shellKey = RegistryEx.GetRegistryKey(ShellPath)) { if (shellKey == null) { return; } RegTrustedInstaller.TakeRegTreeOwnerShip(shellKey.Name); Array.ForEach(shellKey.GetSubKeyNames(), keyName => { this.AddItem(new SubShellItem($@"{ShellPath}\{keyName}")); }); } }
private void LoadShellExItems(string shellExPath) { List <string> names = new List <string>(); using (RegistryKey shellExKey = RegistryEx.GetRegistryKey(shellExPath)) { if (shellExKey == null) { return; } bool isDragDrop = Scene == Scenes.DragDrop; RegTrustedInstaller.TakeRegTreeOwnerShip(shellExKey.Name); Dictionary <string, Guid> dic = ShellExItem.GetPathAndGuids(shellExPath, isDragDrop); GroupPathItem groupItem = null; if (isDragDrop) { groupItem = GetDragDropGroupItem(shellExPath); this.AddItem(groupItem); } foreach (string path in dic.Keys) { string keyName = RegistryEx.GetKeyName(path); if (!names.Contains(keyName)) { ShellExItem item = new ShellExItem(dic[path], path); if (groupItem != null) { item.FoldGroupItem = groupItem; } this.AddItem(item); names.Add(keyName); } } if (groupItem != null) { groupItem.IsFold = true; } } }
public void LoadItems() { this.AddItem(subNewItem); subNewItem.AddNewItem += () => AddNewItem(); subNewItem.AddSeparator += () => AddSeparator(); subNewItem.AddExisting += () => AddFromParentMenu(); string sckValue = Microsoft.Win32.Registry.GetValue(this.ParentPath, "ExtendedSubCommandsKey", null)?.ToString(); if (!sckValue.IsNullOrWhiteSpace()) { this.ShellPath = $@"{RegistryEx.CLASSES_ROOT}\{sckValue}\shell"; } else { this.ShellPath = $@"{this.ParentPath}\shell"; } using (var shellKey = RegistryEx.GetRegistryKey(ShellPath)) { if (shellKey == null) { return; } RegTrustedInstaller.TakeRegTreeOwnerShip(shellKey.Name); foreach (string keyName in shellKey.GetSubKeyNames()) { string regPath = $@"{ShellPath}\{keyName}"; int value = Convert.ToInt32(Microsoft.Win32.Registry.GetValue(regPath, "CommandFlags", 0)); if (value % 16 >= 8) { this.AddItem(new SeparatorItem(this, regPath)); } else { this.AddItem(new SubShellItem(this, regPath)); } } } }