OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 17 Jul 2010 22:33:00 +0000 (22:33 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 17 Jul 2010 22:33:00 +0000 (22:33 +0000)
- ApplicationServices dll no longer uses Settings.settings

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

win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/C#/HandBrake.ApplicationServices/Init.cs
win/C#/HandBrake.ApplicationServices/Parsing/Title.cs
win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs [deleted file]
win/C#/HandBrake.ApplicationServices/Properties/Settings.settings [deleted file]
win/C#/HandBrake.ApplicationServices/Services/Encode.cs
win/C#/HandBrake.ApplicationServices/Services/Queue.cs
win/C#/HandBrake.ApplicationServices/Services/Scan.cs

index bc6c04d..e6f54b9 100644 (file)
       <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\IQueue.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="app.config" />\r
-    <None Include="Properties\Settings.settings">\r
-      <Generator>SettingsSingleFileGenerator</Generator>\r
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>\r
-    </None>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <EmbeddedResource Include="frmExceptionWindow.resx">\r
index d279a0b..e8f2e18 100644 (file)
@@ -58,18 +58,16 @@ namespace HandBrake.ApplicationServices
         {\r
             InstanceId = instanceId;\r
             HandBrakeGuiVersionString = versionString;\r
-            Properties.Settings.Default.CompletionOption = completionOption;\r
-            Properties.Settings.Default.disableDvdNav = disableDvdNav;\r
-            Properties.Settings.Default.growlEncode = growlEncode;\r
-            Properties.Settings.Default.growlQueue = growlQueue;\r
-            Properties.Settings.Default.processPriority = processPriority;\r
-            Properties.Settings.Default.saveLogPath = saveLogPath;\r
-            Properties.Settings.Default.saveLogToSpecifiedPath = saveLogToSpecifiedPath;\r
-            Properties.Settings.Default.saveLogWithVideo = saveLogWithVideo;\r
-            Properties.Settings.Default.showCliForInGuiEncodeStatus = showCliForInGuiEncodeStatus;\r
-            Properties.Settings.Default.preventSleep = preventSleep;\r
-\r
-            Properties.Settings.Default.Save();\r
+            CompletionOption = completionOption;\r
+            DisableDvdNav = disableDvdNav;\r
+            GrowlEncode = growlEncode;\r
+            GrowlQueue = growlQueue;\r
+            ProcessPriority = processPriority;\r
+            SaveLogPath = saveLogPath;\r
+            SaveLogToSpecifiedPath = saveLogToSpecifiedPath;\r
+            SaveLogWithVideo = saveLogWithVideo;\r
+            ShowCliForInGuiEncodeStatus = showCliForInGuiEncodeStatus;\r
+            PreventSleep = preventSleep;\r
         }\r
 \r
         /// <summary>\r
@@ -92,5 +90,56 @@ namespace HandBrake.ApplicationServices
         /// The Applicaiton that uses this DLL can pass in it's version string.\r
         /// </summary>\r
         public static string HandBrakeGuiVersionString;\r
+\r
+        /// <summary>\r
+        /// What to do when the encode completes.\r
+        /// </summary>\r
+        public static string CompletionOption;\r
+\r
+        /// <summary>\r
+        /// Disable LibDvdNav\r
+        /// </summary>\r
+        public static bool DisableDvdNav;\r
+\r
+        /// <summary>\r
+        /// Growl when an encode has finished.\r
+        /// </summary>\r
+        public static bool GrowlEncode;\r
+\r
+        /// <summary>\r
+        /// Growl when a queue has finished.\r
+        /// </summary>\r
+        public static bool GrowlQueue;\r
+\r
+        /// <summary>\r
+        /// The Process Priority for HandBrakeCLI\r
+        /// </summary>\r
+        public static string ProcessPriority;\r
+\r
+        /// <summary>\r
+        /// Path to save log files to.\r
+        /// </summary>\r
+        public static string SaveLogPath;\r
+\r
+        /// <summary>\r
+        /// Copy log files to the SaveLogPath\r
+        /// </summary>\r
+        public static bool SaveLogToSpecifiedPath;\r
+\r
+        /// <summary>\r
+        /// Save a copy of the log files with the video\r
+        /// </summary>\r
+        public static bool SaveLogWithVideo;\r
+\r
+        /// <summary>\r
+        /// Show the CLI window when encoding.\r
+        /// </summary>\r
+        public static bool ShowCliForInGuiEncodeStatus;\r
+\r
+        /// <summary>\r
+        /// Prevent system sleep\r
+        /// </summary>\r
+        public static bool PreventSleep;\r
+\r
     }\r
 }\r
index d402ac9..4880143 100644 (file)
@@ -136,7 +136,7 @@ namespace HandBrake.ApplicationServices.Parsing
             if (m.Success)\r
                 thisTitle.SourceName = path.Replace("+ stream:", string.Empty).Trim();\r
 \r
-            if (!Properties.Settings.Default.disableDvdNav)\r
+            if (!Init.DisableDvdNav)\r
             {\r
                 // Get the Angles for the title.\r
                 m = Regex.Match(output.ReadLine(), @"  \+ angle\(s\) ([0-9])");\r
diff --git a/win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs b/win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs
deleted file mode 100644 (file)
index 42083c5..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-//------------------------------------------------------------------------------\r
-// <auto-generated>\r
-//     This code was generated by a tool.\r
-//     Runtime Version:2.0.50727.4927\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", "9.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
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool disableDvdNav {\r
-            get {\r
-                return ((bool)(this["disableDvdNav"]));\r
-            }\r
-            set {\r
-                this["disableDvdNav"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool saveLogWithVideo {\r
-            get {\r
-                return ((bool)(this["saveLogWithVideo"]));\r
-            }\r
-            set {\r
-                this["saveLogWithVideo"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("")]\r
-        public string saveLogPath {\r
-            get {\r
-                return ((string)(this["saveLogPath"]));\r
-            }\r
-            set {\r
-                this["saveLogPath"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool saveLogToSpecifiedPath {\r
-            get {\r
-                return ((bool)(this["saveLogToSpecifiedPath"]));\r
-            }\r
-            set {\r
-                this["saveLogToSpecifiedPath"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool growlQueue {\r
-            get {\r
-                return ((bool)(this["growlQueue"]));\r
-            }\r
-            set {\r
-                this["growlQueue"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("")]\r
-        public string CompletionOption {\r
-            get {\r
-                return ((string)(this["CompletionOption"]));\r
-            }\r
-            set {\r
-                this["CompletionOption"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("")]\r
-        public string processPriority {\r
-            get {\r
-                return ((string)(this["processPriority"]));\r
-            }\r
-            set {\r
-                this["processPriority"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool showCliForInGuiEncodeStatus {\r
-            get {\r
-                return ((bool)(this["showCliForInGuiEncodeStatus"]));\r
-            }\r
-            set {\r
-                this["showCliForInGuiEncodeStatus"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool growlEncode {\r
-            get {\r
-                return ((bool)(this["growlEncode"]));\r
-            }\r
-            set {\r
-                this["growlEncode"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool preventSleep {\r
-            get {\r
-                return ((bool)(this["preventSleep"]));\r
-            }\r
-            set {\r
-                this["preventSleep"] = value;\r
-            }\r
-        }\r
-    }\r
-}\r
diff --git a/win/C#/HandBrake.ApplicationServices/Properties/Settings.settings b/win/C#/HandBrake.ApplicationServices/Properties/Settings.settings
deleted file mode 100644 (file)
index 581684d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>\r
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="HandBrake.ApplicationServices.Properties" GeneratedClassName="Settings">\r
-  <Profiles />\r
-  <Settings>\r
-    <Setting Name="disableDvdNav" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
-    <Setting Name="saveLogWithVideo" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
-    <Setting Name="saveLogPath" Type="System.String" Scope="User">\r
-      <Value Profile="(Default)" />\r
-    </Setting>\r
-    <Setting Name="saveLogToSpecifiedPath" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
-    <Setting Name="growlQueue" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
-    <Setting Name="CompletionOption" Type="System.String" Scope="User">\r
-      <Value Profile="(Default)" />\r
-    </Setting>\r
-    <Setting Name="processPriority" Type="System.String" Scope="User">\r
-      <Value Profile="(Default)" />\r
-    </Setting>\r
-    <Setting Name="showCliForInGuiEncodeStatus" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
-    <Setting Name="growlEncode" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
-    <Setting Name="preventSleep" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
-  </Settings>\r
-</SettingsFile>
\ No newline at end of file
index c21d837..87b0e00 100644 (file)
@@ -152,7 +152,7 @@ namespace HandBrake.ApplicationServices.Services
                 if (enableLogging)\r
                     SetupLogging(encJob);\r
 \r
-                if (Settings.Default.preventSleep)\r
+                if (Init.PreventSleep)\r
                 {\r
                     Win32.PreventSleep();\r
                 }\r
@@ -163,7 +163,7 @@ namespace HandBrake.ApplicationServices.Services
                     RedirectStandardOutput = true,\r
                     RedirectStandardError = enableLogging ? true : false,\r
                     UseShellExecute = false,\r
-                    CreateNoWindow = !Settings.Default.showCliForInGuiEncodeStatus ? true : false\r
+                    CreateNoWindow = !Init.ShowCliForInGuiEncodeStatus ? true : false\r
                 };\r
 \r
                 this.HbProcess = Process.Start(cliStart);\r
@@ -185,7 +185,7 @@ namespace HandBrake.ApplicationServices.Services
                 }\r
 \r
                 // Set the Process Priority\r
-                switch (Settings.Default.processPriority)\r
+                switch (Init.ProcessPriority)\r
                 {\r
                     case "Realtime":\r
                         this.HbProcess.PriorityClass = ProcessPriorityClass.RealTime;\r
@@ -288,13 +288,13 @@ namespace HandBrake.ApplicationServices.Services
                 File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));\r
 \r
                 // Save a copy of the log file in the same location as the enocde.\r
-                if (Settings.Default.saveLogWithVideo)\r
+                if (Init.SaveLogWithVideo)\r
                     File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));\r
 \r
                 // Save a copy of the log file to a user specified location\r
-                if (Directory.Exists(Settings.Default.saveLogPath))\r
-                    if (Settings.Default.saveLogPath != String.Empty && Settings.Default.saveLogToSpecifiedPath)\r
-                        File.Copy(tempLogFile, Path.Combine(Settings.Default.saveLogPath, encodeLogFile));\r
+                if (Directory.Exists(Init.SaveLogPath))\r
+                    if (Init.SaveLogPath != String.Empty && Init.SaveLogToSpecifiedPath)\r
+                        File.Copy(tempLogFile, Path.Combine(Init.SaveLogPath, encodeLogFile));\r
             }\r
             catch (Exception exc)\r
             {\r
@@ -325,7 +325,7 @@ namespace HandBrake.ApplicationServices.Services
                 windowsSeven.SetTaskBarProgressToNoProgress();\r
             }\r
 \r
-            if (Properties.Settings.Default.preventSleep)\r
+            if (Init.PreventSleep)\r
             {\r
                 Win32.AllowSleep();\r
             }\r
index 7ba1d9d..59c084f 100644 (file)
@@ -403,7 +403,7 @@ namespace HandBrake.ApplicationServices.Services
                 HbProcess.Dispose();\r
 \r
                 // Growl\r
-                if (Properties.Settings.Default.growlEncode)\r
+                if (Init.GrowlEncode)\r
                     GrowlCommunicator.Notify("Encode Completed",\r
                                              "Put down that cocktail...\nyour Handbrake encode is done.");\r
 \r
@@ -427,11 +427,11 @@ namespace HandBrake.ApplicationServices.Services
         private void Finish()\r
         {\r
             // Growl\r
-            if (Settings.Default.growlQueue)\r
+            if (Init.GrowlQueue)\r
                 GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");\r
 \r
             // Do something whent he encode ends.\r
-            switch (Settings.Default.CompletionOption)\r
+            switch (Init.CompletionOption)\r
             {\r
                 case "Shutdown":\r
                     Process.Start("Shutdown", "-s -t 60");\r
index 04c35e3..da8d34f 100644 (file)
@@ -161,7 +161,7 @@ namespace HandBrake.ApplicationServices.Services
                     File.Delete(dvdInfoPath);\r
 \r
                 string extraArguments = string.Empty;\r
-                if (Properties.Settings.Default.disableDvdNav)\r
+                if (Init.DisableDvdNav)\r
                     extraArguments = " --no-dvdnav";\r
 \r
                 if (title > 0)\r