summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r--win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs (renamed from win/CS/HandBrake.ApplicationServices/UserSettingConstants.cs)6
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Parsing/Title.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs6
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs12
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs36
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs2
12 files changed, 50 insertions, 42 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/UserSettingConstants.cs b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
index 02ca9cb61..a7510b5fb 100644
--- a/win/CS/HandBrake.ApplicationServices/UserSettingConstants.cs
+++ b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
@@ -8,7 +8,7 @@ namespace HandBrake.ApplicationServices
/// <summary>
/// Constants for the User Settings Service
/// </summary>
- public class UserSettingConstants
+ public class ASUserSettingConstants
{
/// <summary>
/// The Verbosity
@@ -80,7 +80,6 @@ namespace HandBrake.ApplicationServices
/// </summary>
public const string HandBrakePlatform = "HandBrakePlatform";
-
/// <summary>
/// HandBrakes CLI Exe SHA1 Hash
/// </summary>
@@ -111,6 +110,9 @@ namespace HandBrake.ApplicationServices
/// </summary>
public const string SendFileToArgs = "SendFileToArgs";
+ /// <summary>
+ /// Min Title Scan Duration
+ /// </summary>
public const string MinScanDuration = "MinTitleScanDuration";
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 0c417c279..b1bfb7a19 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -145,7 +145,7 @@
<Compile Include="Services\ScanService.cs" />
<Compile Include="Services\UpdateService.cs" />
<Compile Include="Services\UserSettingService.cs" />
- <Compile Include="UserSettingConstants.cs" />
+ <Compile Include="ASUserSettingConstants.cs" />
<Compile Include="Utilities\AppcastReader.cs" />
<Compile Include="Utilities\GeneralUtilities.cs" />
<Compile Include="Utilities\LanguageUtilities.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
index 1453889ed..362a86a7e 100644
--- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
+++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
@@ -168,7 +168,7 @@ namespace HandBrake.ApplicationServices.Parsing
}
// Multi-Angle Support if LibDvdNav is enabled
- if (!userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav))
+ if (!userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
{
m = Regex.Match(nextLine, @" \+ angle\(s\) ([0-9])");
if (m.Success)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index 6ab0e52a8..f88e7a06e 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -214,17 +214,17 @@ namespace HandBrake.ApplicationServices.Services.Base
File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));
// Save a copy of the log file in the same location as the enocde.
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogWithVideo))
{
File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));
}
// Save a copy of the log file to a user specified location
- if (Directory.Exists(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory)) &&
- this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory))
+ if (Directory.Exists(this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory)) &&
+ this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogToCopyDirectory))
{
File.Copy(
- tempLogFile, Path.Combine(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory), encodeLogFile));
+ tempLogFile, Path.Combine(this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory), encodeLogFile));
}
}
catch (Exception)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 70f8f86ee..ade0f5e29 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -107,7 +107,7 @@ namespace HandBrake.ApplicationServices.Services
}
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))
{
Win32.PreventSleep();
}
@@ -121,7 +121,7 @@ namespace HandBrake.ApplicationServices.Services
RedirectStandardOutput = true,
RedirectStandardError = enableLogging ? true : false,
UseShellExecute = false,
- CreateNoWindow = !this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowCLI) ? true : false
+ CreateNoWindow = !this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ShowCLI) ? true : false
};
this.HbProcess = new Process { StartInfo = cliStart };
@@ -147,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services
}
// Set the Process Priority
- switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority))
+ switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))
{
case "Realtime":
this.HbProcess.PriorityClass = ProcessPriorityClass.RealTime;
@@ -258,7 +258,7 @@ namespace HandBrake.ApplicationServices.Services
this.WindowsSeven.SetTaskBarProgressToNoProgress();
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))
{
Win32.AllowSleep();
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index 7ee9a9df3..57f4b18fd 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -114,7 +114,7 @@ namespace HandBrake.ApplicationServices.Services
}
// Prvent the system from sleeping if the user asks
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep) )
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep) )
{
Win32.PreventSleep();
}
@@ -126,7 +126,7 @@ namespace HandBrake.ApplicationServices.Services
this.instance.StartEncode(encodeJob);
// Set the Process Priority
- switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority))
+ switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))
{
case "Realtime":
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
@@ -285,7 +285,7 @@ namespace HandBrake.ApplicationServices.Services
this.WindowsSeven.SetTaskBarProgressToNoProgress();
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))
{
Win32.AllowSleep();
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index b856577a9..d416624dc 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -262,7 +262,7 @@ namespace HandBrake.ApplicationServices.Services
Category = category,
Name = presetName[0].Replace("+", string.Empty).Trim(),
Query = presetName[2],
- Version = this.userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion),
+ Version = this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
CropSettings = pic,
Description = string.Empty, // Maybe one day we will populate this.
IsBuildIn = true
@@ -302,7 +302,7 @@ namespace HandBrake.ApplicationServices.Services
List<Preset> preset = this.presets.Where(p => p.IsBuildIn).ToList();
if (preset.Count > 0)
{
- if (preset[0].Version != this.userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion))
+ if (preset[0].Version != this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion))
{
this.UpdateBuiltInPresets();
return true;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index 478fa3661..91667debe 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -201,7 +201,7 @@ namespace HandBrake.ApplicationServices.Services
this.QueueManager.LastProcessedJob.Status = QueueItemStatus.Completed;
// Growl
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlEncode))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.GrowlEncode))
GrowlCommunicator.Notify("Encode Completed",
"Put down that cocktail...\nyour Handbrake encode is done.");
@@ -271,10 +271,10 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="file"> The file path</param>
private static void SendToApplication(string file)
{
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.SendFile) && !string.IsNullOrEmpty(userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo)))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SendFile) && !string.IsNullOrEmpty(userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileTo)))
{
- string args = string.Format("{0} \"{1}\"", userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs), file);
- ProcessStartInfo vlc = new ProcessStartInfo(userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo), args);
+ string args = string.Format("{0} \"{1}\"", userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileToArgs), file);
+ ProcessStartInfo vlc = new ProcessStartInfo(userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileTo), args);
Process.Start(vlc);
}
}
@@ -285,13 +285,13 @@ namespace HandBrake.ApplicationServices.Services
private static void Finish()
{
// Growl
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlQueue))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.GrowlQueue))
{
GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");
}
// Do something whent he encode ends.
- switch (userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction))
+ switch (userSettingService.GetUserSetting<string>(ASUserSettingConstants.WhenCompleteAction))
{
case "Shutdown":
Process.Start("Shutdown", "-s -t 60");
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index a9c9e07ce..26bfd582a 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -195,12 +195,12 @@ namespace HandBrake.ApplicationServices.Services
extraArguments += " --previews " + previewCount;
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
{
extraArguments += " --no-dvdnav";
}
- extraArguments += string.Format(" --min-duration={0}", this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration));
+ extraArguments += string.Format(" --min-duration={0}", this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration));
if (title > 0)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs
index 6a8584018..ace53f97f 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs
@@ -104,6 +104,12 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private void Save()
{
+ string directory = Path.GetDirectoryName(this.settingsFile);
+ if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+
using (FileStream strm = new FileStream(this.settingsFile, FileMode.Create, FileAccess.Write))
{
serializer.Serialize(strm, this.userSettings);
@@ -157,21 +163,21 @@ namespace HandBrake.ApplicationServices.Services
private void SetAllDefaults()
{
userSettings = new SerializableDictionary<string, object>();
- userSettings[UserSettingConstants.X264Step] = 0.25;
- userSettings[UserSettingConstants.Verbosity] = 1;
- userSettings[UserSettingConstants.WhenCompleteAction] = "Do Nothing";
- userSettings[UserSettingConstants.GrowlEncode] = false;
- userSettings[UserSettingConstants.GrowlQueue] = false;
- userSettings[UserSettingConstants.ProcessPriority] = "Below Normal";
- userSettings[UserSettingConstants.PreventSleep] = true;
- userSettings[UserSettingConstants.ShowCLI] = false;
- userSettings[UserSettingConstants.SaveLogToCopyDirectory] = false;
- userSettings[UserSettingConstants.SaveLogWithVideo] = false;
- userSettings[UserSettingConstants.DisableLibDvdNav] = false;
- userSettings[UserSettingConstants.SendFile] = false;
- userSettings[UserSettingConstants.MinScanDuration] = 10;
- userSettings[UserSettingConstants.HandBrakeBuild] = 0;
- userSettings[UserSettingConstants.HandBrakeVersion] = string.Empty;
+ userSettings[ASUserSettingConstants.X264Step] = 0.25;
+ userSettings[ASUserSettingConstants.Verbosity] = 1;
+ userSettings[ASUserSettingConstants.WhenCompleteAction] = "Do Nothing";
+ userSettings[ASUserSettingConstants.GrowlEncode] = false;
+ userSettings[ASUserSettingConstants.GrowlQueue] = false;
+ userSettings[ASUserSettingConstants.ProcessPriority] = "Below Normal";
+ userSettings[ASUserSettingConstants.PreventSleep] = true;
+ userSettings[ASUserSettingConstants.ShowCLI] = false;
+ userSettings[ASUserSettingConstants.SaveLogToCopyDirectory] = false;
+ userSettings[ASUserSettingConstants.SaveLogWithVideo] = false;
+ userSettings[ASUserSettingConstants.DisableLibDvdNav] = false;
+ userSettings[ASUserSettingConstants.SendFile] = false;
+ userSettings[ASUserSettingConstants.MinScanDuration] = 10;
+ userSettings[ASUserSettingConstants.HandBrakeBuild] = 0;
+ userSettings[ASUserSettingConstants.HandBrakeVersion] = string.Empty;
userSettings["updateStatus"] = true;
userSettings["tooltipEnable"] = true;
userSettings["defaultPreset"] = string.Empty;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
index b2187ed4b..99ecd5cd6 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
@@ -113,7 +113,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
StringBuilder logHeader = new StringBuilder();
- logHeader.AppendLine(String.Format("HandBrake {0} {1}", userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild)));
+ logHeader.AppendLine(String.Format("HandBrake {0} {1}", userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild)));
logHeader.AppendLine(String.Format("OS: {0}", Environment.OSVersion));
logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount));
logHeader.Append(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
index 392abc569..e0152489f 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
@@ -547,7 +547,7 @@ namespace HandBrake.ApplicationServices.Utilities
AddEncodeElement(xmlWriter, "PictureWidth", "integer", parsed.Width.ToString());
// Preset Information
- AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeBuild));
+ AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeBuild));
AddEncodeElement(xmlWriter, "PresetDescription", "string", "No Description");
AddEncodeElement(xmlWriter, "PresetName", "string", preset.Name);
AddEncodeElement(xmlWriter, "Type", "integer", "1"); // 1 is user preset, 0 is built in