Пример #1
0
        public VideoTimePeriodsPacket Search(DateTime beginTime, DateTime endTime, IVideoInfo videoInfo)
        {
            string path = GlobalData.VideoPath(videoInfo.VideoId, videoInfo.StreamId);

            DateTime[] dates            = VideoStoragerManager.GetFolderPaths(videoInfo.VideoId, videoInfo.StreamId, beginTime, endTime);
            List <TimePeriodPacket> tis = new List <TimePeriodPacket>();

            Parallel.ForEach(dates, date =>
            {
                string folder = Path.Combine(path, GlobalProcess.FolderPath(date));
                var array     = FolderManager.GetTimePeriods(folder);
                if (array.Length > 0)
                {
                    lock (tis)
                        tis.AddRange(array);
                }
            });
            if (endTime > DateTime.Now.Date)
            {
                tis.AddRange(findTodayLastest(path, endTime));
            }
            var timeCombines = TimePeriodManager.Combine(tis.ToArray());
            var validArray   = TimePeriodManager.GetIntersections(timeCombines, new TimePeriodPacket(beginTime, endTime));

            return(new VideoTimePeriodsPacket(videoInfo, validArray));
        }