Пример #1
0
        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);
        }
Пример #2
0
 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);
         }
     }
 }
Пример #3
0
 public void UpdateNode(CctvNode node, bool isUnfoldVideo = true)
 {
     Node          = node;
     IsUnfoldVideo = isUnfoldVideo;
     updateOnlineStatus();
     updateVideo();
 }
Пример #4
0
 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();
 }
Пример #5
0
        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);
        }
Пример #6
0
 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);
         }
     }
 }
Пример #7
0
        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);
            }
        }
Пример #8
0
 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);
                 }
             }
         }
     }
 }
Пример #9
0
 private bool isValidVideoNode(CctvNode node)
 {
     return(node != null && node.Type == CctvNode.NodeType.Video && !string.IsNullOrEmpty(node.ID));
 }
Пример #10
0
 CctvNode getAllNodes()
 {
     return(CctvNode.DeepClone(VideoInfoManager.Instance.GetHierarchyRoot()));
 }