/// <summary> /// called from checkin_click(). it checks to see if a checked item for checkin is on the ignore list /// </summary> /// <param name="name"></param> /// <returns></returns> private bool isIgnored(string name) { bool isIgnored = false; string[] ignoreListArray = new string[ignoreList.Items.Count]; ignoreList.Items.CopyTo(ignoreListArray, 0); var filters = from f in ignoreListArray where f.Contains("*") select f; if (filters.Count() > 0) { foreach (var filter in filters) { Wildcard wildcard = new Wildcard(filter, RegexOptions.IgnoreCase); // found in the filter so ignored if (wildcard.IsMatch(name)) { isIgnored = true; break; } } if (isIgnored == false) { // not in filter and not in the ignore list if (ignoreListArray.Contains(name, StringComparer.OrdinalIgnoreCase) == false) { ; } else { isIgnored = true; } } } else { // no filters and they are not in the ignore list if (ignoreListArray.Contains(name, StringComparer.OrdinalIgnoreCase) == false) { ; } else { isIgnored = true; } } return isIgnored; }
/// <summary> /// Compares pending changes to ignore list. if pending change matches an item in ignore list, uncheck the pending change /// </summary> public void checkIgnoreList() { bool found; string[] ignoreListArray = new string[ignoreList.Items.Count]; ignoreList.Items.CopyTo(ignoreListArray, 0); var filters = from f in ignoreListArray where f.Contains("*") select f; //build changes to be checked in. if (!checkBoxChecked) { foreach (changeItem item in changesCollection) { found = false; if (filters.Count() > 0) { foreach (var filter in filters) { Wildcard wildcard = new Wildcard(filter, RegexOptions.IgnoreCase); // found in the filter so false if (wildcard.IsMatch(item.fileName)) { found = true; // if the item needs to be change to false, do so and keep previous state as true if (item.selected == true) { item.selected = false; item.previousState = true; } // if the item is already false, do nothing break; } } if (found == false) { // not in filter and not in the ignore list if (ignoreListArray.Contains(item.fileName, StringComparer.OrdinalIgnoreCase) == false) { ; } else { if (item.selected == true) { item.selected = false; item.previousState = true; } } } } else { // no filters and they are not in the ignore list if (ignoreListArray.Contains(item.fileName, StringComparer.OrdinalIgnoreCase) == false) { ; } else { if (item.selected == true) { item.selected = false; item.previousState = true; } } } } } }