/// <summary> /// Processes files to create File Objects for the main tasks of this program. /// Every tasks are denoted on each comment lines inside the method. /// </summary> /// <param name="list">The list that contains the fullpaths of the actual files.</param> /// <param name="listname">Name for the FileObjectCollection to be created.</param> public void AnalyzeList(List <string> list, string listname = "Various Files") { FileObjectCollection fileList = new FileObjectCollection(); TrackLister tracklist = new TrackLister(); MakeFile makeFile = new MakeFile(); ChapterGenerator chapterGet = new ChapterGenerator(); //ProgressState progressState = new ProgressState(); //fileList.folderPath = path; //Deprecated fileList.name = listname; //Deprecated progressState.listName = fileList.name; analyzeProgress = 1; analyzeProcessPercent = 0; foreach (string s in list) { FileObject file = new FileObject(s); analyzeProcessPercent = analyzeProgress.ToPercentage(list.Count); progressState.progressPercent = analyzeProcessPercent; progressState.fileName = file.filename; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); //Routine after splitting //Checks if current backgroundWorker operation is cancelled //Stops this program if true if (Analyze.backgroundWorker.CancellationPending) { return; } try { file = InfoDumper.infoDump(file); if (Program.hasFFmpeg) { file = InfoDumper.ffInfoDump(file); } } catch (Exception ex) { MessageBox.Show("Error:\r\n\r\n" + ex.Message, "Error"); } progressState.progressDetail = "Dumping MKV info..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); file = chapterGet.chapterDump(file); if (!String.IsNullOrEmpty(file.ffInfo)) { file = chapterGet.mediaDump(file); } if (!Config.Configure.includeMkvInfoOnFiles) { file.mkvInfo = null; } if (!Config.Configure.includeMediaInfoOnFiles) { file.ffInfo = null; } fileList.addFile(file); //For Diagnoses purposes only if (Config.Configure.diagnose >= 30) { Console.WriteLine("Chapter Atom count: {0}\n", file.chapterAtom.Count, file.mkvInfo); foreach (ChapterAtom chapter in file.chapterAtom) { { Console.WriteLine("File name: {0}\nChapter Number: {2}\nTime Start: {3}\nTime End: {4}\nSuid: {5}\n", file.filename, chapter.chapterInfo, chapter.chapterNum, chapter.timeStart, chapter.timeEnd, chapter.suid); } } } progressState.progressDetail = "Getting chapters' info..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); analyzeProgress++; } SuidLister suidList = getSuid(fileList); progressState.progressDetail = "Creating SUID list..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); fileList = tracklist.arrangeTrack(fileList, suidList, this); progressState.progressDetail = "Arranging new tracklist for every file..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); //For Diagnostic purposes only if (Config.Configure.diagnose >= 30) { foreach (Suid suid in suidList.suidList) { { Console.WriteLine("SUID filename: " + suid.fileName); Console.WriteLine("SUID: " + suid.suid); Console.WriteLine("\n"); } } Console.WriteLine("fileList.fileList.Count: " + fileList.fileList.Count + "\n"); foreach (FileObject file in fileList.fileList) { //Console.WriteLine("Merge Argument count: {0}\n", file.mergeArgument.Count); foreach (MergeArgument merge in file.mergeArgument) { Console.WriteLine("Merge Argument:\nFile name: {0}\nTime Code: {1}\nFile Argument: {2}\nChapter Number: {3}\n", file.filename, merge.timeCode, merge.fileName, merge.chapterNum); } foreach (TimeCode time in file.timeCode) { Console.WriteLine("Time Code Argument: {0}\n", time.timeCode); } foreach (DelArgument del in file.delArgument) { Console.WriteLine("Del Argument: {0}\n", del.fileName); } } } fileLists.Add(fileList); if (Config.Configure.doMakeXml) { makeFile.makeFile(fileList, this); progressState.progressDetail = "Dumping XML file..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); } if (Config.Configure.doMakeScript) { makeFile.makeXML(fileList, this); progressState.progressDetail = "Creating Merge Script..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); } }
/// <summary> /// Processes files to create File Objects for the main tasks of this program. /// Every tasks are denoted on each comment lines inside the method. /// </summary> /// <param name="list">The list that contains the fullpaths of the actual files.</param> /// <param name="listname">Name for the FileObjectCollection to be created.</param> /// <param name="processor">The Analyze object for progression report.</param> /// <param name="path">The path used as a working directory merge commands.</param> /// <param name="totalArguments">Optional. For progress report. The total number of lists to process.</param> public void processList(List<string> list, string listname, Analyze processor, string path = "C:\\", int totalArguments = 0) { FileObjectCollection fileList = new FileObjectCollection(); TrackLister tracklist = new TrackLister(); MakeFile makeFile = new MakeFile(); ChapterGenerator chapterGet = new ChapterGenerator(); ProgressState progressState = new ProgressState(); fileList.folderPath = path; fileList.name = listname; progressState.listName = fileList.name; progress = 1; processPercent = 0; foreach (string s in list) { progressState.progressDetail = "Creating file entry..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); FileObject file = new FileObject(s); processPercent = progress.ToPercentage(list.Count); progressState.progressPercent = processPercent; progressState.fileName = file.filename; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); //Routine after splitting //Checks if current backgroundWorker operation is cancelled //Stops this program if true if (Analyze.backgroundWorker.CancellationPending) { return; } if (file.extension == ".mkv") { try { file = InfoDumper.infoDump(file); } catch (Exception ex) { Program.Message("Error:\r\n\r\n" + ex.Message, "Error"); } progressState.progressDetail = "Dumping MKV info..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); file = chapterGet.chapterDump(file); if (!Config.Configure.includeMkvInfoOnFiles) file.mkvInfo = null; if (!Config.Configure.includeMediaInfoOnFiles) file.ffInfo = null; progressState.progressDetail = "Getting chapters' info..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); fileList.hasMKV = true; } if (Program.hasFFmpeg) { progressState.progressDetail = "Dumping media info..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); try { file = InfoDumper.ffInfoDump(file); } catch (Exception ex) { Program.Message("Error:\r\n\r\n" + ex.Message, "Error"); } if (!String.IsNullOrEmpty(file.ffInfo)) file = chapterGet.mediaDump(file); } fileList.addFile(file); progress++; } if (fileList.hasMKV) { SuidLister suidList = CreateSuidLister(fileList); progressState.progressDetail = "Creating SUID list..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); fileList = tracklist.arrangeTrack(fileList, suidList, processor); progressState.progressDetail = "Arranging new tracklist for every file..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); //For Diagnostic purposes only if (Config.Configure.diagnose >= 30) { foreach (Suid suid in suidList.suidList) { { Console.WriteLine("SUID filename: " + suid.fileName); Console.WriteLine("SUID: " + suid.suid); Console.WriteLine("\n"); } } Console.WriteLine("fileList.fileList.Count: " + fileList.fileList.Count + "\n"); foreach (FileObject file in fileList.fileList) { //Console.WriteLine("Merge Argument count: {0}\n", file.mergeArgument.Count); foreach (MergeArgument merge in file.mergeArgument) { Console.WriteLine("Merge Argument:\nFile name: {0}\nTime Code: {1}\nFile Argument: {2}\nChapter Number: {3}\n", file.filename, merge.timeCode, merge.fileName, merge.chapterNum); } foreach (TimeCode time in file.timeCode) { Console.WriteLine("Time Code Argument: {0}\n", time.timeCode); } foreach (DelArgument del in file.delArgument) { Console.WriteLine("Del Argument: {0}\n", del.fileName); } } } if (Config.Configure.doMakeScript) { makeFile.makeFile(fileList, processor); progressState.progressDetail = "Creating Merge Script..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); } } if (Config.Configure.doMakeXml) { makeFile.makeXML(fileList, processor); progressState.progressDetail = "Dumping XML file..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); } processor.fileLists.Add(fileList); }
/// <summary> /// Processes files to create File Objects for the main tasks of this program. /// Every tasks are denoted on each comment lines inside the method. /// </summary> /// <param name="list">The list that contains the fullpaths of the actual files.</param> /// <param name="listname">Name for the FileObjectCollection to be created.</param> public void AnalyzeList(List<string> list, string listname = "Various Files") { FileObjectCollection fileList = new FileObjectCollection(); TrackLister tracklist = new TrackLister(); MakeFile makeFile = new MakeFile(); ChapterGenerator chapterGet = new ChapterGenerator(); //ProgressState progressState = new ProgressState(); //fileList.folderPath = path; //Deprecated fileList.name = listname; //Deprecated progressState.listName = fileList.name; analyzeProgress = 1; analyzeProcessPercent = 0; foreach (string s in list) { FileObject file = new FileObject(s); analyzeProcessPercent = analyzeProgress.ToPercentage(list.Count); progressState.progressPercent = analyzeProcessPercent; progressState.fileName = file.filename; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); //Routine after splitting //Checks if current backgroundWorker operation is cancelled //Stops this program if true if (Analyze.backgroundWorker.CancellationPending) { return; } try { file = InfoDumper.infoDump(file); if (Program.hasFFmpeg) file = InfoDumper.ffInfoDump(file); } catch (Exception ex) { MessageBox.Show("Error:\r\n\r\n" + ex.Message, "Error"); } progressState.progressDetail = "Dumping MKV info..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); file = chapterGet.chapterDump(file); if (!String.IsNullOrEmpty(file.ffInfo)) file = chapterGet.mediaDump(file); if (!Config.Configure.includeMkvInfoOnFiles) file.mkvInfo = null; if (!Config.Configure.includeMediaInfoOnFiles) file.ffInfo = null; fileList.addFile(file); //For Diagnoses purposes only if (Config.Configure.diagnose >= 30) { Console.WriteLine("Chapter Atom count: {0}\n", file.chapterAtom.Count, file.mkvInfo); foreach (ChapterAtom chapter in file.chapterAtom) { { Console.WriteLine("File name: {0}\nChapter Number: {2}\nTime Start: {3}\nTime End: {4}\nSuid: {5}\n", file.filename, chapter.chapterInfo, chapter.chapterNum, chapter.timeStart, chapter.timeEnd, chapter.suid); } } } progressState.progressDetail = "Getting chapters' info..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); analyzeProgress++; } SuidLister suidList = getSuid(fileList); progressState.progressDetail = "Creating SUID list..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); fileList = tracklist.arrangeTrack(fileList, suidList, this); progressState.progressDetail = "Arranging new tracklist for every file..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); //For Diagnostic purposes only if (Config.Configure.diagnose >= 30) { foreach (Suid suid in suidList.suidList) { { Console.WriteLine("SUID filename: " + suid.fileName); Console.WriteLine("SUID: " + suid.suid); Console.WriteLine("\n"); } } Console.WriteLine("fileList.fileList.Count: " + fileList.fileList.Count + "\n"); foreach (FileObject file in fileList.fileList) { //Console.WriteLine("Merge Argument count: {0}\n", file.mergeArgument.Count); foreach (MergeArgument merge in file.mergeArgument) { Console.WriteLine("Merge Argument:\nFile name: {0}\nTime Code: {1}\nFile Argument: {2}\nChapter Number: {3}\n", file.filename, merge.timeCode, merge.fileName, merge.chapterNum); } foreach (TimeCode time in file.timeCode) { Console.WriteLine("Time Code Argument: {0}\n", time.timeCode); } foreach (DelArgument del in file.delArgument) { Console.WriteLine("Del Argument: {0}\n", del.fileName); } } } fileLists.Add(fileList); if (Config.Configure.doMakeXml) { makeFile.makeFile(fileList, this); progressState.progressDetail = "Dumping XML file..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); } if (Config.Configure.doMakeScript) { makeFile.makeXML(fileList, this); progressState.progressDetail = "Creating Merge Script..."; Analyze.backgroundWorker.ReportProgress(progressArg, progressState); } }
/// <summary> /// Processes files to create File Objects for the main tasks of this program. /// Every tasks are denoted on each comment lines inside the method. /// </summary> /// <param name="list">The list that contains the fullpaths of the actual files.</param> /// <param name="listname">Name for the FileObjectCollection to be created.</param> /// <param name="processor">The Analyze object for progression report.</param> /// <param name="path">The path used as a working directory merge commands.</param> /// <param name="totalArguments">Optional. For progress report. The total number of lists to process.</param> public void processList(List <string> list, string listname, Analyze processor, string path = "C:\\", int totalArguments = 0) { FileObjectCollection fileList = new FileObjectCollection(); TrackLister tracklist = new TrackLister(); MakeFile makeFile = new MakeFile(); ChapterGenerator chapterGet = new ChapterGenerator(); ProgressState progressState = new ProgressState(); fileList.folderPath = path; fileList.name = listname; progressState.listName = fileList.name; progress = 1; processPercent = 0; foreach (string s in list) { progressState.progressDetail = "Creating file entry..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); FileObject file = new FileObject(s); processPercent = progress.ToPercentage(list.Count); progressState.progressPercent = processPercent; progressState.fileName = file.filename; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); //Routine after splitting //Checks if current backgroundWorker operation is cancelled //Stops this program if true if (Analyze.backgroundWorker.CancellationPending) { return; } if (file.extension == ".mkv") { try { file = InfoDumper.infoDump(file); } catch (Exception ex) { Program.Message("Error:\r\n\r\n" + ex.Message, "Error"); } progressState.progressDetail = "Dumping MKV info..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); file = chapterGet.chapterDump(file); if (!Config.Configure.includeMkvInfoOnFiles) { file.mkvInfo = null; } if (!Config.Configure.includeMediaInfoOnFiles) { file.ffInfo = null; } progressState.progressDetail = "Getting chapters' info..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); fileList.hasMKV = true; } if (Program.hasFFmpeg) { progressState.progressDetail = "Dumping media info..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); try { file = InfoDumper.ffInfoDump(file); } catch (Exception ex) { Program.Message("Error:\r\n\r\n" + ex.Message, "Error"); } if (!String.IsNullOrEmpty(file.ffInfo)) { file = chapterGet.mediaDump(file); } } fileList.addFile(file); progress++; } if (fileList.hasMKV) { SuidLister suidList = CreateSuidLister(fileList); progressState.progressDetail = "Creating SUID list..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); fileList = tracklist.arrangeTrack(fileList, suidList, processor); progressState.progressDetail = "Arranging new tracklist for every file..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); //For Diagnostic purposes only if (Config.Configure.diagnose >= 30) { foreach (Suid suid in suidList.suidList) { { Console.WriteLine("SUID filename: " + suid.fileName); Console.WriteLine("SUID: " + suid.suid); Console.WriteLine("\n"); } } Console.WriteLine("fileList.fileList.Count: " + fileList.fileList.Count + "\n"); foreach (FileObject file in fileList.fileList) { //Console.WriteLine("Merge Argument count: {0}\n", file.mergeArgument.Count); foreach (MergeArgument merge in file.mergeArgument) { Console.WriteLine("Merge Argument:\nFile name: {0}\nTime Code: {1}\nFile Argument: {2}\nChapter Number: {3}\n", file.filename, merge.timeCode, merge.fileName, merge.chapterNum); } foreach (TimeCode time in file.timeCode) { Console.WriteLine("Time Code Argument: {0}\n", time.timeCode); } foreach (DelArgument del in file.delArgument) { Console.WriteLine("Del Argument: {0}\n", del.fileName); } } } if (Config.Configure.doMakeScript) { makeFile.makeFile(fileList, processor); progressState.progressDetail = "Creating Merge Script..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); } } if (Config.Configure.doMakeXml) { makeFile.makeXML(fileList, processor); progressState.progressDetail = "Dumping XML file..."; Analyze.backgroundWorker.ReportProgress(processor.progressArg, progressState); } processor.fileLists.Add(fileList); }