/// <summary> /// Iterates a directory object and prefixes any folder items with "[+] " /// </summary> /// <param name="directory"></param> /// <returns></returns> List <DirectoryItem> PrefixDirectoryFolderItems(CodecDirectory directory) { var tempDirectoryList = new List <DirectoryItem>(); if (directory.CurrentDirectoryResults.Count > 0) { foreach (var item in directory.CurrentDirectoryResults) { if (item is DirectoryFolder) { var newFolder = new DirectoryFolder(); newFolder = (DirectoryFolder)item.Clone(); string prefixName = "[+] " + newFolder.Name; newFolder.Name = prefixName; tempDirectoryList.Add(newFolder); } else { tempDirectoryList.Add(item); } } } //else //{ // DirectoryItem noResults = new DirectoryItem() { Name = "No Results Found" }; // tempDirectoryList.Add(noResults); //} return(tempDirectoryList); }
public void OnDirectoryResultReturned(CodecDirectory result) { CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); var handler = DirectoryResultReturned; if (handler != null) { handler(this, new DirectoryEventArgs() { Directory = result, DirectoryIsOnRoot = !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue }); } }
public void SearchDirectory(string searchString) { var searchResults = new CodecDirectory(); searchResults.ResultsFolderId = "searchResult"; // Search mock directory for contacts that contain the search string, ignoring case List <DirectoryItem> matches = MockVideoCodecDirectory.CompleteDirectory.CurrentDirectoryResults.FindAll( s => s is DirectoryContact && s.Name.ToLower().Contains(searchString.ToLower())); if (matches != null) { searchResults.AddContactsToDirectory(matches); DirectoryBrowseHistory.Add(searchResults); } OnDirectoryResultReturned(searchResults); }
/// <summary> /// Posts the current directory /// </summary> void SendDirectory(CodecDirectory directory, bool isRoot) { var dirCodec = Codec as IHasDirectory; if (dirCodec != null) { var prefixedDirectoryResults = PrefixDirectoryFolderItems(directory); var directoryMessage = new { currentDirectory = new { directoryResults = prefixedDirectoryResults, isRootDirectory = isRoot } }; PostStatusMessage(directoryMessage); } }
public void GetDirectoryParentFolderContents() { var currentDirectory = new CodecDirectory(); if (DirectoryBrowseHistory.Count > 0) { var lastItemIndex = DirectoryBrowseHistory.Count - 1; var parentDirectoryContents = DirectoryBrowseHistory[lastItemIndex]; DirectoryBrowseHistory.Remove(DirectoryBrowseHistory[lastItemIndex]); currentDirectory = parentDirectoryContents; } else { currentDirectory = DirectoryRoot; } OnDirectoryResultReturned(currentDirectory); }
public void GetDirectoryFolderContents(string folderId) { var folderDirectory = new CodecDirectory(); if (folderId == MockVideoCodecDirectory.eFolderId.UnitedStates.ToString()) { folderDirectory = MockVideoCodecDirectory.UnitedStatesFolderContents; } else if (folderId == MockVideoCodecDirectory.eFolderId.Canada.ToString()) { folderDirectory = MockVideoCodecDirectory.CanadaFolderContents; } else if (folderId == MockVideoCodecDirectory.eFolderId.NewYork.ToString()) { folderDirectory = MockVideoCodecDirectory.NewYorkFolderContents; } else if (folderId == MockVideoCodecDirectory.eFolderId.Boston.ToString()) { folderDirectory = MockVideoCodecDirectory.BostonFolderContents; } else if (folderId == MockVideoCodecDirectory.eFolderId.SanFrancisco.ToString()) { folderDirectory = MockVideoCodecDirectory.SanFranciscoFolderContents; } else if (folderId == MockVideoCodecDirectory.eFolderId.Denver.ToString()) { folderDirectory = MockVideoCodecDirectory.DenverFolderContents; } else if (folderId == MockVideoCodecDirectory.eFolderId.Austin.ToString()) { folderDirectory = MockVideoCodecDirectory.AustinFolderContents; } else if (folderId == MockVideoCodecDirectory.eFolderId.Calgary.ToString()) { folderDirectory = MockVideoCodecDirectory.CalgaryFolderContents; } DirectoryBrowseHistory.Add(folderDirectory); OnDirectoryResultReturned(folderDirectory); }