Publish reviewed history-free open-source snapshot (2026-10-12)

This commit is contained in:
Zonghengjia Open Source
2026-10-11 23:23:20 +00:00
commit 901f27baf5
301 changed files with 32378 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
namespace UCVL.VPNPlus;
internal static class ClientShutdownScope
{
internal record Instance(int Id, int SessionId, string? Executable);
// Legacy events are shared within the logon session. Refuse an ambiguous
// same-name process rather than signaling or closing an unrelated instance.
internal static bool IsUnambiguous(string expected, int session, IEnumerable<Instance> processes)
=> processes.Where(p => p.SessionId == session).All(p => !string.IsNullOrWhiteSpace(p.Executable)
&& string.Equals(Path.GetFullPath(p.Executable), Path.GetFullPath(expected), StringComparison.OrdinalIgnoreCase));
internal static bool SelfTest()
{
const string expected = @"C:\fixture\installed\VPNPlus.exe";
return IsUnambiguous(expected, 1, [new(10,1,expected)])
&& IsUnambiguous(expected, 1, [new(10,2,@"D:\another-user\VPNPlus.exe")])
&& IsUnambiguous(expected, 1, [new(10,1,expected.ToLowerInvariant())])
&& !IsUnambiguous(expected, 1, [new(10,1,expected),new(11,1,@"D:\another-app\VPNPlus.exe")])
&& !IsUnambiguous(expected, 1, [new(10,1,null)]);
}
}