OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 9 Sep 2009 08:10:17 +0000 (08:10 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 9 Sep 2009 08:10:17 +0000 (08:10 +0000)
- Improve autoName reliability - Thanks exdeus

git-svn-id: svn://localhost/HandBrake/trunk@2809 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Functions/Main.cs
win/C#/frmMain.cs

index 7516e52..022a025 100644 (file)
@@ -124,7 +124,7 @@ namespace Handbrake.Functions
         /// Function which generates the filename and path automatically based on \r
         /// the Source Name, DVD title and DVD Chapters\r
         /// </summary>\r
-        public static string autoName(frmMain mainWindow ) //ComboBox drpDvdtitle, string chapter_start, string chatper_end, string source, string dest, int format, Boolean chapters)\r
+        public static string autoName(frmMain mainWindow) //ComboBox drpDvdtitle, string chapter_start, string chatper_end, string source, string dest, int format, Boolean chapters)\r
         {\r
             string AutoNamePath = string.Empty;\r
             if (mainWindow.drp_dvdtitle.Text != "Automatic")\r
@@ -178,7 +178,9 @@ namespace Handbrake.Functions
                 {\r
                     // Use the path and change the file extension to match the previous destination\r
                     AutoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.text_destination.Text), destinationFilename);\r
-                    AutoNamePath = Path.ChangeExtension(AutoNamePath, Path.GetExtension(mainWindow.text_destination.Text));\r
+\r
+                    if (Path.HasExtension(mainWindow.text_destination.Text))\r
+                        AutoNamePath = Path.ChangeExtension(AutoNamePath, Path.GetExtension(mainWindow.text_destination.Text));\r
                 }\r
             }\r
 \r
index a668cc6..b46b5ae 100644 (file)
@@ -723,7 +723,7 @@ namespace Handbrake
 \r
                         if (ActivityWindow != null)\r
                             ActivityWindow.SetLogView(false);\r
-                        \r
+\r
                     }\r
                     this.Focus();\r
                 }\r
@@ -861,18 +861,8 @@ namespace Handbrake
                 return;\r
             }\r
 \r
-            switch (type) // Start the scan\r
-            {\r
-                case 1: // btn_dvd_source_Click()\r
-                case 3: // mnu_dvd_drive_Click()\r
-                    sourcePath = Path.GetFullPath(file);\r
-                    startScan(file);\r
-                    break;\r
-                case 2: // btn_file_source_Click()\r
-                    sourcePath = Path.GetFileName(file);\r
-                    startScan(file);\r
-                    break;\r
-            }\r
+            sourcePath = Path.GetFileName(file);\r
+            startScan(file);\r
         }\r
         private void drp_dvdtitle_Click(object sender, EventArgs e)\r
         {\r
@@ -1127,9 +1117,8 @@ namespace Handbrake
                 else\r
                     newExtension = ".mp4";\r
 \r
-            text_destination.Text = text_destination.Text.Replace(".mp4", newExtension);\r
-            text_destination.Text = text_destination.Text.Replace(".m4v", newExtension);\r
-            text_destination.Text = text_destination.Text.Replace(".mkv", newExtension);\r
+            if (Path.HasExtension(newExtension))\r
+                text_destination.Text = Path.ChangeExtension(text_destination.Text, newExtension);\r
         }\r
 \r
         //Video Tab\r