private CctvNode getBackToPrev(CctvNode cctvNode, string id) { if (cctvNode == null) { return(null); } if (cctvNode.ID == id) { return(null); } var result = cctvNode.Children?.FirstOrDefault(e => e.ID == id); if (result != null) { return(cctvNode); } foreach (var child in cctvNode.Children) { var node = getBackToPrev(child, id); if (node != null) { return(node); } } return(null); }
private static void updateSearch(CctvNode cctvNode, List <string> searchInfo, List <CctvNode> result, string nodeName = "") { if (cctvNode == null) { return; } if (isSearched(cctvNode.Name, searchInfo)) { var clone = CctvNode.ToDeepClone(cctvNode); if (clone.Type == CctvNode.NodeType.Video && !string.IsNullOrWhiteSpace(nodeName)) { clone.Name = string.Format("{0}-{1}", nodeName, clone.Name); } result.Add(clone); if (cctvNode.Children.Any(_ => _.Type == CctvNode.NodeType.Video))// { return; } } if (cctvNode.Children.Length > 0) { for (int i = 0; i < cctvNode.Children.Length; i++) { updateSearch(cctvNode.Children[i], searchInfo, result, cctvNode.Name); } } }
public void UpdateNode(CctvNode node, bool isUnfoldVideo = true) { Node = node; IsUnfoldVideo = isUnfoldVideo; updateOnlineStatus(); updateVideo(); }
public void Update(CctvNode node, bool showThumbnails = false) { removeOldSource(); if (node.IsCctvNode()) { Node = node; NodeVisible = true; if (Node != null && !string.IsNullOrEmpty(Node.ID)) { var onlineStatus = VideoInfoManager.Instance.GetOnlineStatus(Node.ID); if (onlineStatus != null && onlineStatus.Online) { IsOnline = true; } else { IsOnline = false; } } ControlVisible = (Node.ID != getAllNodes()?.ID); updateNewSource(Node?.Children.ToList(), false); } else { NodeVisible = false; updateNewSource(new List <CctvNode>() { node }, showThumbnails); } updateDisplayVideos(); RefreshVideoDataSummary(); }
public static List <CctvNode> Search(CctvNode cctvNode, string info) { List <CctvNode> result = new List <CctvNode>(); List <string> searchInfo = info.ToLower().Split(separator, StringSplitOptions.RemoveEmptyEntries).ToList(); updateSearch(cctvNode, searchInfo, result); return(result); }
private void updateVideoIds(List <string> ids, CctvNode node) { if (node == null) { return; } if (node.Type == CctvNode.NodeType.Video) { ids.Add(node.ID); } else { foreach (var child in node.Children) { updateVideoIds(ids, child); } } }
private void search(string searchInfo) { CctvNode node = getAllNodes(); List <CctvNode> searched = null; if (node != null && searchInfo == _searchInfo) { searched = string.IsNullOrWhiteSpace(searchInfo) ? new List <CctvNode>() { node } } : VideoSearcher.Search(node, searchInfo); if (searchInfo == _searchInfo) { updateSearch(_searchInfo, searched); } }
private void FindAllVideo(CctvNode node, List <string> ids) { if (node != null) { if (node.Type == CctvNode.NodeType.Video) { ids.Add(node.ID); } else { if (node.Children != null) { foreach (CctvNode child in node.Children) { FindAllVideo(child, ids); } } } } }
private bool isValidVideoNode(CctvNode node) { return(node != null && node.Type == CctvNode.NodeType.Video && !string.IsNullOrEmpty(node.ID)); }
CctvNode getAllNodes() { return(CctvNode.DeepClone(VideoInfoManager.Instance.GetHierarchyRoot())); }