refactor: split node agent and Go control plane
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
namespace WxAgent.Core;
|
||||
|
||||
public sealed record WechatNoteWindowCandidate(long Handle, int ProcessId, string Title, bool IsVisible, bool HasChatSurface);
|
||||
|
||||
public static class WechatNoteWindow
|
||||
{
|
||||
public static long? FindOpened(IEnumerable<WechatNoteWindowCandidate> windows, int processId, IReadOnlySet<long> previousHandles)
|
||||
{
|
||||
var candidates = windows.Where(window => window.Handle != 0 && window.ProcessId == processId
|
||||
&& !previousHandles.Contains(window.Handle) && window.IsVisible && !window.HasChatSurface
|
||||
&& window.Title.Contains("笔记", StringComparison.Ordinal)).ToArray();
|
||||
if (candidates.Length > 1)
|
||||
throw new WxAgentException(WxAgentErrorCode.UiStructureChanged, "Multiple new note windows appeared; refusing ambiguous content.");
|
||||
return candidates.Length == 1 ? candidates[0].Handle : null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user