private TreeViewItem updateNode(VideoParser.Node node) { TreeViewItem item = new TreeViewItem(); item.Header = node.Name; item.Tag = node; item.IsExpanded = true; VideoParser.Server server = node as CCTVClient.VideoParser.Server; if (server != null) { foreach (VideoParser.Node child in server.Childs) { item.Items.Add(updateNode(child)); } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { foreach (VideoParser.Video child in front.Childs) { item.Items.Add(getVideoNode(child, front.Online)); } } } return(item); }
private void getOnlineStatus(Dictionary <string, OnlineStatus> onlineDict, VideoParser.Node node) { string nodeId = getNodeId(node.Id); onlineDict[nodeId] = new OnlineStatus() { NodeId = nodeId, Online = node.Online }; VideoParser.Server server = node as VideoParser.Server; if (server != null) { if (server.Childs != null) { foreach (VideoParser.Node child in server.Childs) { getOnlineStatus(onlineDict, child); } } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { if (front.Childs != null) { foreach (VideoParser.Video child in front.Childs) { getOnlineStatus(onlineDict, child); } } } } }
private void classifyInfo(VideoParser.Node node, string serverId) { //在线标识。 var nodeId = getNodeId(node.Id); _onlineStatus[nodeId] = new CCTVOnlineStatus() { VideoId = nodeId, Online = node.Online }; VideoParser.Server server = node as VideoParser.Server; if (server != null) { CCTVServerInfo si = new CCTVServerInfo() { ServerId = getNodeId(node.Id), Name = node.Name, InfoServiceIp = node.Host, InfoServicePort = 27010, StreamServerIp = node.Host, StreamServerPort = 37010, ControlServerIp = node.Host, ControlServerPort = 47010 }; _servers[si.ServerId] = si; if (server.Childs != null) { foreach (VideoParser.Node child in server.Childs) { classifyInfo(child, si.ServerId); } } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { if (front.Childs != null) { int channel = 1; foreach (VideoParser.Video child in front.Childs) { classifyInfo(front, child, channel, serverId); if (front.Type == 1 || front.Type == 11) { channel += 4; } else { channel++; } } } } } }
private static void collectVideoId(HashSet <ulong> videoIdSet, VideoParser.Node node) { VideoParser.Server server = node as VideoParser.Server; if (server != null) { foreach (VideoParser.Node child in server.Childs) { collectVideoId(videoIdSet, child); } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { foreach (VideoParser.Video video in front.Childs) { videoIdSet.Add(video.Id); } } } }
public void AddTrackVideo(VideoParser.Node node) { VideoParser.Server server = node as VideoParser.Server; if (server != null) { foreach (VideoParser.Node child in server.Childs) { AddTrackVideo(child); } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { foreach (VideoParser.Video child in front.Childs) { addTrackVideo(child); } } } }
private void getHierarchyInfo(string parentId, VideoParser.Node node) { string nodeId = getNodeId(node.Id); _dictHier[nodeId] = new CCTVHierarchyInfo() { Id = nodeId, Name = node.Name, Type = getNodeType(node), ParentId = parentId, ElementId = nodeId }; VideoParser.Server server = node as VideoParser.Server; if (server != null) { if (server.Childs != null) { foreach (VideoParser.Node child in server.Childs) { getHierarchyInfo(nodeId, child); } } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { if (front.Childs != null) { foreach (VideoParser.Video child in front.Childs) { getHierarchyInfo(nodeId, child); } } } } }
private void getHierarchyInfo(Dictionary <string, HierarchyInfo> hierarchyDict, string parentId, VideoParser.Node node) { string nodeId = getNodeId(node.Id); hierarchyDict[nodeId] = new HierarchyInfo() { NodeId = nodeId, Name = node.Name, Type = getNodeType(node), ParentId = parentId, }; VideoParser.Server server = node as VideoParser.Server; if (server != null) { if (server.Childs != null) { foreach (VideoParser.Node child in server.Childs) { getHierarchyInfo(hierarchyDict, nodeId, child); } } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { if (front.Childs != null) { foreach (VideoParser.Video child in front.Childs) { getHierarchyInfo(hierarchyDict, nodeId, child); } } } } }
private void getStaticInfo(Dictionary <string, CCTVStaticInfo> staticDict, VideoParser.Node node) { VideoParser.Server server = node as VideoParser.Server; if (server != null) { if (server.Childs != null) { foreach (VideoParser.Node child in server.Childs) { getStaticInfo(staticDict, child); } } } else { VideoParser.Front front = node as VideoParser.Front; if (front != null) { if (front.Childs != null) { int channel = 1; foreach (VideoParser.Video child in front.Childs) { getStaticInfo(staticDict, front, child, channel); if (front.Type == 1 || front.Type == 11) { channel += 4; } else { channel++; } } } } } }