public static byte[] Encode(LocalVideosInfoPacket packet) { using (MemoryStream ms = new MemoryStream()) { PacketBase.WriteBytes(ms, TimePeriodPacket.Encode(packet.TimePeriod)); PacketBase.WriteBytes(ms, packet.ValidTimePeriods.Length); for (int i = 0; i < packet.ValidTimePeriods.Length; i++) { PacketBase.WriteBytes(ms, VideoTimePeriodsPacket.Encode(packet.ValidTimePeriods[i])); } return(ms.ToArray()); } }
private void proxy_TreeNodesReceived(CenterStorageCmd.LocalVideosInfoPacket obj) { _root = new CCTVHierarchyNode() { Id = "ServerID", Name = "本地视频", Type = NodeType.Server, Children = obj.ValidTimePeriods.Select(x => new CCTVHierarchyNode() { Id = x.VideoId, Name = x.VideoName, Type = NodeType.Video }).ToArray() }; onNodeUpdated(obj); }