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); } }
public VideoTimePeriodsPacket GetCompletedTimePeriods() { IndexesPacket[] indexesPackets = FolderManager.GetIndexesPackets(_path); var downloadedTPPs = TimePeriodManager.GetIntersections(indexesPackets, GetVideoTimePeriods()?.TimePeriods); return(new VideoTimePeriodsPacket(_loadInfo.Info, downloadedTPPs)); }
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); }
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); } } }
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); } }