BlinkSyncLib.Sync.ShouldExclude C# (CSharp) Method

ShouldExclude() private method

For a given include and exclude list of regex's and a name to match, determines if the named item should be excluded
private ShouldExclude ( Regex excludeList, Regex includeList, string name ) : bool
excludeList System.Text.RegularExpressions.Regex
includeList System.Text.RegularExpressions.Regex
name string
return bool
        private bool ShouldExclude(Regex[] excludeList, Regex[] includeList, string name)
        {
            if (excludeList != null)
            {
                // check against regex's in our exclude list
                foreach (Regex regex in excludeList)
                {
                    if (regex.Match(name).Success)
                    {
                        // if the name matches an entry in the exclude list, we SHOULD exclude it
                        return true;
                    }
                }
                // no matches in exclude list, we should NOT exclude it
                return false;
            }
            else if (includeList != null)
            {
                foreach (Regex regex in includeList)
                {
                    if (regex.Match(name).Success)
                    {
                        // if the name matches an entry in the include list, we should NOT exclude it
                        return false;
                    }
                }
                // no matches in include list, we SHOULD exclude it
                return true;
            }

            return false;
        }