From 6f76fa075fe26dbb103c945cdbd55719379f88a4 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 2 Aug 2009 14:48:07 +0000 Subject: WinGui: - Fix subtitle offset control. Was limited to 100. Changed increment to 10ms jumps. - Added Import CSV function for the chapter markers tab. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2746 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/Main.cs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'win/C#/Functions') diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 987876e56..9a8b9a02f 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -80,6 +80,40 @@ namespace Handbrake.Functions return dataChpt; } + public static DataGridView importChapterNames(DataGridView dataChpt, string filename) + { + IDictionary chapterMap = new Dictionary(); + try + { + StreamReader sr = new StreamReader(filename); + string csv = sr.ReadLine(); + while (csv != null) + { + if (csv.Trim() != "") + { + string[] contents = csv.Split(','); + int chapter; + int.TryParse(contents[0], out chapter); + chapterMap.Add(chapter, contents[1]); + } + csv = sr.ReadLine(); + } + } + catch (Exception) + { + return null; + } + + foreach (DataGridViewRow item in dataChpt.Rows) + { + string name; + chapterMap.TryGetValue((int)item.Cells[0].Value, out name); + item.Cells[1].Value = name ?? "Chapter " + item.Cells[0].Value; + } + + return dataChpt; + } + /// /// Function which generates the filename and path automatically based on /// the Source Name, DVD title and DVD Chapters -- cgit v1.2.3