diff options
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/Functions/Main.cs | 2 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 46 |
2 files changed, 42 insertions, 6 deletions
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index dd618cb52..6f8efaa2b 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -130,7 +130,7 @@ namespace Handbrake.Functions if (mainWindow.drp_dvdtitle.Text != "Automatic")
{
// Get the Source Name
- string sourceName = Path.GetFileNameWithoutExtension(mainWindow.sourcePath);
+ string sourceName = mainWindow.SourceName;
// Get the Selected Title Number
string[] titlesplit = mainWindow.drp_dvdtitle.Text.Split(' ');
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 2a32be763..4e3a73ff9 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -35,6 +35,9 @@ namespace Handbrake private Form splash;
public string sourcePath;
private string lastAction;
+ private SourceType selectedSourceType;
+ private string dvdDrivePath;
+ private string dvdDriveLabel;
// Delegates **********************************************************
private delegate void UpdateWindowHandler();
@@ -181,6 +184,21 @@ namespace Handbrake }
#endregion
+ #region Properties
+ public string SourceName
+ {
+ get
+ {
+ if (this.selectedSourceType == SourceType.DvdDrive)
+ {
+ return this.dvdDriveLabel;
+ }
+
+ return Path.GetFileNameWithoutExtension(this.sourcePath);
+ }
+ }
+ #endregion
+
#region Events
// Encoding Events for setting up the GUI
private void events()
@@ -825,22 +843,28 @@ namespace Handbrake private void btn_dvd_source_Click(object sender, EventArgs e)
{
if (DVD_Open.ShowDialog() == DialogResult.OK)
+ {
+ this.selectedSourceType = SourceType.Folder;
selectSource(DVD_Open.SelectedPath);
+ }
else
UpdateSourceLabel();
}
private void btn_file_source_Click(object sender, EventArgs e)
{
if (ISO_Open.ShowDialog() == DialogResult.OK)
+ {
+ this.selectedSourceType = SourceType.VideoFile;
selectSource(ISO_Open.FileName);
+ }
else
UpdateSourceLabel();
}
private void mnu_dvd_drive_Click(object sender, EventArgs e)
{
- if (!mnu_dvd_drive.Text.Contains("VIDEO_TS")) return;
- string[] path = mnu_dvd_drive.Text.Split(' ');
- selectSource(path[0]);
+ if (this.dvdDrivePath == null) return;
+ this.selectedSourceType = SourceType.DvdDrive;
+ selectSource(this.dvdDrivePath);
}
private void selectSource(string file)
{
@@ -1573,7 +1597,7 @@ namespace Handbrake }
private void UpdateSourceLabel()
{
- labelSource.Text = string.IsNullOrEmpty(sourcePath) ? "Select \"Source\" to continue." : Path.GetFileName(sourcePath);
+ labelSource.Text = string.IsNullOrEmpty(sourcePath) ? "Select \"Source\" to continue." : this.SourceName;
}
#endregion
@@ -1655,7 +1679,9 @@ namespace Handbrake {
if (File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))
{
- mnu_dvd_drive.Text = curDrive.RootDirectory + "VIDEO_TS (" + curDrive.VolumeLabel + ")";
+ this.dvdDrivePath = curDrive.RootDirectory + "VIDEO_TS";
+ this.dvdDriveLabel = curDrive.VolumeLabel;
+ mnu_dvd_drive.Text = this.dvdDrivePath + " (" + this.dvdDriveLabel + ")";
foundDrive = true;
break;
}
@@ -1735,6 +1761,16 @@ namespace Handbrake }
#endregion
+ #region enum
+ private enum SourceType
+ {
+ None = 0,
+ Folder,
+ DvdDrive,
+ VideoFile
+ }
+ #endregion
+
// This is the END of the road ****************************************
}
}
\ No newline at end of file |