コード例 #1
0
        private void HandleBtnViewLogs()
        {
            if (!this.IsScreenValid())
            {
                return;
            }

            gbScreen.SetEnabled(false);
            List <X264LogFile> logFiles = new List <X264LogFile>();

            foreach (X264LogFile log in _bindingListLogFiles)
            {
                logFiles.Add(new X264LogFile()
                {
                    FileNameOnly = log.FileNameOnly, FilePath = log.FilePath
                });
            }
            IX264LogLineItemIdentifierService x264LogLineItemIdentifierService = new X264LogLineItemIdentifierService();
            X264LogFileSettings settings = new X264LogFileSettings()
            {
                BBCodeBoldLogFileName = chkBBCodeBoldLogFileName.Checked, BBCodeHiddenAroundLogs = chkBBCodeHidden.Checked
            };
            X264LogParserService parserService = new X264LogParserService(x264LogLineItemIdentifierService, settings, logFiles);

            bgwLogFiles.RunWorkerAsync(parserService);
        }
コード例 #2
0
        public void x264loglineitemidentifierservice_can_identify_encodedframes_lineitem_test()
        {
            //given a encoded frames line item
            string lineItem = "encoded 74525 frames, 2.48 fps, 5235.46 kb/s";
            //when i attempt to identify it
            IX264LogLineItemIdentifierService service      = new X264LogLineItemIdentifierService();
            EnumX264LogLineItemType           lineItemType = service.GetLineItemType(lineItem);

            //then line item type is encode frames
            lineItemType.Should().Be(EnumX264LogLineItemType.EncodedFrames);
        }
コード例 #3
0
        public void x264loglineitemidentifierservice_can_identify_consecutivebframes_lineitem_test()
        {
            //given a consecutive b frames line item
            string lineItem = "x264 [info]: consecutive B-frames:  1.1%  1.7%  5.0%  8.2% 17.7% 47.3% 11.8%  3.3%  3.8%";
            //when i attempt to identify it
            IX264LogLineItemIdentifierService service      = new X264LogLineItemIdentifierService();
            EnumX264LogLineItemType           lineItemType = service.GetLineItemType(lineItem);

            //then line item type is consecutive b frames
            lineItemType.Should().Be(EnumX264LogLineItemType.ConsecutiveBFrames);
        }
コード例 #4
0
        public void x264loglineitemidentifierservice_can_identify_bframe_lineitem_test()
        {
            //given a bframe line item
            string lineItem = "x264 [info]: frame B:59868 Avg QP:16.37  size: 19269";
            //when i attempt to identify it
            IX264LogLineItemIdentifierService service      = new X264LogLineItemIdentifierService();
            EnumX264LogLineItemType           lineItemType = service.GetLineItemType(lineItem);

            //then line item type is bframe
            lineItemType.Should().Be(EnumX264LogLineItemType.BFrame);
        }
コード例 #5
0
        public void x264loglineitemidentifierservice_can_identify_pframe_lineitem_test()
        {
            //given a pframe line item
            string lineItem = "x264 [info]: frame P:14240 Avg QP:14.42  size: 52055";
            //when i attempt to identify it
            IX264LogLineItemIdentifierService service      = new X264LogLineItemIdentifierService();
            EnumX264LogLineItemType           lineItemType = service.GetLineItemType(lineItem);

            //then line item type is pframe
            lineItemType.Should().Be(EnumX264LogLineItemType.PFrame);
        }
コード例 #6
0
        public void x264loglineitemidentifierservice_can_identify_iframe_lineitem_test()
        {
            //given a iframe line item
            string lineItem = "x264 [info]: frame I:417   Avg QP:12.56  size:134237";
            //when i attempt to identify it
            IX264LogLineItemIdentifierService service      = new X264LogLineItemIdentifierService();
            EnumX264LogLineItemType           lineItemType = service.GetLineItemType(lineItem);

            //then line item type is iframe
            lineItemType.Should().Be(EnumX264LogLineItemType.IFrame);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            //line item identifier service used to identify the line type read from log file
            IX264LogLineItemIdentifierService x264LogLineItemIdentifierService = new X264LogLineItemIdentifierService();

            //x264 log file settings
            X264LogFileSettings x264LogFileSerttings = new X264LogFileSettings()
            {
                BBCodeBoldLogFileName = true, BBCodeHiddenAroundLogs = true
            };

            //log files
            List <X264LogFile> logFiles = new List <X264LogFile>()
            {
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E01 The Child 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E01 The Child 720p BluRay DTS x264.mkv.x264.log"
                },
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E02 Milan 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E02 Milan 720p BluRay DTS x264.mkv.x264.log"
                },
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E03 Morgane 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E03 Morgane 720p BluRay DTS x264.mkv.x264.log"
                },
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E04 Virgil 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E04 Virgil 720p BluRay DTS x264.mkv.x264.log"
                },
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E05 Madame Costa 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E05 Madame Costa 720p BluRay DTS x264.mkv.x264.log"
                },
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E06 Esther 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E06 Esther 720p BluRay DTS x264.mkv.x264.log"
                },
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E07 Étienne 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E07 Étienne 720p BluRay DTS x264.mkv.x264.log"
                },
                new X264LogFile()
                {
                    FileNameOnly = "Les Revenants S02E08 Les Revenants 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E08 Les Revenants 720p BluRay DTS x264.mkv.x264.log"
                }
            };

            //parser service
            IX264LogParserService parserService = new X264LogParserService(x264LogLineItemIdentifierService, x264LogFileSerttings, logFiles);

            Stopwatch watch = new Stopwatch();

            watch.Start();

            //get log text
            string logs = parserService.GetLogs();

            if (parserService.Errors.Count() == 0)
            {
                System.Console.WriteLine(logs);
            }
            else
            {
                System.Console.WriteLine(parserService.Errors[0].Description);
            }
            watch.Stop();

            System.Console.WriteLine(string.Format("The process took {0} seconds", watch.Elapsed.TotalSeconds.ToString()));

            System.Console.ReadLine();
        }