1
0
mirror of https://github.com/chylex/Query.git synced 2025-04-28 00:15:42 +02:00

Remove Windows Control Panel launcher

This commit is contained in:
chylex 2024-08-05 20:23:02 +02:00
parent 54200a9304
commit 12c5418443
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
2 changed files with 1 additions and 61 deletions
AppWindows

View File

@ -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 => [

View File

@ -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;
}
}