private static void AddControlPanelApplets(SpecialCommandConfigurationElementCollection commands) { string controlPanelImage = FileLocations.ControlPanelImage; if (!File.Exists(controlPanelImage)) { SaveBitmap(Properties.Resources.ControlPanel, controlPanelImage); } foreach (FileInfo file in SystemRoot.GetFiles("*.cpl")) { var command = new SpecialCommandConfigurationElement(file.Name); command.Thumbnail = controlPanelImage; string thumbName = FileLocations.FormatThumbFileName(file.Name); Icon[] fileIcons = IconHandler.IconHandler.IconsFromFile(file.FullName, IconHandler.IconSize.Small); if (fileIcons != null && fileIcons.Length > 0) { SaveIcon(fileIcons[0], thumbName); } if (File.Exists(thumbName)) { command.Thumbnail = thumbName; } command.Name = EnsureAppletName(file); command.Executable = @"%systemroot%\system32\" + file.Name; commands.Add(command); } }
private static SpecialCommandConfigurationElement CreateRegEditCommand() { const string REG_EDIT_EXE = "regedt32.exe"; string regEditFile = Path.Combine(SystemRoot.FullName, REG_EDIT_EXE); Icon[] regeditIcons = IconHandler.IconHandler.IconsFromFile(regEditFile, IconHandler.IconSize.Small); var command = new SpecialCommandConfigurationElement("Registry Editor"); if (regeditIcons != null && regeditIcons.Length > 0) { FileLocations.EnsureImagesDirectory(); string thumbName = FileLocations.FormatThumbFileName(REG_EDIT_EXE); SaveIcon(regeditIcons[0], thumbName); command.Thumbnail = thumbName; } command.Executable = regEditFile; return(command); }
private static void AddMmcCommands(SpecialCommandConfigurationElementCollection commands) { Icon[] iconsList = IconHandler.IconHandler.IconsFromFile(Path.Combine(SystemRoot.FullName, "mmc.exe"), IconHandler.IconSize.Small); Random rnd = new Random(); FileLocations.EnsureImagesDirectory(); foreach (FileInfo file in SystemRoot.GetFiles("*.msc")) { MMC.MMCFile fileMMC = new MMC.MMCFile(file); var command = new SpecialCommandConfigurationElement(file.Name); if (iconsList != null && iconsList.Length > 0) { string thumbName = FileLocations.FormatThumbFileName(file.Name); command.Thumbnail = thumbName; if (fileMMC.SmallIcon != null) { SaveIcon(fileMMC.SmallIcon, thumbName); } else { SaveIcon(iconsList[rnd.Next(iconsList.Length - 1)], thumbName); } if (fileMMC.Parsed) { command.Name = fileMMC.Name; } else { command.Name = file.Name.Replace(file.Extension, ""); } } command.Executable = @"%systemroot%\system32\" + file.Name; commands.Add(command); } }