summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-10-05 14:48:33 +0000
committersr55 <[email protected]>2013-10-05 14:48:33 +0000
commitac2f6f59343ee6166ebe5e6b709dfea6d549190b (patch)
treefe8754362e687cd20b608949ff49d2e64b12d063 /win/CS
parente65a09acd28ebe7e105d527c283100e1dbd2bf79 (diff)
WinGui: Use the LumenWorks CsvReader library for the chapters tab. (MIT License)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5820 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs20
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs3
3 files changed, 17 insertions, 10 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index bb24758b6..46587920d 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -96,6 +96,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\libraries\Growl.CoreLibrary.dll</HintPath>
</Reference>
+ <Reference Include="LumenWorks.Framework.IO">
+ <HintPath>..\libraries\CsvReader\LumenWorks.Framework.IO.dll</HintPath>
+ </Reference>
<Reference Include="Ookii.Dialogs.Wpf">
<HintPath>..\libraries\OokiiDialogs\Ookii.Dialogs.Wpf.dll</HintPath>
</Reference>
@@ -103,6 +106,7 @@
<Reference Include="PresentationFramework.Aero" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Runtime.Serialization" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
index 4276b97a4..6344e262b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
@@ -24,6 +24,8 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.ViewModels.Interfaces;
+ using LumenWorks.Framework.IO.Csv;
+
using Ookii.Dialogs.Wpf;
/// <summary>
@@ -160,19 +162,17 @@ namespace HandBrakeWPF.ViewModels
IDictionary<int, string> chapterMap = new Dictionary<int, string>();
try
{
- var sr = new StreamReader(filename);
- string csv = sr.ReadLine();
- while (csv != null)
+ using (CsvReader csv = new CsvReader(new StreamReader(filename), false))
{
- if (csv.Trim() != string.Empty)
+ while (csv.ReadNextRecord())
{
- csv = csv.Replace("\\,", "<!comma!>");
- string[] contents = csv.Split(',');
- int chapter;
- int.TryParse(contents[0], out chapter);
- chapterMap.Add(chapter, contents[1].Replace("<!comma!>", ","));
+ if (csv.FieldCount == 2)
+ {
+ int chapter;
+ int.TryParse(csv[0], out chapter);
+ chapterMap[chapter] = csv[1];
+ }
}
- csv = sr.ReadLine();
}
}
catch (Exception)
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index cd2d10423..bfe29b27b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -374,6 +374,9 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private bool disableQuickSyncDecoding;
+ /// <summary>
+ /// The enable quick sync.
+ /// </summary>
private bool enableQuickSync;
#endregion