OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / frmMain.cs
index e7345b5..d66692d 100644 (file)
@@ -713,15 +713,16 @@ namespace Handbrake
         private void drop_format_SelectedIndexChanged(object sender, EventArgs e)\r
         {\r
             if (drop_format.SelectedIndex == 0)\r
-                text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".mp4");\r
+                setExtension(".mp4");\r
             else if (drop_format.SelectedIndex == 1)\r
-                text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".m4v");\r
+                setExtension(".m4v");\r
             else if (drop_format.SelectedIndex == 2)\r
-                text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".mkv");\r
+                setExtension(".mkv");\r
             else if (drop_format.SelectedIndex == 3)\r
-                text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".avi");\r
+                setExtension(".avi");\r
             else if (drop_format.SelectedIndex == 4)\r
-                text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".ogm");\r
+                setExtension(".ogm");\r
+\r
         }\r
 \r
         //Video Tab\r
@@ -1578,6 +1579,20 @@ namespace Handbrake
                 }\r
             }\r
         }\r
+        /// <summary>\r
+        /// Take in a File destination and change it's file extension to a new Extension\r
+        /// </summary>\r
+        /// <param name="destination"></param>\r
+        /// <param name="newExtension"></param>\r
+        /// <returns>String of the new file path and extension</returns>\r
+        public void setExtension(string newExtension)\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
+            text_destination.Text = text_destination.Text.Replace(".avi", newExtension);\r
+            text_destination.Text = text_destination.Text.Replace(".ogm", newExtension);\r
+        }\r
         #endregion\r
 \r
         #region Drive Detection\r