mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 09:06:23 +02:00
Code cleanup
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user