CmisSync.Lib.Filter.IgnoredFileNamesFilter.CheckFile C# (CSharp) Метод

CheckFile() публичный Метод

Checks the filename for valid regex.
public CheckFile ( string name, string &reason ) : bool
name string /// The file name ///
reason string /// Is set to the reason if true is returned. ///
Результат bool
        public virtual bool CheckFile(string name, out string reason) {
            lock (this.wildCardLock) {
                reason = string.Empty;
                if (!Utils.WorthSyncing(name, new List<string>())) {
                    reason = string.Format("Invalid file name: {0}", name);
                    return true;
                }

                foreach (var wildcard in this.wildcards) {
                    if (wildcard.IsMatch(name)) {
                        reason = string.Format("filename {1} matches: {0}", wildcard.ToString(), name);
                        return true;
                    }
                }
            }

            return false;
        }
    }

Usage Example

 public void AllowCorrectEventsTest()
 {
     var filter = new IgnoredFileNamesFilter();
     string reason;
     Assert.That(filter.CheckFile("testfile", out reason), Is.False);
     Assert.That(string.IsNullOrEmpty(reason), Is.True);
 }
All Usage Examples Of CmisSync.Lib.Filter.IgnoredFileNamesFilter::CheckFile