예제 #1
0
        private void btReadAll_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string data = null;
                tbData.Text = null;
                string path = tbPath.Text;
                if (!new DirectoryInfo(path).Exists)
                {
                    throw new InvalidDataException("无效的视频路径");
                }
                var packets = FolderManager.GetIndexesPackets(path);
                foreach (var packet in packets)
                {
                    writeLine(string.Format(packet.BeginTime.TimeOfDay + " - " + packet.EndTime.TimeOfDay + " " + packet.StartIndex), ref data);
                    var streams = FolderManager.GetVideoStreamsPacket(path, packet.BeginTime);

                    foreach (var stream in streams.VideoStreams)
                    {
                        writeLine($"{stream.Time.TimeOfDay}\t{stream.Buffer.Length}\t{BitConverter.ToString(stream.Buffer.Take(20).ToArray())}", ref data);
                    }
                }
                tbData.Text = data;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        public VideoTimePeriodsPacket GetCompletedTimePeriods()
        {
            IndexesPacket[] indexesPackets = FolderManager.GetIndexesPackets(_path);
            var             downloadedTPPs = TimePeriodManager.GetIntersections(indexesPackets, GetVideoTimePeriods()?.TimePeriods);

            return(new VideoTimePeriodsPacket(_loadInfo.Info, downloadedTPPs));
        }
예제 #3
0
        public void TestFolderManager_GetIndexesPackets()
        {
            string path     = "D:\\读写测试\\GetIndexesPackets";
            var    sPackets = DownloadRecorderTest.Recorder(path);
            var    packets  = FolderManager.GetIndexesPackets(path);

            Assert.AreEqual(1, packets.Length);
            Assert.AreEqual(50 + 8 + 4 + 8, packets[0].StartIndex);
            Assert.AreEqual(sPackets.First(_ => _.Type == DataType.StreamDataKey).Time, packets[0].BeginTime);
            Assert.AreEqual(sPackets.Last().Time.AddSeconds(1), packets[0].EndTime);
            FolderManager.DeleteDirectoryInfo(path);
        }
예제 #4
0
 private void loadRecorder()
 {
     if (_baseRec.TimePeriods != null)
     {
         try
         {
             IndexesPacket[] indexesPackets = FolderManager.GetIndexesPackets(Path);
             var             downloadedTPPs = TimePeriodManager.Combine(indexesPackets);
             initRecorder(_baseRec.TimePeriods.TimePeriods, downloadedTPPs);
         }
         catch (Exception ex) { Console.WriteLine(ex); }
     }
 }
예제 #5
0
 private void btOk_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string data = null;
         tbData.Text = null;
         string path = tbPath.Text;
         if (!new DirectoryInfo(path).Exists)
         {
             throw new InvalidDataException("无效的视频路径");
         }
         var packets = FolderManager.GetIndexesPackets(path);
         foreach (var packet in packets)
         {
             writeLine(string.Format(packet.BeginTime.TimeOfDay + " - " + packet.EndTime.TimeOfDay + " " + packet.StartIndex), ref data);
         }
         tbData.Text = data;
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show(ex.Message);
     }
 }