]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Sun, 27 Mar 2011 20:08:33 +0000 (20:08 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 27 Mar 2011 20:08:33 +0000 (20:08 +0000)
- Some move re factoring to push the logic code into the service library.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3885 b64f7644-9d1e-0410-96f1-a4d463321fa5

15 files changed:
win/CS/Controls/Subtitles.cs
win/CS/Functions/Main.cs
win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
win/CS/HandBrake.ApplicationServices/Properties/Settings.Designer.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Properties/Settings.settings [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode.cs
win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs [moved from win/CS/HandBrake.ApplicationServices/Utilities/UtilityService.cs with 96% similarity]
win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs [new file with mode: 0644]
win/CS/frmMain.cs
win/CS/frmOptions.cs
win/CS/libraries/HandBrakeInterop.dll
win/CS/libraries/Source/HandBrakeInteropSource.zip

index 0a5240955c7f4c589d680d260235a26dcfa5dfb8..c23b0e418fce3a751f8d6a8357a2d022cf4a7ab2 100644 (file)
@@ -10,12 +10,9 @@ namespace Handbrake.Controls
     using System.IO;\r
     using System.Linq;\r
     using System.Windows.Forms;\r
-    using Functions;\r
 \r
-    using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Model.Encoding;\r
-\r
-    using Model;\r
+    using HandBrake.ApplicationServices.Utilities;\r
 \r
     /// <summary>\r
     /// The Subtitles Tab\r
@@ -48,7 +45,7 @@ namespace Handbrake.Controls
         {\r
             InitializeComponent();\r
 \r
-            langMap = Main.MapLanguages();\r
+            langMap = LanguageUtilities.MapLanguages();\r
             foreach (string key in langMap.Keys)\r
                 srt_lang.Items.Add(key);\r
 \r
index 48f15bd6f3ebcd669719e3446770a922f224ad99..e0537817b62fcb9ce59cb8b438022ccba6a1bc3d 100644 (file)
@@ -16,7 +16,7 @@ namespace Handbrake.Functions
     using System.Windows.Forms;\r
     using System.Xml.Serialization;\r
 \r
-\r
+    using HandBrake.ApplicationServices.Extensions;\r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Parsing;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
@@ -33,35 +33,6 @@ namespace Handbrake.Functions
         /// </summary>\r
         private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<QueueTask>));\r
 \r
-        /// <summary>\r
-        /// Calculate the duration of the selected title and chapters\r
-        /// </summary>\r
-        /// <param name="chapterStart">\r
-        /// The chapter Start.\r
-        /// </param>\r
-        /// <param name="chapterEnd">\r
-        /// The chapter End.\r
-        /// </param>\r
-        /// <param name="selectedTitle">\r
-        /// The selected Title.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The calculated duration.\r
-        /// </returns>\r
-        public static TimeSpan CalculateDuration(int chapterStart, int chapterEnd, Title selectedTitle)\r
-        {\r
-            TimeSpan duration = TimeSpan.FromSeconds(0.0);\r
-            chapterStart++;\r
-            chapterEnd++;\r
-            if (chapterStart != 0 && chapterEnd != 0 && chapterEnd <= selectedTitle.Chapters.Count)\r
-            {\r
-                for (int i = chapterStart; i <= chapterEnd; i++)\r
-                    duration += selectedTitle.Chapters[i - 1].Duration;\r
-            }\r
-\r
-            return duration;\r
-        }\r
-\r
         /// <summary>\r
         /// Set's up the DataGridView on the Chapters tab (frmMain)\r
         /// </summary>\r
@@ -207,7 +178,7 @@ namespace Handbrake.Functions
                     sourceName = sourceName.Replace("_", " ");\r
 \r
                 if (Properties.Settings.Default.AutoNameTitleCase)\r
-                    sourceName = TitleCase(sourceName);\r
+                    sourceName = sourceName.ToTitleCase();\r
 \r
                 // Get the Selected Title Number\r
                 string[] titlesplit = mainWindow.drp_dvdtitle.Text.Split(' ');\r
@@ -473,230 +444,6 @@ namespace Handbrake.Functions
             }\r
         }\r
 \r
-        /// <summary>\r
-        /// Map languages and their iso639_2 value into a IDictionary\r
-        /// </summary>\r
-        /// <returns>A Dictionary containing the language and iso code</returns>\r
-        public static IDictionary<string, string> MapLanguages()\r
-        {\r
-            IDictionary<string, string> languageMap = new Dictionary<string, string>\r
-                                                          {\r
-                                                              {"Any", "und"}, \r
-                                                              {"Afar", "aar"}, \r
-                                                              {"Abkhazian", "abk"}, \r
-                                                              {"Afrikaans", "afr"}, \r
-                                                              {"Akan", "aka"}, \r
-                                                              {"Albanian", "sqi"}, \r
-                                                              {"Amharic", "amh"}, \r
-                                                              {"Arabic", "ara"}, \r
-                                                              {"Aragonese", "arg"}, \r
-                                                              {"Armenian", "hye"}, \r
-                                                              {"Assamese", "asm"}, \r
-                                                              {"Avaric", "ava"}, \r
-                                                              {"Avestan", "ave"}, \r
-                                                              {"Aymara", "aym"}, \r
-                                                              {"Azerbaijani", "aze"}, \r
-                                                              {"Bashkir", "bak"}, \r
-                                                              {"Bambara", "bam"}, \r
-                                                              {"Basque", "eus"}, \r
-                                                              {"Belarusian", "bel"}, \r
-                                                              {"Bengali", "ben"}, \r
-                                                              {"Bihari", "bih"}, \r
-                                                              {"Bislama", "bis"}, \r
-                                                              {"Bosnian", "bos"}, \r
-                                                              {"Breton", "bre"}, \r
-                                                              {"Bulgarian", "bul"}, \r
-                                                              {"Burmese", "mya"}, \r
-                                                              {"Catalan", "cat"}, \r
-                                                              {"Chamorro", "cha"}, \r
-                                                              {"Chechen", "che"}, \r
-                                                              {"Chinese", "zho"}, \r
-                                                              {"Church Slavic", "chu"}, \r
-                                                              {"Chuvash", "chv"}, \r
-                                                              {"Cornish", "cor"}, \r
-                                                              {"Corsican", "cos"}, \r
-                                                              {"Cree", "cre"}, \r
-                                                              {"Czech", "ces"}, \r
-                                                              {"Dansk", "dan"}, \r
-                                                              {"Divehi", "div"}, \r
-                                                              {"Nederlands", "nld"}, \r
-                                                              {"Dzongkha", "dzo"}, \r
-                                                              {"English", "eng"}, \r
-                                                              {"Esperanto", "epo"}, \r
-                                                              {"Estonian", "est"}, \r
-                                                              {"Ewe", "ewe"}, \r
-                                                              {"Faroese", "fao"}, \r
-                                                              {"Fijian", "fij"}, \r
-                                                              {"Suomi", "fin"}, \r
-                                                              {"Francais", "fra"}, \r
-                                                              {"Western Frisian", "fry"}, \r
-                                                              {"Fulah", "ful"}, \r
-                                                              {"Georgian", "kat"}, \r
-                                                              {"Deutsch", "deu"}, \r
-                                                              {"Gaelic (Scots)", "gla"}, \r
-                                                              {"Irish", "gle"}, \r
-                                                              {"Galician", "glg"}, \r
-                                                              {"Manx", "glv"}, \r
-                                                              {"Greek Modern", "ell"}, \r
-                                                              {"Guarani", "grn"}, \r
-                                                              {"Gujarati", "guj"}, \r
-                                                              {"Haitian", "hat"}, \r
-                                                              {"Hausa", "hau"}, \r
-                                                              {"Hebrew", "heb"}, \r
-                                                              {"Herero", "her"}, \r
-                                                              {"Hindi", "hin"}, \r
-                                                              {"Hiri Motu", "hmo"}, \r
-                                                              {"Magyar", "hun"}, \r
-                                                              {"Igbo", "ibo"}, \r
-                                                              {"Islenska", "isl"}, \r
-                                                              {"Ido", "ido"}, \r
-                                                              {"Sichuan Yi", "iii"}, \r
-                                                              {"Inuktitut", "iku"}, \r
-                                                              {"Interlingue", "ile"}, \r
-                                                              {"Interlingua", "ina"}, \r
-                                                              {"Indonesian", "ind"}, \r
-                                                              {"Inupiaq", "ipk"}, \r
-                                                              {"Italiano", "ita"}, \r
-                                                              {"Javanese", "jav"}, \r
-                                                              {"Japanese", "jpn"}, \r
-                                                              {"Kalaallisut", "kal"}, \r
-                                                              {"Kannada", "kan"}, \r
-                                                              {"Kashmiri", "kas"}, \r
-                                                              {"Kanuri", "kau"}, \r
-                                                              {"Kazakh", "kaz"}, \r
-                                                              {"Central Khmer", "khm"}, \r
-                                                              {"Kikuyu", "kik"}, \r
-                                                              {"Kinyarwanda", "kin"}, \r
-                                                              {"Kirghiz", "kir"}, \r
-                                                              {"Komi", "kom"}, \r
-                                                              {"Kongo", "kon"}, \r
-                                                              {"Korean", "kor"}, \r
-                                                              {"Kuanyama", "kua"}, \r
-                                                              {"Kurdish", "kur"}, \r
-                                                              {"Lao", "lao"}, \r
-                                                              {"Latin", "lat"}, \r
-                                                              {"Latvian", "lav"}, \r
-                                                              {"Limburgan", "lim"}, \r
-                                                              {"Lingala", "lin"}, \r
-                                                              {"Lithuanian", "lit"}, \r
-                                                              {"Luxembourgish", "ltz"}, \r
-                                                              {"Luba-Katanga", "lub"}, \r
-                                                              {"Ganda", "lug"}, \r
-                                                              {"Macedonian", "mkd"}, \r
-                                                              {"Marshallese", "mah"}, \r
-                                                              {"Malayalam", "mal"}, \r
-                                                              {"Maori", "mri"}, \r
-                                                              {"Marathi", "mar"}, \r
-                                                              {"Malay", "msa"}, \r
-                                                              {"Malagasy", "mlg"}, \r
-                                                              {"Maltese", "mlt"}, \r
-                                                              {"Moldavian", "mol"}, \r
-                                                              {"Mongolian", "mon"}, \r
-                                                              {"Nauru", "nau"}, \r
-                                                              {"Navajo", "nav"}, \r
-                                                              {"Ndebele, South", "nbl"}, \r
-                                                              {"Ndebele, North", "nde"}, \r
-                                                              {"Ndonga", "ndo"}, \r
-                                                              {"Nepali", "nep"}, \r
-                                                              {"Norwegian Nynorsk", "nno"}, \r
-                                                              {"Norwegian Bokmål", "nob"}, \r
-                                                              {"Norsk", "nor"}, \r
-                                                              {"Chichewa; Nyanja", "nya"}, \r
-                                                              {"Occitan", "oci"}, \r
-                                                              {"Ojibwa", "oji"}, \r
-                                                              {"Oriya", "ori"}, \r
-                                                              {"Oromo", "orm"}, \r
-                                                              {"Ossetian", "oss"}, \r
-                                                              {"Panjabi", "pan"}, \r
-                                                              {"Persian", "fas"}, \r
-                                                              {"Pali", "pli"}, \r
-                                                              {"Polish", "pol"}, \r
-                                                              {"Portugues", "por"}, \r
-                                                              {"Pushto", "pus"}, \r
-                                                              {"Quechua", "que"}, \r
-                                                              {"Romansh", "roh"}, \r
-                                                              {"Romanian", "ron"}, \r
-                                                              {"Rundi", "run"}, \r
-                                                              {"Russian", "rus"}, \r
-                                                              {"Sango", "sag"}, \r
-                                                              {"Sanskrit", "san"}, \r
-                                                              {"Serbian", "srp"}, \r
-                                                              {"Hrvatski", "hrv"}, \r
-                                                              {"Sinhala", "sin"}, \r
-                                                              {"Slovak", "slk"}, \r
-                                                              {"Slovenian", "slv"}, \r
-                                                              {"Northern Sami", "sme"}, \r
-                                                              {"Samoan", "smo"}, \r
-                                                              {"Shona", "sna"}, \r
-                                                              {"Sindhi", "snd"}, \r
-                                                              {"Somali", "som"}, \r
-                                                              {"Sotho Southern", "sot"}, \r
-                                                              {"Espanol", "spa"}, \r
-                                                              {"Sardinian", "srd"}, \r
-                                                              {"Swati", "ssw"}, \r
-                                                              {"Sundanese", "sun"}, \r
-                                                              {"Swahili", "swa"}, \r
-                                                              {"Svenska", "swe"}, \r
-                                                              {"Tahitian", "tah"}, \r
-                                                              {"Tamil", "tam"}, \r
-                                                              {"Tatar", "tat"}, \r
-                                                              {"Telugu", "tel"}, \r
-                                                              {"Tajik", "tgk"}, \r
-                                                              {"Tagalog", "tgl"}, \r
-                                                              {"Thai", "tha"}, \r
-                                                              {"Tibetan", "bod"}, \r
-                                                              {"Tigrinya", "tir"}, \r
-                                                              {"Tonga", "ton"}, \r
-                                                              {"Tswana", "tsn"}, \r
-                                                              {"Tsonga", "tso"}, \r
-                                                              {"Turkmen", "tuk"}, \r
-                                                              {"Turkish", "tur"}, \r
-                                                              {"Twi", "twi"}, \r
-                                                              {"Uighur", "uig"}, \r
-                                                              {"Ukrainian", "ukr"}, \r
-                                                              {"Urdu", "urd"}, \r
-                                                              {"Uzbek", "uzb"}, \r
-                                                              {"Venda", "ven"}, \r
-                                                              {"Vietnamese", "vie"}, \r
-                                                              {"Volapük", "vol"}, \r
-                                                              {"Welsh", "cym"}, \r
-                                                              {"Walloon", "wln"}, \r
-                                                              {"Wolof", "wol"}, \r
-                                                              {"Xhosa", "xho"}, \r
-                                                              {"Yiddish", "yid"}, \r
-                                                              {"Yoruba", "yor"}, \r
-                                                              {"Zhuang", "zha"}, \r
-                                                              {"Zulu", "zul"}\r
-                                                          };\r
-            return languageMap;\r
-        }\r
-\r
-        /// <summary>\r
-        /// Change a string to Title Case/\r
-        /// </summary>\r
-        /// <param name="input">\r
-        /// The input.\r
-        /// </param>\r
-        /// <returns>\r
-        /// A string in title case.\r
-        /// </returns>\r
-        public static string TitleCase(string input)\r
-        {\r
-            string[] tokens = input.Split(' ');\r
-            StringBuilder sb = new StringBuilder(input.Length);\r
-            foreach (string s in tokens)\r
-            {\r
-                if (!string.IsNullOrEmpty(s))\r
-                {\r
-                    sb.Append(s[0].ToString().ToUpper());\r
-                    sb.Append(s.Substring(1).ToLower());\r
-                    sb.Append(" ");\r
-                }\r
-            }\r
-\r
-            return sb.ToString().Trim();\r
-        }\r
-\r
         /// <summary>\r
         /// Show the Exception Window\r
         /// </summary>\r
diff --git a/win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs b/win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs
new file mode 100644 (file)
index 0000000..42f40c1
--- /dev/null
@@ -0,0 +1,34 @@
+/*  StringExtensions.cs $\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
+\r
+namespace HandBrake.ApplicationServices.Extensions\r
+{\r
+    using System.Text;\r
+\r
+    public static class StringExtensions\r
+    {\r
+        /// <summary>\r
+        /// Change the input string to title case\r
+        /// </summary>\r
+        /// <param name="input">the input string</param>\r
+        /// <returns>the input string in title case</returns>\r
+        public static string ToTitleCase(this string input)\r
+        {\r
+            string[] tokens = input.Split(' ');\r
+            StringBuilder sb = new StringBuilder(input.Length);\r
+            foreach (string s in tokens)\r
+            {\r
+                if (!string.IsNullOrEmpty(s))\r
+                {\r
+                    sb.Append(s[0].ToString().ToUpper());\r
+                    sb.Append(s.Substring(1).ToLower());\r
+                    sb.Append(" ");\r
+                }\r
+            }\r
+\r
+            return sb.ToString().Trim();\r
+        }\r
+    }\r
+}\r
index 14dd500948b28df2b8e2062afa9e4b2e6545271b..4edad20111c5691e7039d0568dcb22ec25842e80 100644 (file)
@@ -88,6 +88,7 @@
     <Compile Include="EventArgs\QueueProgressEventArgs.cs" />\r
     <Compile Include="EventArgs\ScanCompletedEventArgs.cs" />\r
     <Compile Include="EventArgs\ScanProgressEventArgs.cs" />\r
+    <Compile Include="Extensions\StringExtensions.cs" />\r
     <Compile Include="Functions\Converters.cs" />\r
     <Compile Include="Functions\EnumHelper.cs" />\r
     <Compile Include="Functions\GrowlCommunicator.cs" />\r
       <DesignTime>True</DesignTime>\r
       <DependentUpon>Resources.resx</DependentUpon>\r
     </Compile>\r
+    <Compile Include="Properties\Settings.Designer.cs">\r
+      <AutoGen>True</AutoGen>\r
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>\r
+      <DependentUpon>Settings.settings</DependentUpon>\r
+    </Compile>\r
     <Compile Include="Services\Encode.cs" />\r
     <Compile Include="Services\Interfaces\IEncode.cs" />\r
     <Compile Include="Services\Interfaces\IQueueManager.cs" />\r
     <Compile Include="Services\ScanService.cs" />\r
     <Compile Include="Services\UpdateService.cs" />\r
     <Compile Include="Utilities\AppcastReader.cs" />\r
+    <Compile Include="Utilities\GeneralUtilities.cs" />\r
+    <Compile Include="Utilities\LanguageUtilities.cs" />\r
     <Compile Include="Utilities\PlistUtility.cs" />\r
     <Compile Include="Utilities\QueryGeneratorUtility.cs" />\r
     <Compile Include="Utilities\QueryParserUtility.cs" />\r
-    <Compile Include="Utilities\UtilityService.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="app.config" />\r
     </EmbeddedResource>\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <None Include="Properties\Settings.settings">\r
+      <Generator>SettingsSingleFileGenerator</Generator>\r
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>\r
+    </None>\r
     <None Include="Resources\logo64.png" />\r
   </ItemGroup>\r
   <ItemGroup />\r
index 3a9e6a56a761c4d9e3f313700053c249aa1ea219..7f4bf9b78d077abc93426a7bb77da4c10682c72a 100644 (file)
@@ -222,6 +222,26 @@ namespace HandBrake.ApplicationServices.Parsing
             return titles.ToArray();\r
         }\r
 \r
+        /// <summary>\r
+        /// Calcuate the Duration\r
+        /// </summary>\r
+        /// <param name="startPoint">The Start Point (Chapters)</param>\r
+        /// <param name="endPoint">The End Point (Chapters)</param>\r
+        /// <returns>A Timespan</returns>\r
+        public TimeSpan CalculateDuration(int startPoint, int endPoint)\r
+        {\r
+            TimeSpan duration = TimeSpan.FromSeconds(0.0);\r
+            startPoint++;\r
+            endPoint++;\r
+            if (startPoint != 0 && endPoint != 0 && endPoint <= this.Chapters.Count)\r
+            {\r
+                for (int i = startPoint; i <= endPoint; i++)\r
+                    duration += this.Chapters[i - 1].Duration;\r
+            }\r
+\r
+            return duration;\r
+        }\r
+\r
         /// <summary>\r
         /// Override of the ToString method to provide an easy way to use this object in the UI\r
         /// </summary>\r
diff --git a/win/CS/HandBrake.ApplicationServices/Properties/Settings.Designer.cs b/win/CS/HandBrake.ApplicationServices/Properties/Settings.Designer.cs
new file mode 100644 (file)
index 0000000..dab4d16
--- /dev/null
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------\r
+// <auto-generated>\r
+//     This code was generated by a tool.\r
+//     Runtime Version:4.0.30319.1\r
+//\r
+//     Changes to this file may cause incorrect behavior and will be lost if\r
+//     the code is regenerated.\r
+// </auto-generated>\r
+//------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Properties {\r
+    \r
+    \r
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]\r
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {\r
+        \r
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));\r
+        \r
+        public static Settings Default {\r
+            get {\r
+                return defaultInstance;\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/win/CS/HandBrake.ApplicationServices/Properties/Settings.settings b/win/CS/HandBrake.ApplicationServices/Properties/Settings.settings
new file mode 100644 (file)
index 0000000..15034e7
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='utf-8'?>\r
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">\r
+  <Profiles>\r
+    <Profile Name="(Default)" />\r
+  </Profiles>\r
+</SettingsFile>\r
index c7a00dda59daab3527c5f11875835533299cf7c5..d64a4479ec064c372dee7a0bdfd81f170084e916 100644 (file)
@@ -60,7 +60,7 @@ namespace HandBrake.ApplicationServices.Services
         /// <summary>\r
         /// The Log File Header\r
         /// </summary>\r
-        StringBuilder header = UtilityService.CreateCliLogHeader(null);\r
+        StringBuilder header = GeneralUtilities.CreateCliLogHeader(null);\r
 \r
         #endregion\r
 \r
@@ -410,7 +410,7 @@ namespace HandBrake.ApplicationServices.Services
                 if (File.Exists(logFile2)) File.Delete(logFile2);\r
 \r
                 fileWriter = new StreamWriter(logFile) { AutoFlush = true };\r
-                fileWriter.WriteLine(UtilityService.CreateCliLogHeader(encodeQueueTask));\r
+                fileWriter.WriteLine(GeneralUtilities.CreateCliLogHeader(encodeQueueTask));\r
             }\r
             catch (Exception)\r
             {\r
index 091b4478ccc28c9c3219a3f82bcbb0783d53c91c..38dddd2d69028c0127e3411f0a0b668003ee9a05 100644 (file)
@@ -42,7 +42,7 @@ namespace HandBrake.ApplicationServices.Services
         /// <summary>\r
         /// The Log File Header\r
         /// </summary>\r
-        StringBuilder header = UtilityService.CreateCliLogHeader(null);\r
+        StringBuilder header = GeneralUtilities.CreateCliLogHeader(null);\r
 \r
         #endregion\r
 \r
@@ -223,7 +223,7 @@ namespace HandBrake.ApplicationServices.Services
                     // Only write the log file to disk if it's less than 100MB.\r
                     if (this.readData.Buffer.Length < 100000000)\r
                     {\r
-                        scanLog.WriteLine(UtilityService.CreateCliLogHeader(null));\r
+                        scanLog.WriteLine(GeneralUtilities.CreateCliLogHeader(null));\r
                         scanLog.Write(this.readData.Buffer);\r
                         logBuffer.AppendLine(this.readData.Buffer.ToString());\r
                     }\r
similarity index 96%
rename from win/CS/HandBrake.ApplicationServices/Utilities/UtilityService.cs
rename to win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
index 9485671385e796d6d4e647fdd151911665602321..3f56213e803a5c3bd0447d0d2b7b97b29ec4d4a7 100644 (file)
@@ -18,7 +18,7 @@ namespace HandBrake.ApplicationServices.Utilities
     /// <summary>\r
     /// A Set of Static Utilites\r
     /// </summary>\r
-    public class UtilityService\r
+    public class GeneralUtilities\r
     {\r
         /// <summary>\r
         /// The Default Log Directory\r
@@ -139,5 +139,6 @@ namespace HandBrake.ApplicationServices.Utilities
         {\r
             return string.Format("[{0}] {1}", DateTime.Now.TimeOfDay, message);\r
         }\r
+\r
     }\r
 }\r
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
new file mode 100644 (file)
index 0000000..d879afd
--- /dev/null
@@ -0,0 +1,210 @@
+/*  LanguageUtilities.cs $\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr/>.\r
+    It may be used under the terms of the GNU General Public License. */\r
+\r
+using System.Collections.Generic;\r
+\r
+namespace HandBrake.ApplicationServices.Utilities\r
+{\r
+    public class LanguageUtilities\r
+    {\r
+        /// <summary>\r
+        /// Map languages and their iso639_2 value into a IDictionary\r
+        /// </summary>\r
+        /// <returns>A Dictionary containing the language and iso code</returns>\r
+        public static IDictionary<string, string> MapLanguages()\r
+        {\r
+            IDictionary<string, string> languageMap = new Dictionary<string, string>\r
+                                                          {\r
+                                                              {"Any", "und"}, \r
+                                                              {"Afar", "aar"}, \r
+                                                              {"Abkhazian", "abk"}, \r
+                                                              {"Afrikaans", "afr"}, \r
+                                                              {"Akan", "aka"}, \r
+                                                              {"Albanian", "sqi"}, \r
+                                                              {"Amharic", "amh"}, \r
+                                                              {"Arabic", "ara"}, \r
+                                                              {"Aragonese", "arg"}, \r
+                                                              {"Armenian", "hye"}, \r
+                                                              {"Assamese", "asm"}, \r
+                                                              {"Avaric", "ava"}, \r
+                                                              {"Avestan", "ave"}, \r
+                                                              {"Aymara", "aym"}, \r
+                                                              {"Azerbaijani", "aze"}, \r
+                                                              {"Bashkir", "bak"}, \r
+                                                              {"Bambara", "bam"}, \r
+                                                              {"Basque", "eus"}, \r
+                                                              {"Belarusian", "bel"}, \r
+                                                              {"Bengali", "ben"}, \r
+                                                              {"Bihari", "bih"}, \r
+                                                              {"Bislama", "bis"}, \r
+                                                              {"Bosnian", "bos"}, \r
+                                                              {"Breton", "bre"}, \r
+                                                              {"Bulgarian", "bul"}, \r
+                                                              {"Burmese", "mya"}, \r
+                                                              {"Catalan", "cat"}, \r
+                                                              {"Chamorro", "cha"}, \r
+                                                              {"Chechen", "che"}, \r
+                                                              {"Chinese", "zho"}, \r
+                                                              {"Church Slavic", "chu"}, \r
+                                                              {"Chuvash", "chv"}, \r
+                                                              {"Cornish", "cor"}, \r
+                                                              {"Corsican", "cos"}, \r
+                                                              {"Cree", "cre"}, \r
+                                                              {"Czech", "ces"}, \r
+                                                              {"Dansk", "dan"}, \r
+                                                              {"Divehi", "div"}, \r
+                                                              {"Nederlands", "nld"}, \r
+                                                              {"Dzongkha", "dzo"}, \r
+                                                              {"English", "eng"}, \r
+                                                              {"Esperanto", "epo"}, \r
+                                                              {"Estonian", "est"}, \r
+                                                              {"Ewe", "ewe"}, \r
+                                                              {"Faroese", "fao"}, \r
+                                                              {"Fijian", "fij"}, \r
+                                                              {"Suomi", "fin"}, \r
+                                                              {"Francais", "fra"}, \r
+                                                              {"Western Frisian", "fry"}, \r
+                                                              {"Fulah", "ful"}, \r
+                                                              {"Georgian", "kat"}, \r
+                                                              {"Deutsch", "deu"}, \r
+                                                              {"Gaelic (Scots)", "gla"}, \r
+                                                              {"Irish", "gle"}, \r
+                                                              {"Galician", "glg"}, \r
+                                                              {"Manx", "glv"}, \r
+                                                              {"Greek Modern", "ell"}, \r
+                                                              {"Guarani", "grn"}, \r
+                                                              {"Gujarati", "guj"}, \r
+                                                              {"Haitian", "hat"}, \r
+                                                              {"Hausa", "hau"}, \r
+                                                              {"Hebrew", "heb"}, \r
+                                                              {"Herero", "her"}, \r
+                                                              {"Hindi", "hin"}, \r
+                                                              {"Hiri Motu", "hmo"}, \r
+                                                              {"Magyar", "hun"}, \r
+                                                              {"Igbo", "ibo"}, \r
+                                                              {"Islenska", "isl"}, \r
+                                                              {"Ido", "ido"}, \r
+                                                              {"Sichuan Yi", "iii"}, \r
+                                                              {"Inuktitut", "iku"}, \r
+                                                              {"Interlingue", "ile"}, \r
+                                                              {"Interlingua", "ina"}, \r
+                                                              {"Indonesian", "ind"}, \r
+                                                              {"Inupiaq", "ipk"}, \r
+                                                              {"Italiano", "ita"}, \r
+                                                              {"Javanese", "jav"}, \r
+                                                              {"Japanese", "jpn"}, \r
+                                                              {"Kalaallisut", "kal"}, \r
+                                                              {"Kannada", "kan"}, \r
+                                                              {"Kashmiri", "kas"}, \r
+                                                              {"Kanuri", "kau"}, \r
+                                                              {"Kazakh", "kaz"}, \r
+                                                              {"Central Khmer", "khm"}, \r
+                                                              {"Kikuyu", "kik"}, \r
+                                                              {"Kinyarwanda", "kin"}, \r
+                                                              {"Kirghiz", "kir"}, \r
+                                                              {"Komi", "kom"}, \r
+                                                              {"Kongo", "kon"}, \r
+                                                              {"Korean", "kor"}, \r
+                                                              {"Kuanyama", "kua"}, \r
+                                                              {"Kurdish", "kur"}, \r
+                                                              {"Lao", "lao"}, \r
+                                                              {"Latin", "lat"}, \r
+                                                              {"Latvian", "lav"}, \r
+                                                              {"Limburgan", "lim"}, \r
+                                                              {"Lingala", "lin"}, \r
+                                                              {"Lithuanian", "lit"}, \r
+                                                              {"Luxembourgish", "ltz"}, \r
+                                                              {"Luba-Katanga", "lub"}, \r
+                                                              {"Ganda", "lug"}, \r
+                                                              {"Macedonian", "mkd"}, \r
+                                                              {"Marshallese", "mah"}, \r
+                                                              {"Malayalam", "mal"}, \r
+                                                              {"Maori", "mri"}, \r
+                                                              {"Marathi", "mar"}, \r
+                                                              {"Malay", "msa"}, \r
+                                                              {"Malagasy", "mlg"}, \r
+                                                              {"Maltese", "mlt"}, \r
+                                                              {"Moldavian", "mol"}, \r
+                                                              {"Mongolian", "mon"}, \r
+                                                              {"Nauru", "nau"}, \r
+                                                              {"Navajo", "nav"}, \r
+                                                              {"Ndebele, South", "nbl"}, \r
+                                                              {"Ndebele, North", "nde"}, \r
+                                                              {"Ndonga", "ndo"}, \r
+                                                              {"Nepali", "nep"}, \r
+                                                              {"Norwegian Nynorsk", "nno"}, \r
+                                                              {"Norwegian Bokmål", "nob"}, \r
+                                                              {"Norsk", "nor"}, \r
+                                                              {"Chichewa; Nyanja", "nya"}, \r
+                                                              {"Occitan", "oci"}, \r
+                                                              {"Ojibwa", "oji"}, \r
+                                                              {"Oriya", "ori"}, \r
+                                                              {"Oromo", "orm"}, \r
+                                                              {"Ossetian", "oss"}, \r
+                                                              {"Panjabi", "pan"}, \r
+                                                              {"Persian", "fas"}, \r
+                                                              {"Pali", "pli"}, \r
+                                                              {"Polish", "pol"}, \r
+                                                              {"Portugues", "por"}, \r
+                                                              {"Pushto", "pus"}, \r
+                                                              {"Quechua", "que"}, \r
+                                                              {"Romansh", "roh"}, \r
+                                                              {"Romanian", "ron"}, \r
+                                                              {"Rundi", "run"}, \r
+                                                              {"Russian", "rus"}, \r
+                                                              {"Sango", "sag"}, \r
+                                                              {"Sanskrit", "san"}, \r
+                                                              {"Serbian", "srp"}, \r
+                                                              {"Hrvatski", "hrv"}, \r
+                                                              {"Sinhala", "sin"}, \r
+                                                              {"Slovak", "slk"}, \r
+                                                              {"Slovenian", "slv"}, \r
+                                                              {"Northern Sami", "sme"}, \r
+                                                              {"Samoan", "smo"}, \r
+                                                              {"Shona", "sna"}, \r
+                                                              {"Sindhi", "snd"}, \r
+                                                              {"Somali", "som"}, \r
+                                                              {"Sotho Southern", "sot"}, \r
+                                                              {"Espanol", "spa"}, \r
+                                                              {"Sardinian", "srd"}, \r
+                                                              {"Swati", "ssw"}, \r
+                                                              {"Sundanese", "sun"}, \r
+                                                              {"Swahili", "swa"}, \r
+                                                              {"Svenska", "swe"}, \r
+                                                              {"Tahitian", "tah"}, \r
+                                                              {"Tamil", "tam"}, \r
+                                                              {"Tatar", "tat"}, \r
+                                                              {"Telugu", "tel"}, \r
+                                                              {"Tajik", "tgk"}, \r
+                                                              {"Tagalog", "tgl"}, \r
+                                                              {"Thai", "tha"}, \r
+                                                              {"Tibetan", "bod"}, \r
+                                                              {"Tigrinya", "tir"}, \r
+                                                              {"Tonga", "ton"}, \r
+                                                              {"Tswana", "tsn"}, \r
+                                                              {"Tsonga", "tso"}, \r
+                                                              {"Turkmen", "tuk"}, \r
+                                                              {"Turkish", "tur"}, \r
+                                                              {"Twi", "twi"}, \r
+                                                              {"Uighur", "uig"}, \r
+                                                              {"Ukrainian", "ukr"}, \r
+                                                              {"Urdu", "urd"}, \r
+                                                              {"Uzbek", "uzb"}, \r
+                                                              {"Venda", "ven"}, \r
+                                                              {"Vietnamese", "vie"}, \r
+                                                              {"Volapük", "vol"}, \r
+                                                              {"Welsh", "cym"}, \r
+                                                              {"Walloon", "wln"}, \r
+                                                              {"Wolof", "wol"}, \r
+                                                              {"Xhosa", "xho"}, \r
+                                                              {"Yiddish", "yid"}, \r
+                                                              {"Yoruba", "yor"}, \r
+                                                              {"Zhuang", "zha"}, \r
+                                                              {"Zulu", "zul"}\r
+                                                          };\r
+            return languageMap;\r
+        }\r
+    }\r
+}\r
index 884c4a4f4893551b9996fccbe21c01f409ff4a2a..ff3594a65c416aeb0b795cca61b3a2a108288bfa 100644 (file)
@@ -91,7 +91,7 @@ namespace Handbrake
                 // We have a drive, selected as a folder.\r
                 if (this.sourcePath.EndsWith("\\"))\r
                 {\r
-                    drives = UtilityService.GetDrives();\r
+                    drives = GeneralUtilities.GetDrives();\r
                     foreach (DriveInformation item in drives)\r
                     {\r
                         if (item.RootDirectory.Contains(this.sourcePath))\r
@@ -152,7 +152,7 @@ namespace Handbrake
             // Clear the log files in the background\r
             if (Settings.Default.clearOldLogs)\r
             {\r
-                Thread clearLog = new Thread(() => UtilityService.ClearLogFiles(30));\r
+                Thread clearLog = new Thread(() => GeneralUtilities.ClearLogFiles(30));\r
                 clearLog.Start();\r
             }\r
 \r
@@ -1531,9 +1531,7 @@ namespace Handbrake
             }\r
 \r
             // Update the Duration\r
-            lbl_duration.Text =\r
-                Main.CalculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle)\r
-                    .ToString();\r
+            lbl_duration.Text = this.selectedTitle.CalculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex).ToString();\r
 \r
             // Run the Autonaming function\r
             if (Properties.Settings.Default.autoNaming)\r
@@ -2337,7 +2335,7 @@ namespace Handbrake
                     return;\r
                 }\r
 \r
-                drives = UtilityService.GetDrives();\r
+                drives = GeneralUtilities.GetDrives();\r
 \r
                 List<ToolStripMenuItem> menuItems = new List<ToolStripMenuItem>();\r
                 foreach (DriveInformation drive in drives)\r
index 7c95eac4054211443518aba5608c8189aae93d49..cbfafcd967f3eaf072514776dd09abdb2c801a76 100644 (file)
@@ -30,7 +30,7 @@ namespace Handbrake
             InitializeComponent();\r
             mainWindow = mw;\r
 \r
-            IDictionary<string, string> langList = Main.MapLanguages();\r
+            IDictionary<string, string> langList = LanguageUtilities.MapLanguages();\r
             foreach (string item in langList.Keys)\r
                 drop_preferredLang.Items.Add(item);\r
 \r
@@ -406,7 +406,7 @@ namespace Handbrake
                                                   MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);\r
             if (result == DialogResult.Yes)\r
             {\r
-                UtilityService.ClearLogFiles(0);\r
+                GeneralUtilities.ClearLogFiles(0);\r
                 MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK,\r
                                 MessageBoxIcon.Information);\r
             }\r
index a2bb55eb0d1742a6737160f2b0ba5c3387b8ceb2..11f831ae9ff28e86a47c2c10a27cfa5de660ef1e 100644 (file)
Binary files a/win/CS/libraries/HandBrakeInterop.dll and b/win/CS/libraries/HandBrakeInterop.dll differ
index b6340098bb63ad723a5e11f0824c9e794787ac71..8f4992168cd1806462ccb3b1bb1f1584e263e82b 100644 (file)
Binary files a/win/CS/libraries/Source/HandBrakeInteropSource.zip and b/win/CS/libraries/Source/HandBrakeInteropSource.zip differ