namespace EventBus
{
static class PropertiesToolkit
{
///
///
///
///
///
internal static bool FilterRule(this Properties source, Properties properties)
{
if (source == null) return true;
if (source.Count == 0) return true;
if (properties == null) properties = Properties.Default;
if (source.Names.Intersect(properties.Names).Count() != source.Count) return false;
foreach (var name in source.Names)
{
if (!source.TryGetValue(name, out string val)) return false;
else
{
string valstr = properties[name];
if (string.IsNullOrEmpty(valstr)) return false;
return val.Contains(valstr);
}
}
return true;
}
}
}