Code cleanup

This commit is contained in:
Stone_Red
2026-06-10 00:29:28 +02:00
parent 91e8cbb00a
commit 31e54c1637
11 changed files with 184 additions and 186 deletions
+21 -27
View File
@@ -1,36 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using RemSox.Processes;
using RemSox.Processing;
namespace RemSox.Processing
namespace RemSox.Processing;
public static class ProcessManifest
{
public static class ProcessManifest
[Flags]
public enum ProcessManifestFlags
{
[Flags]
public enum ProcessManifestFlags
{
None = 0,
Singleton = 1 << 0,
System = 1 << 1
}
None = 0,
Singleton = 1 << 0,
System = 1 << 1
}
private static readonly Dictionary<Type, ProcessManifestFlags> map = new()
{
{ typeof(DesktopProcess), ProcessManifestFlags.Singleton | ProcessManifestFlags.System },
{ typeof(CliProcess), ProcessManifestFlags.Singleton | ProcessManifestFlags.System }
};
private static readonly Dictionary<Type, ProcessManifestFlags> map = new()
{
{ typeof(DesktopProcess), ProcessManifestFlags.Singleton | ProcessManifestFlags.System },
{ typeof(CliProcess), ProcessManifestFlags.Singleton | ProcessManifestFlags.System }
};
public static bool HasFlag<T>(ProcessManifestFlags flag) where T : Process
{
return map.TryGetValue(typeof(T), out var flags) && flags.HasFlag(flag);
}
public static bool HasFlag<T>(ProcessManifestFlags flag) where T : Process
{
return map.TryGetValue(typeof(T), out ProcessManifestFlags flags) && flags.HasFlag(flag);
}
public static bool HasFlag(Type t, ProcessManifestFlags flag)
{
return map.TryGetValue(t, out var flags) && flags.HasFlag(flag);
}
public static bool HasFlag(Type t, ProcessManifestFlags flag)
{
return map.TryGetValue(t, out ProcessManifestFlags flags) && flags.HasFlag(flag);
}
}