public List<ClientEvent> GetMatchingEvents(string eventPath)
{
var split = eventPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
if (split.Length != 3)
throw new ArgumentException("Invalid event path, expected 3 segments.");
var result = new List<ClientEvent>();
//var eventName = split[2];
// We either have to look for the name or the path, but it's
// technically possible that two areas have events with the same
// name, so the path is safer.
_clientEventsRWLS.EnterReadLock();
try
{
// TODO: Cache
var events = _clientEvents.Values.Where(a => a.Data.Path.StartsWith(eventPath));
result.AddRange(events);
}
finally
{
_clientEventsRWLS.ExitReadLock();
}
return result;
}