public List <SCFile> SearchForCheckIn(SCFolder fld, Wildcard user, Wildcard comment, Wildcard fileNameFilter, SearchCondition search, bool bSearchInHistory, CancelCallbackNotify callback) { QueryHistoryParameters qhp = new QueryHistoryParameters(fld.FolderPath, RecursionType.None); List <SCFile> lstFoundFiles = new List <SCFile>(); IEnumerable <Changeset> changesets = null; int i = 0; foreach (Changeset chgset in changesets) { i++; if (user.IsMatch(chgset.Committer)) { if (callback.DoCallback((double)i / changesets.Count(), chgset.ChangesetId.ToString(), ref lstFoundFiles)) { return(lstFoundFiles); } if (comment.IsMatch(chgset.Comment)) { SCFile file = new SCFile(); file.ChangesetId = chgset.ChangesetId; file.Comment = chgset.Comment.ToString(); file.FilePath = chgset.Committer; SCFile.AddFileToList(file, lstFoundFiles); } } } return(lstFoundFiles); }
public List <SCFile> SearchForFileContent(List <SCFolder> fldLst, Wildcard fileNameFilter, SearchCondition search, bool bSearchInHistory, CancelCallbackNotify callback) { int i = 0; List <SCFile> lstFoundFiles = new List <SCFile>(); foreach (SCFolder fld in fldLst) { callback.DoCallback((double)i / fldLst.Count(), fld.FolderPath, ref lstFoundFiles); CancelCallbackNotify notify = new CancelCallbackNotify(); notify._delegate = callback._delegate; notify.start = callback.current; notify.range = callback.range / fldLst.Count; notify.isCanceled = callback.isCanceled; lstFoundFiles.AddRange(SearchForFileContent(fld, fileNameFilter, search, bSearchInHistory, notify)); i++; if (notify.isCanceled) { break; } } return(lstFoundFiles); }
public List <SCFile> SearchForFileContent(SCFolder fld, Wildcard fileNameFilter, SearchCondition search, bool bSearchInHistory, CancelCallbackNotify callback) { ItemSet items = scSrv.GetItems(fld.FolderPath, VersionSpec.Latest, RecursionType.OneLevel, DeletedState.Any, ItemType.Any); List <SCFile> lstFoundFiles = new List <SCFile>(); Regex t = new Regex(@"^(.*\.vb|.*\.xaml)$"); bool b = t.IsMatch("foo.vb"); int i = 0; foreach (Item itmLatest in items.Items) { if (callback.isCanceled) { break; } switch (itmLatest.ItemType) { case ItemType.File: i++; if (fileNameFilter.IsMatch(itmLatest.ServerItem)) { if (callback.DoCallback((double)i / items.Items.Count(), itmLatest.ServerItem, ref lstFoundFiles)) { return(lstFoundFiles); } else if (bSearchInHistory) { foreach (Changeset ch in scSrv.QueryHistory(itmLatest.ServerItem, VersionSpec.Latest, 0, RecursionType.Full, string.Empty, null, VersionSpec.Latest, int.MaxValue, true, true)) { Item myItm = scSrv.GetItem(itmLatest.ItemId, ch.ChangesetId); if (myItm != null) { FindInItem(search, ref lstFoundFiles, myItm); } } } else { FindInItem(search, ref lstFoundFiles, itmLatest); } } break; case ItemType.Folder: if (itmLatest.ServerItem != fld.FolderPath) { i++; if (callback.DoCallback((double)i / items.Items.Count(), itmLatest.ServerItem, ref lstFoundFiles)) { return(lstFoundFiles); } else { SCFolder child = new SCFolder { FolderPath = itmLatest.ServerItem }; CancelCallbackNotify subCallback = new CancelCallbackNotify(); subCallback._delegate = callback._delegate; subCallback.start = callback.current; subCallback.range = 1.0 / (items.Items.Count() - 1); lstFoundFiles.AddRange(SearchForFileContent(child, fileNameFilter, search, bSearchInHistory, subCallback)); } } break; } } callback.DoCallback(1, "Done searching " + fld.FolderPath, ref lstFoundFiles); return(lstFoundFiles); }