Files
wx-win-agent/node-agent/WxAgent.Core/WechatMentionOptionSelection.cs
T
rogee edba7d0d38
Build web service image / build (push) Successful in 1m15s
feat: support long text and safe attachment batches
2026-09-30 09:16:36 +08:00

26 lines
890 B
C#

namespace WxAgent.Core;
public static class WechatMentionOptionSelection
{
public static int FindUniqueVisibleOptionIndex(
IReadOnlyList<string?> groupMemberDisplayNames,
IReadOnlyList<(string? Name, bool IsOffscreen, bool HasBounds)> options,
string requestedName)
{
ArgumentException.ThrowIfNullOrWhiteSpace(requestedName);
if (groupMemberDisplayNames.Count(name => string.Equals(name, requestedName, StringComparison.Ordinal)) != 1)
return -1;
var match = -1;
for (var index = 0; index < options.Count; index++)
{
var option = options[index];
if (!string.Equals(option.Name, requestedName, StringComparison.Ordinal)) continue;
if (match >= 0 || option.IsOffscreen || !option.HasBounds) return -1;
match = index;
}
return match;
}
}