]> granicus.if.org Git - handbrake/commitdiff
Minor fixes to chapterdb.org support that were lost in a merge-gone-wrong.
authorSverrir Sigmundarson <sverrirs@gmail.com>
Mon, 23 Nov 2015 14:10:37 +0000 (15:10 +0100)
committerSverrir Sigmundarson <sverrirs@gmail.com>
Mon, 23 Nov 2015 14:10:37 +0000 (15:10 +0100)
win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
win/CS/HandBrakeWPF/Properties/Resources.resx
win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterCsv.cs
win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterTxt.cs
win/CS/HandBrakeWPF/Utilities/Output/CsvHelper.cs
win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs

index d5265941aef103acad451ea8fc6f7dae6ac27537..70ff7170c719ba6a2b948e884b5baf002b790adc 100644 (file)
@@ -545,7 +545,8 @@ namespace HandBrakeWPF.Properties {
         \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
index 304b8f96117b216d9267fab2ff782d625b5d14a2..09f22110159d2b542e52e3d6af7e0fcb16879038 100644 (file)
@@ -777,7 +777,8 @@ Do you still want to import the chapter names?</value>
   </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
index 906eae51081860fe3e85628a5f96e0a1b3197f54..8317f4c1af53025079bc75e225a5bd37d628a2a5 100644 (file)
@@ -16,8 +16,16 @@ namespace HandBrakeWPF.Utilities.Input
     /// </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)
index 678abb20ada2842bef27aeb25705dca4d8a3a404..55b24b7a1d6f620f62c27662f04d787ca30fd1fc 100644 (file)
@@ -10,10 +10,22 @@ namespace HandBrakeWPF.Utilities.Input
 
     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))
index cf2d7a38d524c96258a44f195f3ec890d446ffe6..48a0bcf6347e615755a1f8da786dc5fdf8f858c7 100644 (file)
@@ -13,7 +13,7 @@ namespace HandBrakeWPF.Utilities.Output
     {
         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.
index e92656f971d656909d990457c9fddb5e0af2285b..1948a2443736eff3c891b66e1a059d4bff6149a5 100644 (file)
@@ -28,8 +28,6 @@ namespace HandBrakeWPF.ViewModels
     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
@@ -174,7 +172,8 @@ namespace HandBrakeWPF.ViewModels
             // 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
@@ -199,6 +198,9 @@ namespace HandBrakeWPF.ViewModels
             {\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