コード例 #1
0
        private ProcessedLog ProcessLog(string logPath)
        {
            if (!File.Exists(logPath))
            {
                return(null);
            }

            ProcessedLog logData = new ProcessedLog();

            using (StreamReader reader = new StreamReader(logPath))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    // Video Track
                    if (line.Contains("mux: track 0"))
                    {
                        List <string> muxedTrack = GetResultRegex(@"track ([0-9.]*), ([0-9.]*) frames, ([0-9.]*) bytes, ([0-9.]*) kbps, fifo", line);

                        if (muxedTrack.Count >= 5 && decimal.TryParse(muxedTrack[4], out decimal averageBitrate))
                        {
                            logData.VideoAvgBitrate = averageBitrate;
                        }
                    }
                }
            }


            return(logData);
        }
コード例 #2
0
        public void Execute(object parameter)
        {
            if (!this.queueViewModel.QueueTasks.Any(s => s.Status == QueueItemStatus.Completed))
            {
                return;
            }

            StringBuilder content = this.CreateCsvHeader();

            foreach (QueueTask task in this.queueViewModel.QueueTasks)
            {
                if (task.Status == QueueItemStatus.Completed)
                {
                    ProcessedLog logdata = ProcessLog(task.Statistics.CompletedActivityLogPath);

                    content.AppendLine(
                        string.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                                      task.Task.Source,
                                      task.Task.Destination,
                                      task.Statistics.FinalFileSizeInMegaBytes,
                                      Math.Round(task.Statistics.EncodingSpeed, 2),
                                      logdata.VideoAvgBitrate,
                                      task.Task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality ? task.Task.Quality : task.Task.VideoBitrate));
                }
            }

            // Output the File
            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                Filter          = "csv|*.csv",
                CheckPathExists = true,
                AddExtension    = true,
                DefaultExt      = ".csv",
            };

            bool?result = saveFileDialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                using (StreamWriter writer = new StreamWriter(saveFileDialog.FileName))
                {
                    writer.WriteLine(content.ToString());
                }
            }

            this.errorService.ShowMessageBox(
                Resources.Debug_QueueExportDataDone,
                Resources.Notice,
                MessageBoxButton.OK,
                MessageBoxImage.Information);
        }