\r
/// <summary>\r
/// Looks up a localized string similar to The reported duration of the chapters on the source media \r
- ///and the duration of chapters in the input file differ drastically.\r
+ ///and the duration of chapters in the input file differ greatly.\r
+ ///\r
///It is very likely that this chapter file was produced from a different source media.\r
///\r
///Are you sure you want to import the chapter names?.\r
</data>\r
<data name="ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchMsg" xml:space="preserve">\r
<value>The reported duration of the chapters on the source media \r
-and the duration of chapters in the input file differ drastically.\r
+and the duration of chapters in the input file differ greatly.\r
+\r
It is very likely that this chapter file was produced from a different source media.\r
\r
Are you sure you want to import the chapter names?</value>\r
/// </summary>
internal class ChapterImporterCsv
{
+ /// <summary>
+ /// The file filter value for the OpenFileDialog
+ /// </summary>
public static string FileFilter => "CSV files (*.csv;*.tsv)|*.csv;*.tsv";
+ /// <summary>
+ /// Imports all chapter information from the given <see cref="filename"/> into the <see cref="chapterMap"/> dictionary.
+ /// </summary>
+ /// <param name="filename">The full path and filename of the chapter marker file to import</param>
+ /// <param name="chapterMap">The dictionary that should be populated with parsed chapter markers</param>
public static void Import(string filename, ref Dictionary<int, Tuple<string, TimeSpan>> importedChapters)
{
using (TextFieldParser csv = new TextFieldParser(filename)
using HandBrakeWPF.Helpers;
+ /// <summary>
+ /// Imports chapter markers in the ChaptersDb.org TXT format
+ /// More info: http://www.chapterdb.org/docs
+ /// </summary>
public class ChapterImporterTxt
{
+ /// <summary>
+ /// The file filter value for the OpenFileDialog
+ /// </summary>
public static string FileFilter => "Text files (*.txt)|*.txt";
+ /// <summary>
+ /// Imports all chapter information from the given <see cref="filename"/> into the <see cref="chapterMap"/> dictionary.
+ /// </summary>
+ /// <param name="filename">The full path and filename of the chapter marker file to import</param>
+ /// <param name="chapterMap">The dictionary that should be populated with parsed chapter markers</param>
public static void Import(string filename, ref Dictionary<int, Tuple<string, TimeSpan>> chapterMap)
{
using (var file = new StreamReader(filename))
{
private const string QUOTE = "\"";
private const string ESCAPED_QUOTE = "\"\"";
- private static readonly char[] CHARACTERS_THAT_MUST_BE_QUOTED = { ',', '"', '\n' };
+ private static readonly char[] CHARACTERS_THAT_MUST_BE_QUOTED = { ',', '"', '\n', '\t' };
/// <summary>
/// Properly escapes a string value containing reserved characters with double quotes "..." before it is written to a CSV file.
using HandBrakeWPF.Utilities.Output;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
- using Microsoft.VisualBasic.FileIO;\r
-\r
using ChapterMarker = HandBrakeWPF.Services.Encode.Model.Models.ChapterMarker;\r
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;\r
using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;\r
// Execute the importer based on the file extension\r
switch (fileExtension)\r
{\r
- case ".csv":\r
+ case ".csv": // comma separated file\r
+ case ".tsv": // tab separated file\r
ChapterImporterCsv.Import(filename, ref importedChapters);\r
break;\r
case ".xml":\r
{\r
if( !string.IsNullOrEmpty(validationErrorMessage))\r
throw new GeneralApplicationException(Resources.ChaptersViewModel_ValidationFailedWarning, validationErrorMessage);\r
+\r
+ // The user has cancelled the import, so exit\r
+ return;\r
}\r
\r
// Now iterate over each chatper we have, and set it's name\r