// Token: 0x06002D78 RID: 11640 RVA: 0x000FFCB0 File Offset: 0x000FDEB0 private void BindToFolder() { if (this.folder == null) { OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("fId"); if (owaStoreObjectId == null) { owaStoreObjectId = (OwaStoreObjectId)this.ListViewState.SourceContainerId; } this.folder = Utilities.GetFolder <Folder>(base.UserContext, owaStoreObjectId, new PropertyDefinition[] { FolderSchema.ItemCount, FolderSchema.ExtendedFolderFlags, ViewStateProperties.ViewFilter, ViewStateProperties.SortColumn }); if (base.IsParameterSet("srchf") && (base.UserContext.IsInMyMailbox(this.folder) || Utilities.IsInArchiveMailbox(this.folder))) { FolderVirtualListViewSearchFilter folderVirtualListViewSearchFilter = (FolderVirtualListViewSearchFilter)base.GetParameter("srchf"); if (folderVirtualListViewSearchFilter.SearchString != null && 256 < folderVirtualListViewSearchFilter.SearchString.Length) { throw new OwaInvalidRequestException("Search string is longer than maximum length of " + 256); } FolderSearch folderSearch = new FolderSearch(); string searchString = folderVirtualListViewSearchFilter.SearchString; this.searchFolder = folderSearch.Execute(base.UserContext, this.folder, folderVirtualListViewSearchFilter.Scope, searchString, folderVirtualListViewSearchFilter.ReExecuteSearch, folderVirtualListViewSearchFilter.IsAsyncSearchEnabled); } } }
private string ResolveBinariesDirectory() { var binariesFolder = FolderSearch.CurrentExecutingDirectory().FindFolderUpwards(Path.Combine(_nugetPrefix, _searchPattern)) ?? FolderSearch.CurrentExecutingDirectory().FindFolderUpwards(_searchPattern); if (binariesFolder == null) { throw new PostgresBinariesNotFoundException($"Could not find Postgres binaries using the search pattern of {_searchPattern}. The Searching began in {FolderSearch.CurrentExecutingDirectory()}"); } return(binariesFolder); }
public void RunIndexingOnSingleFolder(FolderSearch dir) { Task.Run(() => { try { if (IndexingIsRunning) { return; } IndexingIsRunning = true; var unorderedFiles = new HashSet <RunItem>(); LastIndexed = DateTime.Now; var tempBag = new HashSet <RunItem>(); ProcessDirectory(dir, tempBag); dir.NrOfFiles = tempBag.Count; foreach (var item in tempBag) { unorderedFiles.Add(item); } RunItem[] tempList = unorderedFiles.ToArray(); tempList = tempList.GroupBy(p => p.URI + p.Arguments + p.Command).Select(p => p.First()).ToArray(); for (int i = 0; i < tempList.Length; i++) { Progress = i / tempList.Length * 100; MatcherGeneral.Insert(tempList[i].Name.ToLower(), tempList[i]); //if (!string.IsNullOrEmpty(tempList[i].Group)) // TempMatcher.Insert(tempList[i].Group.ToLower(), tempList[i]); } NrOfPaths = MatcherGeneral.DataDictionary.Count + MatcherPrio.DataDictionary.Count; SaveTries(); IndexingIsRunning = false; } catch (Exception e) { Log.Error(e, $"Could not search folder {dir.Path}"); } }); }
public void CreateListView() { if (this.searchLocation == AddressBook.SearchLocation.AddressBook) { this.listView = new AddressBookListView(this.searchString, base.UserContext, ColumnId.DisplayNameAD, SortOrder.Ascending, this.addressBookBase, AddressBookBase.RecipientCategory.All); } else { FolderSearch folderSearch = new FolderSearch(); SearchScope searchScope = base.UserContext.MailboxSession.Mailbox.IsContentIndexingEnabled ? SearchScope.SelectedAndSubfolders : SearchScope.SelectedFolder; this.searchFolder = folderSearch.Execute(base.UserContext, this.folder, searchScope, this.searchString, this.isNewSearch, false); object obj = this.searchFolder.TryGetProperty(FolderSchema.ItemCount); if (!(obj is PropertyError)) { this.itemCount = (int)obj; } this.listView = new ContactsListView(base.UserContext, this.sortColumn, this.sortOrder, this.searchFolder, searchScope); } this.listView.Initialize(this.firstItemOnPage, this.lastItemOnPage); if (!string.IsNullOrEmpty(this.searchString)) { SanitizedHtmlString sanitizedHtmlString = new SanitizedHtmlString("<a href=\"#\" onclick=\"return onClkClrLnk();\">" + LocalizedStrings.GetHtmlEncoded(1155007962) + "</a>"); sanitizedHtmlString.DecreeToBeTrusted(); SanitizedHtmlString messageHtml; if (this.listView.TotalCount == 0) { messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-761327948), new object[] { sanitizedHtmlString }); } else if (this.searchLocation == AddressBook.SearchLocation.AddressBook) { if (this.addressBookBase.Base64Guid == base.UserContext.GlobalAddressListInfo.ToAddressBookBase().Base64Guid) { messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-121508646), new object[] { this.listView.TotalCount, this.searchString, sanitizedHtmlString }); } else { messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1725472335), new object[] { this.listView.TotalCount, this.searchString, this.addressBookBase.DisplayName, sanitizedHtmlString }); } } else { messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1403744948), new object[] { this.listView.TotalCount, this.searchString, sanitizedHtmlString }); } base.Infobar.AddMessageHtml(messageHtml, InfobarMessageType.Informational); } }
public static ItemOperations.Result GetNextViewItem(UserContext userContext, ItemOperations.Action action, StoreObjectId itemId, StoreObjectId folderId) { Folder folder = null; ItemOperations.Result result; try { MessageModuleSearchViewState messageModuleSearchViewState = userContext.LastClientViewState as MessageModuleSearchViewState; SortBy[] sortOrder; if (messageModuleSearchViewState != null) { using (Folder folder2 = Folder.Bind(userContext.MailboxSession, messageModuleSearchViewState.FolderId)) { sortOrder = ItemOperations.GetSortOrder(userContext, folder2); FolderSearch folderSearch = new FolderSearch(); folder = folderSearch.Execute(userContext, folder2, messageModuleSearchViewState.SearchScope, messageModuleSearchViewState.SearchString, userContext.ForceNewSearch, false); userContext.ForceNewSearch = false; goto IL_77; } } folder = Folder.Bind(userContext.MailboxSession, folderId); sortOrder = ItemOperations.GetSortOrder(userContext, folder); IL_77: using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, sortOrder, new PropertyDefinition[] { ItemSchema.Id })) { queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.Id, itemId)); int num = queryResult.CurrentRow; int num2 = queryResult.EstimatedRowCount; int num3 = 0; if (num == num2 || num2 == 1) { result = null; } else { switch (action) { case ItemOperations.Action.Next: if (num + 1 == num2) { return(null); } num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1); break; case ItemOperations.Action.Prev: if (num == 0) { return(null); } num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1); break; case ItemOperations.Action.Delete: if (userContext.UserOptions.NextSelection == NextSelectionDirection.Previous) { if (num == 0) { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1); num3 = 0; } else { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1); } } else if (userContext.UserOptions.NextSelection == NextSelectionDirection.Next) { if (num2 - (num + 1) == 0) { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1); } else { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1); num3 = 0; } } else if (userContext.UserOptions.NextSelection == NextSelectionDirection.ReturnToView) { return(null); } num2--; break; } num += num3; if (messageModuleSearchViewState != null) { messageModuleSearchViewState.PageNumber = num / userContext.UserOptions.BasicViewRowCount + 1; } else { ListViewViewState listViewViewState = userContext.LastClientViewState as ListViewViewState; if (listViewViewState != null && folderId.Equals(listViewViewState.FolderId)) { listViewViewState.PageNumber = num / userContext.UserOptions.BasicViewRowCount + 1; } } object[][] rows = queryResult.GetRows(1); result = new ItemOperations.Result(((VersionedId)rows[0][0]).ObjectId, folderId); } } } catch (ObjectNotFoundException) { result = null; } finally { if (folder != null) { folder.Dispose(); } } return(result); }
public void ProcessDirectory(FolderSearch dir, HashSet <RunItem> theBag) { try { if (Directory.Exists(dir.Path)) { if (dir.IncludeFoldersInSearch) { var folder = new RunItem() { Name = new DirectoryInfo(dir.Path).Name, URI = new StringBuilder(dir.Path).Replace("/", "\\").Replace("//", "\\").ToString(), Type = ItemType.Directory }; theBag.Add(folder); } } else { Log.Error($"{dir.Path} does not exist..."); return; } //ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Product"); //foreach (ManagementObject mgmtObjectin in searcher.Get()) //{ // Console.WriteLine(mgmtObjectin["Name"]); // Console.WriteLine(mgmtObjectin.Path); //} //var t = theBag.ContainsKey(dir.URI); // Process the list of files found in the directory. string[] fileEntries = Directory.GetFiles(dir.Path, dir.SearchPattern); foreach (string fileName in fileEntries) { try { if (Path.GetExtension(fileName) == ".lnk") { Directory.CreateDirectory(Common.LinksPath); File.Copy(fileName, Common.LinksPath + Path.GetFileName(fileName), true); var item = new RunItem(); item.Type = ItemType.Link; item.Command = Common.LinksPath + Path.GetFileName(fileName); WshShell shell = new WshShell(); //Create a new WshShell Interface IWshShortcut link = (IWshShortcut)shell.CreateShortcut(item.Command); //Link the interface to our shortcut var uri = link.TargetPath; item.URI = uri; item.Arguments = link.Arguments; //var t = link.FullName; //var t2 = link.Description; //var t3 = link.WorkingDirectory; //var t4 = link.FullName; var split = link.IconLocation.Split(','); var iconName = split[0]; item.IconNr = Convert.ToInt32(split[1]); if (File.Exists(iconName)) { try { Stream iconStream = new FileStream(iconName, FileMode.Open, FileAccess.Read); IconBitmapDecoder decoder = new IconBitmapDecoder(iconStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None); BitmapFrame frame = decoder.Frames[item.IconNr]; item.IconName = iconName; } catch { if (S.Settings.DebugMode) { Log.Error($"Could not add icon for {iconName} nr: {item.IconNr}"); } } } item.Name = Path.GetFileNameWithoutExtension(item.Command).Replace(" - Shortcut", ""); //get the name of the icon and removing the shortcut ending that sometimes are there, because nice-ness if (uri != "") { item.KeyWords.Add(Path.GetFileName(uri)); } theBag.Add(item); } else { var item = new RunItem { Type = ItemType.File, URI = new StringBuilder(fileName).Replace("/", "\\").Replace("//", "\\").ToString() }; item.Name = item.FileName; theBag.Add(item); } } catch (Exception e) { if (S.Settings.DebugMode) { Log.Error(e, $"Could not index {fileName}"); } } } } catch (Exception) { if (S.Settings.DebugMode) { Log.Debug($"Could not search {dir.Path}"); } } if (dir.SearchSubFolders) { try { // Recurse into subdirectories of this directory. string[] subdirectoryEntries = Directory.GetDirectories(dir.Path); foreach (string subdirectory in subdirectoryEntries) { try { ProcessDirectory( new FolderSearch() { Path = subdirectory, IncludeFoldersInSearch = dir.IncludeFoldersInSearch, SearchPattern = dir.SearchPattern, SearchSubFolders = dir.SearchSubFolders }, theBag); } catch (Exception e) { Log.Debug(e.Message); } } } catch (Exception e) { Log.Error(e.Message); } } }