summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions/Common.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-02-24 18:40:27 +0000
committersr55 <[email protected]>2008-02-24 18:40:27 +0000
commit63b41d0f2b6f5bef46762706947a5384412f197f (patch)
tree224cc2e95fe54e812c2ed7b012ca12b31e0dd143 /win/C#/Functions/Common.cs
parentc665f12384f07740d06debd409f7474ea43d1d12 (diff)
WinGui:
- Fixed bug where the chapter markers csv filename renamed the same for every item on the queue. This meant the same chapter names got added to each encode when in fact, each encode should have had a separate file. - Disabled development expiry code. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1313 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions/Common.cs')
-rw-r--r--win/C#/Functions/Common.cs48
1 files changed, 36 insertions, 12 deletions
diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs
index 4c3e47dcb..ebeb0c9c6 100644
--- a/win/C#/Functions/Common.cs
+++ b/win/C#/Functions/Common.cs
@@ -714,20 +714,46 @@ namespace Handbrake.Functions
string ChapterMarkers = "";
+ // Attach Source name and dvd title to the start of the chapters.csv filename.
+ // This is for the queue. It allows different chapter name files for each title.
+ string source_name = mainWindow.text_source.Text;
+ string[] sourceName = source.Split('\\');
+ source_name = sourceName[sourceName.Length - 1].Replace(".iso", "").Replace(".mpg", "").Replace(".ts", "").Replace(".ps", "");
+ source_name = source_name.Replace("\"", "");
+
+ string source_title = mainWindow.drp_dvdtitle.Text;
+ string[] titlesplit = source_title.Split(' ');
+ source_title = titlesplit[0];
+
if (mainWindow.Check_ChapterMarkers.Checked)
{
- Boolean saveCSV = chapterCSVSave(mainWindow);
- if (saveCSV == false)
+
+ if (source_name != "Click 'Browse' to continue")
{
- MessageBox.Show("Unable to save Chapter Makrers file! \n Chapter marker names will NOT be saved in your encode \n\n", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ChapterMarkers = " -m ";
+ if (source_title != "Automatic")
+ {
+ string filename = source_name + "-" + source_title + "-chapters.csv";
+ string path = Path.Combine(Path.GetTempPath(), filename);
+
+ Boolean saveCSV = chapterCSVSave(mainWindow, path);
+ if (saveCSV == false)
+ ChapterMarkers = " -m ";
+ else
+ {
+ ChapterMarkers = " --markers=" + "\"" + path + "\"";
+ }
+ }
+ else
+ {
+ string path = Path.Combine(Path.GetTempPath(), "chapters.csv");
+ ChapterMarkers = " --markers=" + "\"" + path + "\"";
+ }
}
else
{
string path = Path.Combine(Path.GetTempPath(), "chapters.csv");
-
ChapterMarkers = " --markers=" + "\"" + path + "\"";
- }
+ }
}
string chapter_markers = ChapterMarkers;
@@ -807,12 +833,10 @@ namespace Handbrake.Functions
* This function saves the data in the chapters tab, dataGridView into a CSV file called chapters.csv in this applications
* running directory.
*/
- private Boolean chapterCSVSave(frmMain mainWindow)
+ private Boolean chapterCSVSave(frmMain mainWindow, string file_path_name)
{
try
- {
- string path = Path.Combine(Path.GetTempPath(), "chapters.csv");
-
+ {
StringBuilder csv = new StringBuilder();
foreach (DataGridViewRow row in mainWindow.data_chpt.Rows)
@@ -822,7 +846,7 @@ namespace Handbrake.Functions
csv.Append(row.Cells[1].Value.ToString());
csv.Append(Environment.NewLine);
}
- StreamWriter file = new StreamWriter(path);
+ StreamWriter file = new StreamWriter(file_path_name);
file.Write(csv.ToString());
file.Close();
file.Dispose();
@@ -831,7 +855,7 @@ namespace Handbrake.Functions
}
catch (Exception exc)
{
- MessageBox.Show(exc.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show("Unable to save Chapter Makrers file! \nChapter marker names will NOT be saved in your encode \n\n" + exc.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
}