summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-01-22 18:02:19 +0000
committersr55 <[email protected]>2011-01-22 18:02:19 +0000
commitafcbfbd96a5536171ea640a67f6c14c907744894 (patch)
tree76215eeda5e80b5cbdc84f21ec8df7d1d2cedd67
parentc3940c57f907e79b07f575ba6105deefd517bab2 (diff)
WinGui:
- Refactored some more code out of the UI project into the Services Project. - Added support for showing bluray drives to the "Source" dropdown menu git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3764 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/C#/Functions/Main.cs66
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/Converters.cs44
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs2
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/Logging.cs52
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/Main.cs24
-rw-r--r--win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj8
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/DriveInformation.cs (renamed from win/C#/Model/DriveInformation.cs)9
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/EncodeTask.cs2
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/Anamorphic.cs7
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs7
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/Decomb.cs7
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/Deinterlace.cs10
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/Denoise.cs10
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/Detelecine.cs10
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs7
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/OutputFormat.cs7
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/PointToPointMode.cs7
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs2
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeMode.cs17
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeRateType.cs9
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs10
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/QueueTask.cs4
-rw-r--r--win/C#/HandBrake.ApplicationServices/Parsing/Title.cs10
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/Encode.cs4
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/ScanService.cs (renamed from win/C#/HandBrake.ApplicationServices/Services/Scan.cs)5
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/UtilityService.cs131
-rw-r--r--win/C#/HandBrake10.5.1.ReSharper1
-rw-r--r--win/C#/HandBrakeCS.csproj1
-rw-r--r--win/C#/frmMain.cs6
-rw-r--r--win/C#/frmOptions.cs3
30 files changed, 257 insertions, 225 deletions
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs
index d2d7ff5e5..578d2e8b0 100644
--- a/win/C#/Functions/Main.cs
+++ b/win/C#/Functions/Main.cs
@@ -472,46 +472,6 @@ namespace Handbrake.Functions
}
/// <summary>
- /// Clear all the encode log files.
- /// </summary>
- public static void ClearLogs()
- {
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
- if (Directory.Exists(logDir))
- {
- DirectoryInfo info = new DirectoryInfo(logDir);
- FileInfo[] logFiles = info.GetFiles("*.txt");
- foreach (FileInfo file in logFiles)
- {
- if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log"))
- File.Delete(file.FullName);
- }
- }
- }
-
- /// <summary>
- /// Clear old log files x days in the past
- /// </summary>
- public static void ClearOldLogs()
- {
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
- if (Directory.Exists(logDir))
- {
- DirectoryInfo info = new DirectoryInfo(logDir);
- FileInfo[] logFiles = info.GetFiles("*.txt");
-
- foreach (FileInfo file in logFiles)
- {
- if (file.LastWriteTime < DateTime.Now.AddDays(-30))
- {
- if (!file.Name.Contains("last_scan_log.txt") && !file.Name.Contains("last_encode_log.txt"))
- File.Delete(file.FullName);
- }
- }
- }
- }
-
- /// <summary>
/// Map languages and their iso639_2 value into a IDictionary
/// </summary>
/// <returns>A Dictionary containing the language and iso code</returns>
@@ -710,32 +670,6 @@ namespace Handbrake.Functions
}
/// <summary>
- /// Get a list of available DVD drives which are ready and contain DVD content.
- /// </summary>
- /// <returns>A List of Drives with their details</returns>
- public static List<DriveInformation> GetDrives()
- {
- List<DriveInformation> drives = new List<DriveInformation>();
- DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();
- int id = 0;
- foreach (DriveInfo curDrive in theCollectionOfDrives)
- {
- if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady &&
- File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))
- {
- drives.Add(new DriveInformation
- {
- Id = id,
- VolumeLabel = curDrive.VolumeLabel,
- RootDirectory = curDrive.RootDirectory + "VIDEO_TS"
- });
- id++;
- }
- }
- return drives;
- }
-
- /// <summary>
/// Change a string to Title Case/
/// </summary>
/// <param name="input">
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Converters.cs b/win/C#/HandBrake.ApplicationServices/Functions/Converters.cs
index c4ba59f14..84df3dac3 100644
--- a/win/C#/HandBrake.ApplicationServices/Functions/Converters.cs
+++ b/win/C#/HandBrake.ApplicationServices/Functions/Converters.cs
@@ -1,7 +1,11 @@
-namespace HandBrake.ApplicationServices.Functions
+/* Converters.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Functions
{
using System;
- using System.Collections.Generic;
using System.Text.RegularExpressions;
/// <summary>
@@ -30,41 +34,5 @@
return converted;
}
-
- /// <summary>
- /// Video Framerate Converter
- /// </summary>
- private static readonly Dictionary<double, int> vrates = new Dictionary<double, int>
- {
- {5, 5400000},
- {10, 2700000},
- {12, 2250000},
- {15, 1800000},
- {23.976, 1126125},
- {24, 1125000},
- {25, 1080000},
- {29.97, 900900}
- };
-
- /// <summary>
- /// Convert the desired framerate to the video rate.
- /// </summary>
- /// <param name="framerate">
- /// The framerate.
- /// </param>
- /// <returns>
- /// The Video Rate.
- /// </returns>
- /// <exception cref="ArgumentException">
- /// </exception>
- public static int FramerateToVrate(double framerate)
- {
- if (!vrates.ContainsKey(framerate))
- {
- throw new ArgumentException("Framerate not recognized.", "framerate");
- }
-
- return vrates[framerate];
- }
}
}
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs b/win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs
index 6cf7342a9..0bbc746d7 100644
--- a/win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs
+++ b/win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs
@@ -5,9 +5,9 @@
namespace HandBrake.ApplicationServices.Functions
{
+ using System;
using System.ComponentModel;
using System.Reflection;
- using System;
/// <summary>
/// Enum Helpers
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs b/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs
deleted file mode 100644
index 1bb08cdfb..000000000
--- a/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Logging.cs $
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
-
-namespace HandBrake.ApplicationServices.Functions
-{
- using System;
- using System.IO;
- using System.Text;
- using System.Windows.Forms;
-
- using HandBrake.ApplicationServices.Model;
-
- /// <summary>
- /// The System Information.
- /// </summary>
- public class Logging
- {
- /// <summary>
- /// Add the CLI Query to the Log File.
- /// </summary>
- /// <param name="encJob">
- /// The Encode Job Object
- /// </param>
- /// <returns>
- /// The create cli log header.
- /// </returns>
- public static string CreateCliLogHeader(QueueTask encJob)
- {
- StringBuilder logHeader = new StringBuilder();
-
- logHeader.AppendLine(String.Format("# {0}", Init.HandBrakeGuiVersionString));
- logHeader.AppendLine(String.Format("# Running: {0}", Environment.OSVersion));
- logHeader.AppendLine(String.Format("# CPU: {0}", SystemInfo.GetCpuCount));
- logHeader.AppendLine(String.Format("# Ram: {0} MB", SystemInfo.TotalPhysicalMemory));
- logHeader.AppendLine(String.Format("# Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
- logHeader.AppendLine(String.Format("# Temp Dir: {0}", Path.GetTempPath()));
- logHeader.AppendLine(String.Format("# Install Dir: {0}", Application.StartupPath));
- logHeader.AppendLine(String.Format("# Data Dir: {0}\n", Application.UserAppDataPath));
-
- if (encJob != null)
- {
- logHeader.AppendLine(String.Format("# CLI Query: {0}", encJob.Query));
- logHeader.AppendLine(String.Format("# User Query: {0}", encJob.CustomQuery));
- }
- logHeader.AppendLine("-------------------------------------------");
-
- return logHeader.ToString();
- }
- }
-} \ No newline at end of file
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Main.cs b/win/C#/HandBrake.ApplicationServices/Functions/Main.cs
deleted file mode 100644
index 368065dca..000000000
--- a/win/C#/HandBrake.ApplicationServices/Functions/Main.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Main.cs $
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
-
-namespace HandBrake.ApplicationServices.Functions
-{
- using System.Diagnostics;
-
- /// <summary>
- /// Useful functions which various screens can use.
- /// </summary>
- public static class Main
- {
- /// <summary>
- /// Get the Process ID of HandBrakeCLI for the current instance.
- /// </summary>
- /// <returns>A list of processes</returns>
- public static Process[] GetCliProcess()
- {
- return Process.GetProcessesByName("HandBrakeCLI");
- }
- }
-} \ No newline at end of file
diff --git a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 12b5bc624..57c3ca4ce 100644
--- a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -89,13 +89,12 @@
<Compile Include="EventArgs\ScanProgressEventArgs.cs" />
<Compile Include="Functions\Converters.cs" />
<Compile Include="Functions\EnumHelper.cs" />
- <Compile Include="Functions\Logging.cs" />
<Compile Include="Functions\GrowlCommunicator.cs" />
- <Compile Include="Functions\Main.cs" />
<Compile Include="Functions\System.cs" />
<Compile Include="Functions\Win32.cs" />
<Compile Include="Functions\Win7.cs" />
<Compile Include="Init.cs" />
+ <Compile Include="Model\DriveInformation.cs" />
<Compile Include="Model\Encoding\AudioTrack.cs" />
<Compile Include="Model\Encoding\Anamorphic.cs" />
<Compile Include="Model\Encoding\AudioEncoder.cs" />
@@ -110,7 +109,7 @@
<Compile Include="Model\Encoding\OutputFormat.cs" />
<Compile Include="Model\Encoding\SubtitleTrack.cs" />
<Compile Include="Model\Encoding\VideoEncoder.cs" />
- <Compile Include="Model\Encoding\VideoEncodeRateType.cs" />
+ <Compile Include="Model\Encoding\VideoEncodeMode.cs" />
<Compile Include="Model\QueueTask.cs" />
<Compile Include="Model\Encoding\SubtitleType.cs" />
<Compile Include="Parsing\AudioTrack.cs" />
@@ -133,7 +132,8 @@
<Compile Include="Services\LibScan.cs" />
<Compile Include="Services\QueueManager.cs" />
<Compile Include="Services\QueueProcessor.cs" />
- <Compile Include="Services\Scan.cs" />
+ <Compile Include="Services\ScanService.cs" />
+ <Compile Include="Services\UtilityService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
diff --git a/win/C#/Model/DriveInformation.cs b/win/C#/HandBrake.ApplicationServices/Model/DriveInformation.cs
index d7cef0ee5..65708cee2 100644
--- a/win/C#/Model/DriveInformation.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/DriveInformation.cs
@@ -3,7 +3,7 @@
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-namespace Handbrake.Model
+namespace HandBrake.ApplicationServices.Model
{
/// <summary>
/// Information about a DVD drive
@@ -26,6 +26,11 @@ namespace Handbrake.Model
public string RootDirectory { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether this is a BluRay Drive.
+ /// </summary>
+ public bool IsBluRay { get; set; }
+
+ /// <summary>
/// Returns "Drive" + Id (e.g Drive2)
/// </summary>
/// <returns>
@@ -33,7 +38,7 @@ namespace Handbrake.Model
/// </returns>
public override string ToString()
{
- return "Drive" + Id;
+ return "Drive" + this.Id;
}
}
} \ No newline at end of file
diff --git a/win/C#/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/C#/HandBrake.ApplicationServices/Model/EncodeTask.cs
index b10168aa5..dfc0fbf08 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/EncodeTask.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/EncodeTask.cs
@@ -200,7 +200,7 @@ namespace HandBrake.ApplicationServices.Model
/// <summary>
/// Gets or sets VideoEncodeRateType.
/// </summary>
- public VideoEncodeRateType VideoEncodeRateType { get; set; }
+ public VideoEncodeMode VideoEncodeRateType { get; set; }
/// <summary>
/// Gets or sets Quality.
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Anamorphic.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Anamorphic.cs
index b3b524cf9..c958b777c 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Anamorphic.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Anamorphic.cs
@@ -1,4 +1,9 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* Anamorphic.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
using System.ComponentModel;
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs
index d98b120bf..c6f838ed7 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/AudioEncoder.cs
@@ -1,4 +1,9 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* AudioEncoder.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
using System.ComponentModel;
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Decomb.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Decomb.cs
index c09c5b98e..ae8b8a3d4 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Decomb.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Decomb.cs
@@ -1,4 +1,9 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* Decomb.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
/// <summary>
/// Decomb Mode
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Deinterlace.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Deinterlace.cs
index 308b025a9..154428987 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Deinterlace.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Deinterlace.cs
@@ -1,5 +1,13 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* Deinterlace.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
+ /// <summary>
+ /// The Deinterlace Filter
+ /// </summary>
public enum Deinterlace
{
Off = 0,
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Denoise.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Denoise.cs
index 6698e775d..fc81e9f20 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Denoise.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Denoise.cs
@@ -1,5 +1,13 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* Denoise.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
+ /// <summary>
+ /// The Denose Filters
+ /// </summary>
public enum Denoise
{
Off = 0,
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Detelecine.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Detelecine.cs
index 19614971b..09c948dbd 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Detelecine.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Detelecine.cs
@@ -1,5 +1,13 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* Detelecine.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
+ /// <summary>
+ /// Detelecine Filter
+ /// </summary>
public enum Detelecine
{
Off = 0,
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs
index 373ee6b00..12611b454 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/Mixdown.cs
@@ -1,4 +1,9 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* Mixdown.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
using System.ComponentModel;
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/OutputFormat.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/OutputFormat.cs
index c5565914b..fa5c3225f 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/OutputFormat.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/OutputFormat.cs
@@ -1,4 +1,9 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* OutputFormat.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
using System.ComponentModel;
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/PointToPointMode.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/PointToPointMode.cs
index 8c58aa4cf..dcee4cac4 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/PointToPointMode.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/PointToPointMode.cs
@@ -1,4 +1,9 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* PointToPoint.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
/// <summary>
/// Point to Point Mode
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
index 5a3635689..f69abed7d 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
@@ -1,4 +1,4 @@
-/* Subtitle.cs $
+/* SubtitleTrack.cs $
This file is part of the HandBrake source code.
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeMode.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeMode.cs
new file mode 100644
index 000000000..cf42f3ca6
--- /dev/null
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeMode.cs
@@ -0,0 +1,17 @@
+/* VideoEncoderMode.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
+{
+ /// <summary>
+ /// The Mode of Video Encoding. Bitrate, Filesize or Quality
+ /// </summary>
+ public enum VideoEncodeMode
+ {
+ TargetSize = 0,
+ AverageBitrate,
+ ConstantQuality
+ }
+}
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeRateType.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeRateType.cs
deleted file mode 100644
index b128fdbc4..000000000
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncodeRateType.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
-{
- public enum VideoEncodeRateType
- {
- TargetSize = 0,
- AverageBitrate,
- ConstantQuality
- }
-}
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs b/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs
index 4eddbf44b..b5a2556e3 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs
@@ -1,7 +1,15 @@
-namespace HandBrake.ApplicationServices.Model.Encoding
+/* VideoEncoder.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
{
using System.ComponentModel;
+ /// <summary>
+ /// The Video Encoder
+ /// </summary>
public enum VideoEncoder
{
[Description("H.264 (x264)")]
diff --git a/win/C#/HandBrake.ApplicationServices/Model/QueueTask.cs b/win/C#/HandBrake.ApplicationServices/Model/QueueTask.cs
index 9f92ec609..83948a1f3 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/QueueTask.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/QueueTask.cs
@@ -1,4 +1,4 @@
-/* QueueItem.cs $
+/* QueueTask.cs $
This file is part of the HandBrake source code.
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
@@ -6,7 +6,7 @@
namespace HandBrake.ApplicationServices.Model
{
/// <summary>
- /// The job.
+ /// The QueueTask.
/// </summary>
public class QueueTask
{
diff --git a/win/C#/HandBrake.ApplicationServices/Parsing/Title.cs b/win/C#/HandBrake.ApplicationServices/Parsing/Title.cs
index e7266207f..3a9e6a56a 100644
--- a/win/C#/HandBrake.ApplicationServices/Parsing/Title.cs
+++ b/win/C#/HandBrake.ApplicationServices/Parsing/Title.cs
@@ -30,9 +30,9 @@ namespace HandBrake.ApplicationServices.Parsing
/// </summary>
public Title()
{
- AudioTracks = new List<AudioTrack>();
- Chapters = new List<Chapter>();
- Subtitles = new List<Subtitle>();
+ this.AudioTracks = new List<AudioTrack>();
+ this.Chapters = new List<Chapter>();
+ this.Subtitles = new List<Subtitle>();
}
#region Properties
@@ -112,8 +112,8 @@ namespace HandBrake.ApplicationServices.Parsing
/// <summary>
/// Parse the Title Information
/// </summary>
- /// <param name="output">A stingreader of output data</param>
- /// <returns>A Title</returns>
+ /// <param name="output">A StringReader of output data</param>
+ /// <returns>A Title Object</returns>
public static Title Parse(StringReader output)
{
var thisTitle = new Title();
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
index bc5220e1e..9d3f7bb2e 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
@@ -446,8 +446,8 @@ namespace HandBrake.ApplicationServices.Services
fileWriter = new StreamWriter(logFile) { AutoFlush = true };
- fileWriter.WriteLine(Logging.CreateCliLogHeader(encodeQueueTask));
- logBuffer.AppendLine(Logging.CreateCliLogHeader(encodeQueueTask));
+ fileWriter.WriteLine(UtilityService.CreateCliLogHeader(encodeQueueTask));
+ logBuffer.AppendLine(UtilityService.CreateCliLogHeader(encodeQueueTask));
}
catch (Exception)
{
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs b/win/C#/HandBrake.ApplicationServices/Services/ScanService.cs
index d6925b304..9b85740cd 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -13,7 +13,6 @@ namespace HandBrake.ApplicationServices.Services
using System.Windows.Forms;
using HandBrake.ApplicationServices.EventArgs;
- using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -236,7 +235,7 @@ namespace HandBrake.ApplicationServices.Services
// Only write the log file to disk if it's less than 100MB.
if (this.readData.Buffer.Length < 100000000)
{
- scanLog.WriteLine(Logging.CreateCliLogHeader(null));
+ scanLog.WriteLine(UtilityService.CreateCliLogHeader(null));
scanLog.Write(this.readData.Buffer);
logBuffer.AppendLine(this.readData.Buffer.ToString());
}
@@ -327,7 +326,7 @@ namespace HandBrake.ApplicationServices.Services
logFilePosition = 0;
logBuffer = new StringBuilder();
if (addHeader)
- logBuffer.AppendLine(Logging.CreateCliLogHeader(null));
+ logBuffer.AppendLine(UtilityService.CreateCliLogHeader(null));
}
/// <summary>
diff --git a/win/C#/HandBrake.ApplicationServices/Services/UtilityService.cs b/win/C#/HandBrake.ApplicationServices/Services/UtilityService.cs
new file mode 100644
index 000000000..b705cb8e1
--- /dev/null
+++ b/win/C#/HandBrake.ApplicationServices/Services/UtilityService.cs
@@ -0,0 +1,131 @@
+/* UtilityService.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Services
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Text;
+ using System.Windows.Forms;
+
+ using HandBrake.ApplicationServices.Functions;
+ using HandBrake.ApplicationServices.Model;
+
+ /// <summary>
+ /// A Set of Static Utilites
+ /// </summary>
+ public class UtilityService
+ {
+ /// <summary>
+ /// The Default Log Directory
+ /// </summary>
+ private static readonly string LogDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+
+ /// <summary>
+ /// Clear all the log files older than 30 Days
+ /// </summary>
+ /// <param name="daysToKeep">
+ /// The Number of Days to Keep
+ /// </param>
+ public static void ClearLogFiles(int daysToKeep)
+ {
+ if (Directory.Exists(LogDir))
+ {
+ // Get all the log files
+ DirectoryInfo info = new DirectoryInfo(LogDir);
+ FileInfo[] logFiles = info.GetFiles("*.txt");
+
+ // Delete Them
+ foreach (FileInfo file in logFiles)
+ {
+ if (file.LastWriteTime < DateTime.Now.AddDays(-daysToKeep))
+ {
+ if (!file.Name.Contains("last_scan_log.txt") && !file.Name.Contains("last_encode_log.txt"))
+ {
+ File.Delete(file.FullName);
+ }
+ else if (file.Length > 104857600)
+ {
+ File.Delete(file.FullName);
+ }
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Get a list of available DVD drives which are ready and contain DVD content.
+ /// </summary>
+ /// <returns>A List of Drives with their details</returns>
+ public static List<DriveInformation> GetDrives()
+ {
+ List<DriveInformation> drives = new List<DriveInformation>();
+ DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();
+ int id = 0;
+ foreach (DriveInfo curDrive in theCollectionOfDrives)
+ {
+ if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady)
+ {
+ if (Directory.Exists(curDrive.RootDirectory + "VIDEO_TS") || Directory.Exists(curDrive.RootDirectory + "BDMV"))
+ {
+ drives.Add(
+ new DriveInformation
+ {
+ Id = id,
+ VolumeLabel = curDrive.VolumeLabel,
+ RootDirectory = curDrive.RootDirectory.ToString()
+ });
+ id++;
+ }
+ }
+ }
+
+ return drives;
+ }
+
+ /// <summary>
+ /// Get the Process ID of HandBrakeCLI for the current instance.
+ /// </summary>
+ /// <returns>A list of processes</returns>
+ public static Process[] GetCliProcess()
+ {
+ return Process.GetProcessesByName("HandBrakeCLI");
+ }
+
+ /// <summary>
+ /// Add the CLI Query to the Log File.
+ /// </summary>
+ /// <param name="encJob">
+ /// The Encode Job Object
+ /// </param>
+ /// <returns>
+ /// The create cli log header.
+ /// </returns>
+ public static string CreateCliLogHeader(QueueTask encJob)
+ {
+ StringBuilder logHeader = new StringBuilder();
+
+ logHeader.AppendLine(String.Format("# {0}", Init.HandBrakeGuiVersionString));
+ logHeader.AppendLine(String.Format("# Running: {0}", Environment.OSVersion));
+ logHeader.AppendLine(String.Format("# CPU: {0}", SystemInfo.GetCpuCount));
+ logHeader.AppendLine(String.Format("# Ram: {0} MB", SystemInfo.TotalPhysicalMemory));
+ logHeader.AppendLine(String.Format("# Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
+ logHeader.AppendLine(String.Format("# Temp Dir: {0}", Path.GetTempPath()));
+ logHeader.AppendLine(String.Format("# Install Dir: {0}", Application.StartupPath));
+ logHeader.AppendLine(String.Format("# Data Dir: {0}\n", Application.UserAppDataPath));
+
+ if (encJob != null)
+ {
+ logHeader.AppendLine(String.Format("# CLI Query: {0}", encJob.Query));
+ logHeader.AppendLine(String.Format("# User Query: {0}", encJob.CustomQuery));
+ }
+ logHeader.AppendLine("-------------------------------------------");
+
+ return logHeader.ToString();
+ }
+ }
+}
diff --git a/win/C#/HandBrake10.5.1.ReSharper b/win/C#/HandBrake10.5.1.ReSharper
index 9d75ad0d1..70de4715c 100644
--- a/win/C#/HandBrake10.5.1.ReSharper
+++ b/win/C#/HandBrake10.5.1.ReSharper
@@ -88,6 +88,7 @@
<Abbreviation Text="SRT" />
<Abbreviation Text="CLI" />
<Abbreviation Text="MP" />
+ <Abbreviation Text="II" />
</Naming2>
<CustomMemberReorderingPatterns><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj
index a8471102f..0eb720f83 100644
--- a/win/C#/HandBrakeCS.csproj
+++ b/win/C#/HandBrakeCS.csproj
@@ -255,7 +255,6 @@
<Compile Include="frmActivityWindow.Designer.cs">
<DependentUpon>frmActivityWindow.cs</DependentUpon>
</Compile>
- <Compile Include="Model\DriveInformation.cs" />
<Compile Include="Model\SourceType.cs" />
<Compile Include="Presets\PlistPresetHandler.cs" />
<Compile Include="Presets\Preset.cs" />
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index fa85b4763..b4feee8f2 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -88,7 +88,7 @@ namespace Handbrake
// We have a drive, selected as a folder.
if (this.sourcePath.EndsWith("\\"))
{
- drives = Main.GetDrives();
+ drives = UtilityService.GetDrives();
foreach (DriveInformation item in drives)
{
if (item.RootDirectory.Contains(this.sourcePath))
@@ -148,7 +148,7 @@ namespace Handbrake
// Clear the log files in the background
if (Settings.Default.clearOldLogs)
{
- Thread clearLog = new Thread(Main.ClearOldLogs);
+ Thread clearLog = new Thread(() => UtilityService.ClearLogFiles(30));
clearLog.Start();
}
@@ -2470,7 +2470,7 @@ namespace Handbrake
return;
}
- drives = Main.GetDrives();
+ drives = UtilityService.GetDrives();
List<ToolStripMenuItem> menuItems = new List<ToolStripMenuItem>();
foreach (DriveInformation drive in drives)
diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs
index 11034f9a3..89c5aaee1 100644
--- a/win/C#/frmOptions.cs
+++ b/win/C#/frmOptions.cs
@@ -12,6 +12,7 @@ namespace Handbrake
using System.Windows.Forms;
using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services;
using Handbrake.Functions;
using Handbrake.Model;
@@ -406,7 +407,7 @@ namespace Handbrake
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
- Main.ClearLogs();
+ UtilityService.ClearLogFiles(30);
MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}