diff --git a/AppWindows/App.cs b/AppWindows/App.cs index 2b24249..aee4e92 100644 --- a/AppWindows/App.cs +++ b/AppWindows/App.cs @@ -6,8 +6,7 @@ namespace AppSys; public sealed class App : IApp { private static readonly IHandler[] Handlers = [ - new HandlerProcesses(), - new HandlerApps() + new HandlerProcesses() ]; public string[] RecognizedNames => [ diff --git a/AppWindows/Handlers/HandlerApps.cs b/AppWindows/Handlers/HandlerApps.cs deleted file mode 100644 index 9a4f191..0000000 --- a/AppWindows/Handlers/HandlerApps.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using Base; - -namespace AppSys.Handlers; - -sealed class HandlerApps : IHandler { - private static readonly string PathSystem = Environment.GetFolderPath(Environment.SpecialFolder.System); - - private static readonly Dictionary<string, ProcessStartInfo> Mappings = new () { - { - "audio", new ProcessStartInfo { - FileName = Path.Combine(PathSystem, "control.exe"), - Arguments = "mmsys.cpl" - } - }, { - "programs", new ProcessStartInfo { - FileName = Path.Combine(PathSystem, "control.exe"), - Arguments = "appwiz.cpl" - } - }, { - "system", new ProcessStartInfo { - FileName = Path.Combine(PathSystem, "control.exe"), - Arguments = "sysdm.cpl" - } - }, { - "environment", new ProcessStartInfo { - FileName = Path.Combine(PathSystem, "rundll32.exe"), - Arguments = "sysdm.cpl,EditEnvironmentVariables" - } - } - }; - - private static readonly Dictionary<string, string> Substitutions = new () { - { "sounds", "audio" }, - { "apps", "programs" }, - { "appwiz", "programs" }, - { "env", "environment" }, - { "envvars", "environment" }, - { "vars", "environment" }, - { "variables", "environment" } - }; - - public bool Matches(Command cmd) { - return Mappings.ContainsKey(cmd.Text) || Substitutions.ContainsKey(cmd.Text); - } - - public string? Handle(Command cmd) { - if (!Substitutions.TryGetValue(cmd.Text, out string? key)) { - key = cmd.Text; - } - - using (Process.Start(Mappings[key])) {} - - return null; - } -}