}\r
}\r
\r
+ /// <summary>\r
+ /// Set all subtitle tracks so that they have no default.\r
+ /// </summary>\r
private void SetNoSrtDefault()\r
{\r
int c = 0;\r
foreach (ListViewItem item in lv_subList.Items)\r
{\r
- if (subList[c].SrtPath != "-")\r
+ if (!subList[c].IsSrtSubtitle)\r
{\r
if (item.SubItems[3].Text == "Yes")\r
{\r
/* RssReader.cs $\r
- \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;\r
-using System.Xml;\r
-using System.Text.RegularExpressions;\r
-using System.IO;\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.Functions\r
{\r
+ using System;\r
+ using System.IO;\r
+ using System.Text.RegularExpressions;\r
+ using System.Xml;\r
+\r
+ /// <summary>\r
+ /// Appcast Reader - Used for parsing HandBrakes update file\r
+ /// </summary>\r
public class AppcastReader\r
{\r
/// <summary>\r
+ /// Gets Information about an update to HandBrake\r
+ /// </summary>\r
+ public Uri DescriptionUrl { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets HandBrake's version from the appcast.xml file.\r
+ /// </summary>\r
+ public string Version { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets HandBrake's Build from the appcast.xml file.\r
+ /// </summary>\r
+ public string Build { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the URL for update file.\r
+ /// </summary>\r
+ public string DownloadFile { get; private set; }\r
+\r
+ /// <summary>\r
/// Get the build information from the required appcasts. Run before accessing the public vars.\r
/// </summary>\r
+ /// <param name="input">\r
+ /// The input.\r
+ /// </param>\r
public void GetInfo(string input)\r
{\r
try\r
{\r
// Get the correct Appcast and set input.\r
- XmlNode nodeItem = readRss(new XmlTextReader(new StringReader(input)));\r
+ XmlNode nodeItem = ReadRss(new XmlTextReader(new StringReader(input)));\r
string result = nodeItem.InnerXml;\r
\r
// Regular Expressions\r
Match ver = Regex.Match(result, @"sparkle:version=""([0-9]*)\""");\r
Match verShort = Regex.Match(result, @"sparkle:shortVersionString=""(([svn]*)([0-9.\s]*))\""");\r
\r
- Build = ver.ToString().Replace("sparkle:version=", "").Replace("\"", "");\r
- Version = verShort.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", "");\r
- DownloadFile = nodeItem["windows"].InnerText;\r
- DescriptionUrl = new Uri(nodeItem["sparkle:releaseNotesLink"].InnerText);\r
- } \r
- catch( Exception)\r
+ this.Build = ver.ToString().Replace("sparkle:version=", string.Empty).Replace("\"", string.Empty);\r
+ this.Version = verShort.ToString().Replace("sparkle:shortVersionString=", string.Empty).Replace("\"", string.Empty);\r
+ this.DownloadFile = nodeItem["windows"].InnerText;\r
+ this.DescriptionUrl = new Uri(nodeItem["sparkle:releaseNotesLink"].InnerText);\r
+ }\r
+ catch (Exception)\r
{\r
return;\r
}\r
/// <summary>\r
/// Read the RSS file.\r
/// </summary>\r
- /// <param name="rssReader"></param>\r
- private static XmlNode readRss(XmlReader rssReader)\r
+ /// <param name="rssReader">\r
+ /// The RSS reader\r
+ /// </param>\r
+ /// <returns>\r
+ /// The read rss.\r
+ /// </returns>\r
+ private static XmlNode ReadRss(XmlReader rssReader)\r
{\r
XmlNode nodeItem = null;\r
XmlNode nodeChannel = null;\r
foreach (XmlNode t in rssDoc.ChildNodes)\r
{\r
if (t.Name == "rss")\r
+ {\r
nodeRss = t;\r
+ }\r
}\r
\r
if (nodeRss != null)\r
+ {\r
foreach (XmlNode t in nodeRss.ChildNodes)\r
{\r
if (t.Name == "channel")\r
+ {\r
nodeChannel = t;\r
+ }\r
}\r
+ }\r
\r
if (nodeChannel != null)\r
+ {\r
foreach (XmlNode t in nodeChannel.ChildNodes)\r
{\r
if (t.Name == "item")\r
+ {\r
nodeItem = t;\r
+ }\r
}\r
+ }\r
\r
return nodeItem;\r
}\r
-\r
- /// <summary>\r
- /// Get Information about an update to HandBrake\r
- /// </summary>\r
- public Uri DescriptionUrl { get; set; }\r
-\r
- /// <summary>\r
- /// Get HandBrake's version from the appcast.xml file.\r
- /// </summary>\r
- public string Version { get; set; }\r
-\r
- /// <summary>\r
- /// Get HandBrake's Build from the appcast.xml file.\r
- /// </summary>\r
- public string Build { get; set; }\r
-\r
- /// <summary>\r
- /// Get's the URL for update file.\r
- /// </summary>\r
- public string DownloadFile { get; set; }\r
}\r
}
\ No newline at end of file
/* GrowlCommunicator.cs $\r
- \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;\r
-using System.Collections.Generic;\r
-using System.Text;\r
-using Growl.Connector;\r
-using Growl.CoreLibrary;\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.Functions\r
{\r
+ using System;\r
+ using System.Collections.Generic;\r
+ using System.Text;\r
+ using Growl.Connector;\r
+ using Growl.CoreLibrary;\r
+\r
/// <summary>\r
/// Provides all functionality for communicating with Growl for Windows.\r
/// </summary>\r
/// <summary>\r
/// Notification shown upon completion of encoding\r
/// </summary>\r
- public static NotificationType EncodeOrQueueCompleted = new NotificationType("EncodeOrQueue", "HandBrake Status");\r
+ private static NotificationType encodeOrQueueCompleted = new NotificationType("EncodeOrQueue", "HandBrake Status");\r
\r
/// <summary>\r
/// Checks to see if Growl is currently running on the local machine.\r
public static void Register()\r
{\r
Initialize();\r
- growl.Register(application, new NotificationType[] { EncodeOrQueueCompleted });\r
+ growl.Register(application, new NotificationType[] { encodeOrQueueCompleted });\r
}\r
\r
/// <summary>\r
/// Sends a notification to Growl. (Since Handbrake currently only supports one type of notification with\r
/// static text, this is a shortcut method).\r
/// </summary>\r
+ /// <param name="title">\r
+ /// The title.\r
+ /// </param>\r
+ /// <param name="text">\r
+ /// The text to display.\r
+ /// </param>\r
public static void Notify(string title, string text)\r
{\r
- Notification notification = new Notification(application.Name, EncodeOrQueueCompleted.Name, String.Empty, title, text);\r
+ Notification notification = new Notification(application.Name, encodeOrQueueCompleted.Name, String.Empty, title, text);\r
growl.Notify(notification);\r
}\r
\r
/// <param name="imageUrl">The notification image as a url</param>\r
public static void Notify(NotificationType notificationType, string title, string text, string imageUrl)\r
{\r
- Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title, text);\r
- notification.Icon = imageUrl;\r
+ Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title, text)\r
+ {\r
+ Icon = imageUrl\r
+ };\r
\r
growl.Notify(notification);\r
}\r
{\r
if (growl == null)\r
{\r
- growl = new GrowlConnector();\r
- growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;\r
+ growl = new GrowlConnector\r
+ {\r
+ EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText\r
+ };\r
\r
- application = new Application("Handbrake");\r
- application.Icon = global::Handbrake.Properties.Resources.logo64;\r
+ application = new Application("Handbrake")\r
+ {\r
+ Icon = Properties.Resources.logo64\r
+ };\r
}\r
}\r
}\r
/* Main.cs $\r
- \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;\r
-using System.Windows.Forms;\r
-using System.IO;\r
-using System.Diagnostics;\r
-using System.Text.RegularExpressions;\r
-using System.Collections.Generic;\r
-using System.Xml.Serialization;\r
-using System.Threading;\r
-using Handbrake.EncodeQueue;\r
-using System.Net;\r
-using Handbrake.Model;\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.Functions\r
{\r
- static class Main\r
+ using System;\r
+ using System.Collections.Generic;\r
+ using System.Diagnostics;\r
+ using System.IO;\r
+ using System.Net;\r
+ using System.Text.RegularExpressions;\r
+ using System.Threading;\r
+ using System.Windows.Forms;\r
+ using System.Xml.Serialization;\r
+ using EncodeQueue;\r
+ using Model;\r
+\r
+ /// <summary>\r
+ /// Useful functions which various screens can use.\r
+ /// </summary>\r
+ public static class Main\r
{\r
- // Private Variables\r
+ /// <summary>\r
+ /// The XML Serializer\r
+ /// </summary>\r
private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Job>));\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, Parsing.Title selectedTitle)\r
{\r
TimeSpan duration = TimeSpan.FromSeconds(0.0);\r
- chapterStart++; chapterEnd++;\r
+ chapterStart++;\r
+ chapterEnd++;\r
if (chapterStart != 0 && chapterEnd != 0 && chapterEnd <= selectedTitle.Chapters.Count)\r
{\r
for (int i = chapterStart; i <= chapterEnd; i++)\r
/// <summary>\r
/// Select the longest title in the DVD title dropdown menu on frmMain\r
/// </summary>\r
- public static Parsing.Title SelectLongestTitle(Parsing.DVD thisDvd)\r
+ /// <param name="source">\r
+ /// The Source.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The longest title.\r
+ /// </returns>\r
+ public static Parsing.Title SelectLongestTitle(Parsing.DVD source)\r
{\r
TimeSpan longestDurationFound = TimeSpan.FromSeconds(0.0);\r
Parsing.Title returnTitle = null;\r
\r
- foreach (Parsing.Title item in thisDvd.Titles)\r
+ foreach (Parsing.Title item in source.Titles)\r
{\r
if (item.Duration > longestDurationFound)\r
{\r
/// <summary>\r
/// Set's up the DataGridView on the Chapters tab (frmMain)\r
/// </summary>\r
+ /// <param name="dataChpt">\r
+ /// The DataGridView Control\r
+ /// </param>\r
+ /// <param name="chapterEnd">\r
+ /// The chapter End.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The chapter naming.\r
+ /// </returns>\r
public static DataGridView ChapterNaming(DataGridView dataChpt, string chapterEnd)\r
{\r
int i = 0, finish = 0;\r
while (i < finish)\r
{\r
int n = dataChpt.Rows.Add();\r
- dataChpt.Rows[n].Cells[0].Value = (i + 1);\r
+ dataChpt.Rows[n].Cells[0].Value = i + 1;\r
dataChpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);\r
dataChpt.Rows[n].Cells[0].ValueType = typeof(int);\r
dataChpt.Rows[n].Cells[1].ValueType = typeof(string);\r
/// <summary>\r
/// Import a CSV file which contains Chapter Names\r
/// </summary>\r
- /// <param name="dataChpt"></param>\r
- /// <param name="filename"></param>\r
- /// <returns></returns>\r
+ /// <param name="dataChpt">\r
+ /// The DataGridView Control\r
+ /// </param>\r
+ /// <param name="filename">\r
+ /// The filepath and name\r
+ /// </param>\r
+ /// <returns>A Populated DataGridView</returns>\r
public static DataGridView ImportChapterNames(DataGridView dataChpt, string filename)\r
{\r
IDictionary<int, string> chapterMap = new Dictionary<int, string>();\r
string csv = sr.ReadLine();\r
while (csv != null)\r
{\r
- if (csv.Trim() != "")\r
+ if (csv.Trim() != string.Empty)\r
{\r
csv = csv.Replace("\\,", "<!comma!>");\r
string[] contents = csv.Split(',');\r
/// Function which generates the filename and path automatically based on \r
/// the Source Name, DVD title and DVD Chapters\r
/// </summary>\r
+ /// <param name="mainWindow">\r
+ /// The main Window.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The Generated FileName\r
+ /// </returns>\r
public static string AutoName(frmMain mainWindow)\r
{\r
- string AutoNamePath = string.Empty;\r
+ string autoNamePath = string.Empty;\r
if (mainWindow.drp_dvdtitle.Text != "Automatic")\r
{\r
// Get the Source Name \r
\r
// Get the Selected Title Number\r
string[] titlesplit = mainWindow.drp_dvdtitle.Text.Split(' ');\r
- string dvdTitle = titlesplit[0].Replace("Automatic", "");\r
+ string dvdTitle = titlesplit[0].Replace("Automatic", string.Empty);\r
\r
// Get the Chapter Start and Chapter End Numbers\r
- string chapterStart = mainWindow.drop_chapterStart.Text.Replace("Auto", "");\r
- string chapterFinish = mainWindow.drop_chapterFinish.Text.Replace("Auto", "");\r
+ string chapterStart = mainWindow.drop_chapterStart.Text.Replace("Auto", string.Empty);\r
+ string chapterFinish = mainWindow.drop_chapterFinish.Text.Replace("Auto", string.Empty);\r
string combinedChapterTag = chapterStart;\r
- if (chapterFinish != chapterStart && chapterFinish != "")\r
+ if (chapterFinish != chapterStart && chapterFinish != string.Empty)\r
combinedChapterTag = chapterStart + "-" + chapterFinish;\r
\r
// Get the destination filename.\r
string destinationFilename;\r
- if (Properties.Settings.Default.autoNameFormat != "")\r
+ if (Properties.Settings.Default.autoNameFormat != string.Empty)\r
{\r
destinationFilename = Properties.Settings.Default.autoNameFormat;\r
destinationFilename = destinationFilename.Replace("{source}", sourceName).Replace("{title}", dvdTitle).Replace("{chapters}", combinedChapterTag);\r
if (!mainWindow.text_destination.Text.Contains(Path.DirectorySeparatorChar.ToString()))\r
{\r
// If there is an auto name path, use it...\r
- if (Properties.Settings.Default.autoNamePath.Trim() != "" && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")\r
- AutoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destinationFilename);\r
+ if (Properties.Settings.Default.autoNamePath.Trim() != string.Empty && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")\r
+ autoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destinationFilename);\r
else // ...otherwise, output to the source directory\r
- AutoNamePath = null;\r
+ autoNamePath = null;\r
}\r
else // Otherwise, use the path that is already there.\r
{\r
// Use the path and change the file extension to match the previous destination\r
- AutoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.text_destination.Text), destinationFilename);\r
+ autoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.text_destination.Text), destinationFilename);\r
\r
if (Path.HasExtension(mainWindow.text_destination.Text))\r
- AutoNamePath = Path.ChangeExtension(AutoNamePath, Path.GetExtension(mainWindow.text_destination.Text));\r
+ autoNamePath = Path.ChangeExtension(autoNamePath, Path.GetExtension(mainWindow.text_destination.Text));\r
}\r
}\r
\r
- return AutoNamePath;\r
+ return autoNamePath;\r
}\r
\r
/// <summary>\r
/// Get's HandBrakes version data from the CLI.\r
/// </summary>\r
- /// <returns>Arraylist of Version Data. 0 = hb_version 1 = hb_build</returns>\r
public static void SetCliVersionData()\r
{\r
- String line;\r
+ string line;\r
\r
// 0 = SVN Build / Version\r
// 1 = Build Date\r
-\r
DateTime lastModified = File.GetLastWriteTime("HandBrakeCLI.exe");\r
\r
-\r
if (Properties.Settings.Default.cliLastModified == lastModified && Properties.Settings.Default.hb_build != 0)\r
return;\r
\r
Properties.Settings.Default.cliLastModified = lastModified;\r
\r
Process cliProcess = new Process();\r
- ProcessStartInfo handBrakeCLI = new ProcessStartInfo("HandBrakeCLI.exe", " -u -v0")\r
+ ProcessStartInfo handBrakeCli = new ProcessStartInfo("HandBrakeCLI.exe", " -u -v0")\r
{\r
UseShellExecute = false,\r
RedirectStandardError = true,\r
RedirectStandardOutput = true,\r
CreateNoWindow = true\r
};\r
- cliProcess.StartInfo = handBrakeCLI;\r
+ cliProcess.StartInfo = handBrakeCli;\r
\r
try\r
{\r
cliProcess.Start();\r
+\r
// Retrieve standard output and report back to parent thread until the process is complete\r
TextReader stdOutput = cliProcess.StandardError;\r
\r
while (!cliProcess.HasExited)\r
{\r
- line = stdOutput.ReadLine() ?? "";\r
+ line = stdOutput.ReadLine() ?? string.Empty;\r
Match m = Regex.Match(line, @"HandBrake ([svnM0-9.]*) \([0-9]*\)");\r
Match platform = Regex.Match(line, @"- ([A-Za-z0-9\s ]*) -");\r
\r
if (m.Success)\r
{\r
- string data = line.Replace("(", "").Replace(")", "").Replace("HandBrake ", "");\r
+ string data = line.Replace("(", string.Empty).Replace(")", string.Empty).Replace("HandBrake ", string.Empty);\r
string[] arr = data.Split(' ');\r
\r
Properties.Settings.Default.hb_build = int.Parse(arr[1]);\r
Properties.Settings.Default.hb_version = arr[0];\r
}\r
+\r
if (platform.Success)\r
- Properties.Settings.Default.hb_platform = platform.Value.Replace("-", "").Trim();\r
+ {\r
+ Properties.Settings.Default.hb_platform = platform.Value.Replace("-", string.Empty).Trim();\r
+ }\r
\r
if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds.\r
{\r
Process cli = Process.GetProcessById(cliProcess.Id);\r
if (!cli.HasExited)\r
+ {\r
cli.Kill();\r
+ }\r
}\r
}\r
+\r
Properties.Settings.Default.Save();\r
}\r
catch (Exception e)\r
/// If it does, it means the last queue did not complete before HandBrake closed.\r
/// So, return a boolean if true. \r
/// </summary>\r
- public static Boolean CheckQueueRecovery()\r
+ /// <returns>\r
+ /// True if there is a queue to recover.\r
+ /// </returns>\r
+ public static bool CheckQueueRecovery()\r
{\r
try\r
{\r
Process hbProcess = null;\r
foreach (Process process in hbProcesses)\r
{\r
- Boolean found = false;\r
+ bool found = false;\r
// Check if the current CLI instance was running before we started the current one\r
foreach (Process bprocess in before)\r
{\r
{\r
if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") && !file.Name.Contains("tmp_appReadable_log.txt"))\r
File.Delete(file.FullName);\r
-\r
}\r
}\r
}\r
{\r
if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") && !file.Name.Contains("tmp_appReadable_log.txt"))\r
File.Delete(file.FullName);\r
-\r
}\r
}\r
}\r
public static void BeginCheckForUpdates(AsyncCallback callback, bool debug)\r
{\r
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate\r
- {\r
- try\r
- {\r
- // Is this a stable or unstable build?\r
- string url = Properties.Settings.Default.hb_build.ToString().EndsWith("1") ? Properties.Settings.Default.appcast_unstable : Properties.Settings.Default.appcast;\r
-\r
- // Initialize variables\r
- WebRequest request = WebRequest.Create(url);\r
- WebResponse response = request.GetResponse();\r
- AppcastReader reader = new AppcastReader();\r
-\r
- // Get the data, convert it to a string, and parse it into the AppcastReader\r
- reader.GetInfo(new StreamReader(response.GetResponseStream()).ReadToEnd());\r
-\r
- // Further parse the information\r
- string build = reader.Build;\r
-\r
- int latest = int.Parse(build);\r
- int current = Properties.Settings.Default.hb_build;\r
- int skip = Properties.Settings.Default.skipversion;\r
-\r
- // If the user wanted to skip this version, don't report the update\r
- if (latest == skip)\r
- {\r
- UpdateCheckInformation info = new UpdateCheckInformation() { NewVersionAvailable = false, BuildInformation = null };\r
- callback(new UpdateCheckResult(debug, info));\r
- return;\r
- }\r
-\r
- // Set when the last update was\r
- Properties.Settings.Default.lastUpdateCheckDate = DateTime.Now;\r
- Properties.Settings.Default.Save();\r
-\r
- UpdateCheckInformation info2 = new UpdateCheckInformation() { NewVersionAvailable = latest > current, BuildInformation = reader };\r
- callback(new UpdateCheckResult(debug, info2));\r
- }\r
- catch (Exception exc)\r
- {\r
- callback(new UpdateCheckResult(debug, new UpdateCheckInformation() { Error = exc }));\r
- }\r
- }));\r
+ {\r
+ try\r
+ {\r
+ // Is this a stable or unstable build?\r
+ string url =\r
+ Properties.Settings.Default.hb_build.ToString()\r
+ .EndsWith("1")\r
+ ? Properties.Settings.Default.\r
+ appcast_unstable\r
+ : Properties.Settings.Default.appcast;\r
+\r
+ // Initialize variables\r
+ WebRequest request = WebRequest.Create(url);\r
+ WebResponse response = request.GetResponse();\r
+ AppcastReader reader = new AppcastReader();\r
+\r
+ // Get the data, convert it to a string, and parse it into the AppcastReader\r
+ reader.GetInfo(\r
+ new StreamReader(response.GetResponseStream())\r
+ .ReadToEnd());\r
+\r
+ // Further parse the information\r
+ string build = reader.Build;\r
+\r
+ int latest = int.Parse(build);\r
+ int current = Properties.Settings.Default.hb_build;\r
+ int skip = Properties.Settings.Default.skipversion;\r
+\r
+ // If the user wanted to skip this version, don't report the update\r
+ if (latest == skip)\r
+ {\r
+ UpdateCheckInformation info =\r
+ new UpdateCheckInformation\r
+ {\r
+ NewVersionAvailable = false,\r
+ BuildInformation = null\r
+ };\r
+ callback(new UpdateCheckResult(debug, info));\r
+ return;\r
+ }\r
+\r
+ // Set when the last update was\r
+ Properties.Settings.Default.lastUpdateCheckDate =\r
+ DateTime.Now;\r
+ Properties.Settings.Default.Save();\r
+\r
+ UpdateCheckInformation info2 =\r
+ new UpdateCheckInformation\r
+ {\r
+ NewVersionAvailable = latest > current,\r
+ BuildInformation = reader\r
+ };\r
+ callback(new UpdateCheckResult(debug, info2));\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ callback(new UpdateCheckResult(debug, new UpdateCheckInformation{Error = exc}));\r
+ }\r
+ }));\r
}\r
\r
/// <summary>\r
- /// \r
+ /// End Check for Updates\r
/// </summary>\r
- /// <param name="result"></param>\r
- /// <returns></returns>\r
+ /// <param name="result">\r
+ /// The result.\r
+ /// </param>\r
+ /// <returns>\r
+ /// Update Check information\r
+ /// </returns>\r
public static UpdateCheckInformation EndCheckForUpdates(IAsyncResult result)\r
{\r
UpdateCheckResult checkResult = (UpdateCheckResult)result;\r
/// <summary>\r
/// Map languages and their iso639_2 value into a IDictionary\r
/// </summary>\r
- /// <returns></returns>\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
/// <summary>\r
/// Get a list of available DVD drives which are ready and contain DVD content.\r
/// </summary>\r
- /// <returns></returns>\r
+ /// <returns>A List of Drives with their details</returns>\r
public static List<DriveInformation> GetDrives()\r
{\r
List<DriveInformation> drives = new List<DriveInformation>();\r
if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady && File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))\r
{\r
drives.Add(new DriveInformation\r
- {\r
- VolumeLabel = curDrive.VolumeLabel,\r
- RootDirectory = curDrive.RootDirectory + "VIDEO_TS"\r
- });\r
+ {\r
+ VolumeLabel = curDrive.VolumeLabel,\r
+ RootDirectory = curDrive.RootDirectory + "VIDEO_TS"\r
+ });\r
}\r
}\r
return drives;\r
/* PresetLoader.cs $\r
- \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;\r
-using System.Drawing;\r
-using System.Windows.Forms;\r
-using Handbrake.Model;\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.Functions\r
{\r
- class PresetLoader\r
+ using System;\r
+ using System.Drawing;\r
+ using System.Windows.Forms;\r
+\r
+ /// <summary>\r
+ /// Load a preset into the main Window\r
+ /// </summary>\r
+ public class PresetLoader\r
{\r
/// <summary>\r
/// This function takes in a Query which has been parsed by QueryParser and\r
/// set's all the GUI widgets correctly.\r
/// </summary>\r
- /// <param name="mainWindow"></param>\r
- /// <param name="presetQuery">The Parsed CLI Query</param>\r
- /// <param name="name">Name of the preset</param>\r
- /// <param name="pictureSettings">Save picture settings in the preset</param>\r
- public static void LoadPreset(frmMain mainWindow, QueryParser presetQuery, string name, Boolean pictureSettings)\r
+ /// <param name="mainWindow">\r
+ /// FrmMain window\r
+ /// </param>\r
+ /// <param name="presetQuery">\r
+ /// The Parsed CLI Query\r
+ /// </param>\r
+ /// <param name="name">\r
+ /// Name of the preset\r
+ /// </param>\r
+ /// <param name="pictureSettings">\r
+ /// Save picture settings in the preset\r
+ /// </param>\r
+ public static void LoadPreset(frmMain mainWindow, QueryParser presetQuery, string name, bool pictureSettings)\r
{\r
#region Source\r
// Reset some vaules to stock first to prevent errors.\r
{\r
double cqStep = Properties.Settings.Default.x264cqstep;\r
int value;\r
- double x264step = cqStep;\r
+ double x264Step = cqStep;\r
double presetValue = presetQuery.VideoQuality;\r
\r
- double x = 51 / x264step;\r
+ double x = 51 / x264Step;\r
\r
- double calculated = presetValue / x264step;\r
+ double calculated = presetValue / x264Step;\r
calculated = x - calculated;\r
\r
int.TryParse(calculated.ToString(), out value);\r
/* QueryGenerator.cs $\r
- \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;\r
-using System.Windows.Forms;\r
-using System.Globalization;\r
-using System.IO;\r
-using System.Collections.Generic;\r
-using Handbrake.Model;\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.Functions\r
{\r
- class QueryGenerator\r
+ using System;\r
+ using System.Collections.Generic;\r
+ using System.Globalization;\r
+ using System.IO;\r
+ using System.Windows.Forms;\r
+\r
+ /// <summary>\r
+ /// Generate a CLI Query for HandBrakeCLI\r
+ /// </summary>\r
+ public class QueryGenerator\r
{\r
/// <summary>\r
/// Generates a full CLI query for either encoding or previe encoeds if duration and preview are defined.\r
/// </summary>\r
- /// <param name="mainWindow">The Main Window</param>\r
- /// <param name="mode">What Mode. (Point to Point Encoding) Chapters, Seconds, Frames OR Preview Encode</param>\r
- /// <param name="duration">time in seconds for preview mode</param>\r
- /// <param name="preview"> --start-at-preview (int) </param>\r
- /// <returns>CLI Query </returns>\r
+ /// <param name="mainWindow">\r
+ /// The Main Window\r
+ /// </param>\r
+ /// <param name="mode">\r
+ /// What Mode. (Point to Point Encoding) Chapters, Seconds, Frames OR Preview Encode\r
+ /// </param>\r
+ /// <param name="duration">\r
+ /// Time in seconds for preview mode\r
+ /// </param>\r
+ /// <param name="preview">\r
+ /// Preview --start-at-preview (int) \r
+ /// </param>\r
+ /// <returns>\r
+ /// CLI Query \r
+ /// </returns>\r
public static string GenerateCliQuery(frmMain mainWindow, int mode, int duration, string preview)\r
{\r
- string query = "";\r
+ string query = string.Empty;\r
\r
if (!string.IsNullOrEmpty(mainWindow.sourcePath) && mainWindow.sourcePath.Trim() != "Select \"Source\" to continue")\r
query = " -i " + '"' + mainWindow.sourcePath + '"';\r
\r
- if (mainWindow.drp_dvdtitle.Text != "")\r
+ if (mainWindow.drp_dvdtitle.Text != string.Empty)\r
{\r
string[] titleInfo = mainWindow.drp_dvdtitle.Text.Split(' ');\r
query += " -t " + titleInfo[0];\r
switch (mode)\r
{\r
case 0: // Chapters\r
- if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text && mainWindow.drop_chapterStart.Text != "")\r
+ if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text && mainWindow.drop_chapterStart.Text != string.Empty)\r
query += string.Format(" -c {0}", mainWindow.drop_chapterStart.Text);\r
- else if (mainWindow.drop_chapterStart.Text != "" && mainWindow.drop_chapterFinish.Text != "")\r
+ else if (mainWindow.drop_chapterStart.Text != string.Empty && mainWindow.drop_chapterFinish.Text != string.Empty)\r
query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text, mainWindow.drop_chapterFinish.Text);\r
break;\r
case 1: // Seconds\r
query += " --start-at-preview " + preview;\r
query += " --stop-at duration:" + duration + " ";\r
\r
- if (mainWindow.text_destination.Text != "")\r
+ if (mainWindow.text_destination.Text != string.Empty)\r
query += string.Format(" -o \"{0}\" ", mainWindow.text_destination.Text.Replace(".m", "_sample.m"));\r
break;\r
default:\r
/// <summary>\r
/// Generates part of the CLI query, for the tabbed components only.\r
/// </summary>\r
- /// <param name="mainWindow"></param>\r
- /// <returns></returns>\r
+ /// <param name="mainWindow">frmMain the main window</param>\r
+ /// <returns>The CLI Query for the Tab Screens on the main window</returns>\r
public static string GenerateTabbedComponentsQuery(frmMain mainWindow)\r
{\r
- string query = "";\r
+ string query = string.Empty;\r
\r
#region Output Settings Box\r
- query += " -f " + mainWindow.drop_format.Text.ToLower().Replace(" file", "");\r
+ query += " -f " + mainWindow.drop_format.Text.ToLower().Replace(" file", string.Empty);\r
\r
// These are output settings features\r
if (mainWindow.check_largeFile.Checked)\r
if (mainWindow.PictureSettings.PresetMaximumResolution.Height == 0)\r
{\r
if (mainWindow.PictureSettings.text_height.Value != 0)\r
- if (mainWindow.PictureSettings.text_height.Text != "")\r
+ if (mainWindow.PictureSettings.text_height.Text != string.Empty)\r
if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic\r
query += " -l " + mainWindow.PictureSettings.text_height.Text;\r
}\r
query += " --keep-display-aspect ";\r
\r
if (!mainWindow.PictureSettings.check_KeepAR.Checked)\r
- if (mainWindow.PictureSettings.updownParWidth.Text != "" && mainWindow.PictureSettings.updownParHeight.Text != "")\r
+ if (mainWindow.PictureSettings.updownParWidth.Text != string.Empty && mainWindow.PictureSettings.updownParHeight.Text != string.Empty)\r
query += " --pixel-aspect " + mainWindow.PictureSettings.updownParWidth.Text + ":" + mainWindow.PictureSettings.updownParHeight.Text + " ";\r
break;\r
}\r
}\r
\r
// Audio Track (-a)\r
- String audioItems = "";\r
- Boolean firstLoop = true;\r
+ string audioItems = string.Empty;\r
+ bool firstLoop = true;\r
\r
- foreach (String item in tracks)\r
+ foreach (string item in tracks)\r
{\r
if (firstLoop)\r
{\r
- audioItems = item; firstLoop = false;\r
+ audioItems = item;\r
+ firstLoop = false;\r
}\r
else\r
audioItems += "," + item;\r
}\r
if (audioItems.Trim() != String.Empty)\r
query += " -a " + audioItems;\r
- firstLoop = true; audioItems = ""; // Reset for another pass.\r
+ firstLoop = true;\r
+ audioItems = string.Empty; // Reset for another pass.\r
\r
// Audio Codec (-E)\r
- foreach (String item in codecs)\r
+ foreach (string item in codecs)\r
{\r
-\r
if (firstLoop)\r
{\r
- audioItems = item; firstLoop = false;\r
+ audioItems = item;\r
+ firstLoop = false;\r
}\r
else\r
audioItems += "," + item;\r
}\r
if (audioItems.Trim() != String.Empty)\r
query += " -E " + audioItems;\r
- firstLoop = true; audioItems = ""; // Reset for another pass.\r
+ firstLoop = true;\r
+ audioItems = string.Empty; // Reset for another pass.\r
\r
// Audio Mixdown (-6)\r
- foreach (String item in mixdowns)\r
+ foreach (string item in mixdowns)\r
{\r
if (firstLoop)\r
{\r
- audioItems = item; firstLoop = false;\r
+ audioItems = item;\r
+ firstLoop = false;\r
}\r
else\r
audioItems += "," + item;\r
}\r
if (audioItems.Trim() != String.Empty)\r
query += " -6 " + audioItems;\r
- firstLoop = true; audioItems = ""; // Reset for another pass.\r
+ firstLoop = true;\r
+ audioItems = string.Empty; // Reset for another pass.\r
\r
// Sample Rate (-R)\r
- foreach (String item in samplerates)\r
+ foreach (string item in samplerates)\r
{\r
if (firstLoop)\r
{\r
- audioItems = item; firstLoop = false;\r
+ audioItems = item;\r
+ firstLoop = false;\r
}\r
else\r
audioItems += "," + item;\r
}\r
if (audioItems.Trim() != String.Empty)\r
query += " -R " + audioItems;\r
- firstLoop = true; audioItems = ""; // Reset for another pass.\r
+ firstLoop = true;\r
+ audioItems = string.Empty; // Reset for another pass.\r
\r
// Audio Bitrate (-B)\r
- foreach (String item in bitrates)\r
+ foreach (string item in bitrates)\r
{\r
if (firstLoop)\r
{\r
- audioItems = item; firstLoop = false;\r
+ audioItems = item;\r
+ firstLoop = false;\r
}\r
else\r
audioItems += "," + item;\r
}\r
if (audioItems.Trim() != String.Empty)\r
query += " -B " + audioItems;\r
- firstLoop = true; audioItems = ""; // Reset for another pass.\r
+ firstLoop = true;\r
+ audioItems = string.Empty; // Reset for another pass.\r
\r
// DRC (-D)\r
foreach (var itm in drcs)\r
string item = itm.ToString(new CultureInfo("en-US"));\r
if (firstLoop)\r
{\r
- audioItems = item; firstLoop = false;\r
+ audioItems = item;\r
+ firstLoop = false;\r
}\r
else\r
audioItems += "," + item;\r
? Path.Combine(Path.GetTempPath(), dest_name + "-" + sourceTitle + "-chapters.csv")\r
: Path.Combine(Path.GetTempPath(), dest_name + "-chapters.csv");\r
\r
- if (ChapterCSVSave(mainWindow, path) == false)\r
+ if (ChapterCsvSave(mainWindow, path) == false)\r
query += " -m ";\r
else\r
query += " --markers=" + "\"" + path + "\"";\r
/// <summary>\r
/// Get the CLI Audio Encoder name\r
/// </summary>\r
- /// <param name="selectedEncoder">string The GUI Encode name</param>\r
- /// <returns>string CLI encoder name</returns>\r
+ /// <param name="selectedEncoder">\r
+ /// String The GUI Encode name\r
+ /// </param>\r
+ /// <returns>\r
+ /// String CLI encoder name\r
+ /// </returns>\r
private static string GetAudioEncoder(string selectedEncoder)\r
{\r
switch (selectedEncoder)\r
case "DTS Passthru":\r
return "dts";\r
default:\r
- return "";\r
+ return string.Empty;\r
}\r
}\r
\r
/// <param name="mainWindow">Main Window</param>\r
/// <param name="filePathName">Path to save the csv file</param>\r
/// <returns>True if successful </returns>\r
- private static Boolean ChapterCSVSave(frmMain mainWindow, string filePathName)\r
+ private static bool ChapterCsvSave(frmMain mainWindow, string filePathName)\r
{\r
try\r
{\r
- string csv = "";\r
+ string csv = string.Empty;\r
\r
foreach (DataGridViewRow row in mainWindow.data_chpt.Rows)\r
{\r
csv += row.Cells[0].Value.ToString();\r
csv += ",";\r
- csv += row.Cells[1].Value.ToString().Replace(",","\\,");\r
+ csv += row.Cells[1].Value.ToString().Replace(",", "\\,");\r
csv += Environment.NewLine;\r
}\r
StreamWriter file = new StreamWriter(filePathName);\r
/* Scan.cs $\r
- \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;\r
-using System.Windows.Forms;\r
-using System.IO;\r
-using System.Diagnostics;\r
-using System.Threading;\r
-using Handbrake.Parsing;\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.Functions\r
{\r
+ using System;\r
+ using System.Diagnostics;\r
+ using System.IO;\r
+ using System.Threading;\r
+ using System.Windows.Forms;\r
+ using Parsing;\r
+\r
+ /// <summary>\r
+ /// Scan a Source\r
+ /// </summary>\r
public class Scan\r
{\r
- private DVD ThisDvd;\r
- private Parser ReadData;\r
- private Process HbProc;\r
- private string ScanProgress;\r
+ /// <summary>\r
+ /// The information for this source\r
+ /// </summary>\r
+ private DVD thisDvd;\r
+\r
+ /// <summary>\r
+ /// The CLI data parser\r
+ /// </summary>\r
+ private Parser readData;\r
+\r
+ /// <summary>\r
+ /// The Process belonging to the CLI\r
+ /// </summary>\r
+ private Process hbProc;\r
+\r
+ /// <summary>\r
+ /// The Progress of the scan\r
+ /// </summary>\r
+ private string scanProgress;\r
\r
/// <summary>\r
/// Scan has Started\r
/// <param name="title">int title number. 0 for scan all</param>\r
public void ScanSource(string sourcePath, int title)\r
{\r
- Thread t = new Thread(unused => RunScan(sourcePath, title));\r
+ Thread t = new Thread(unused => this.RunScan(sourcePath, title));\r
t.Start();\r
}\r
\r
/// <summary>\r
/// Object containing the information parsed in the scan.\r
/// </summary>\r
- /// <returns></returns>\r
+ /// <returns>The DVD object containing the scan information</returns>\r
public DVD SouceData()\r
{\r
- return ThisDvd;\r
+ return this.thisDvd;\r
}\r
\r
/// <summary>\r
/// Raw log output from HandBrake CLI\r
/// </summary>\r
- /// <returns></returns>\r
- public String LogData()\r
+ /// <returns>The Log Data</returns>\r
+ public string LogData()\r
{\r
- return ReadData.Buffer;\r
+ return this.readData.Buffer;\r
}\r
\r
/// <summary>\r
/// Progress of the scan.\r
/// </summary>\r
- /// <returns></returns>\r
- public String ScanStatus()\r
+ /// <returns>The progress of the scan</returns>\r
+ public string ScanStatus()\r
{\r
- return ScanProgress;\r
+ return this.scanProgress;\r
}\r
\r
/// <summary>\r
/// The Scan Process\r
/// </summary>\r
- /// <returns></returns>\r
+ /// <returns>The CLI process</returns>\r
public Process ScanProcess()\r
{\r
- return HbProc;\r
+ return this.hbProc;\r
}\r
\r
/// <summary>\r
/// Start a scan for a given source path and title\r
/// </summary>\r
- /// <param name="sourcePath"></param>\r
- /// <param name="title"></param>\r
+ /// <param name="sourcePath">Path to the source file</param>\r
+ /// <param name="title">the title number to look at</param>\r
private void RunScan(object sourcePath, int title)\r
{\r
try\r
{\r
- if (ScanStared != null)\r
- ScanStared(this, new EventArgs());\r
+ if (this.ScanStared != null)\r
+ this.ScanStared(this, new EventArgs());\r
\r
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
if (File.Exists(dvdInfoPath))\r
File.Delete(dvdInfoPath);\r
\r
- String dvdnav = string.Empty;\r
+ string dvdnav = string.Empty;\r
if (Properties.Settings.Default.noDvdNav)\r
dvdnav = " --no-dvdnav";\r
\r
- HbProc = new Process\r
- {\r
- StartInfo =\r
- {\r
- FileName = handbrakeCLIPath,\r
- Arguments = String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, dvdnav),\r
- RedirectStandardOutput = true,\r
- RedirectStandardError = true,\r
- UseShellExecute = false,\r
- CreateNoWindow = true\r
- }\r
- };\r
- HbProc.Start();\r
-\r
- ReadData = new Parser(HbProc.StandardError.BaseStream);\r
- ReadData.OnScanProgress += new ScanProgressEventHandler(OnScanProgress);\r
- ThisDvd = DVD.Parse(ReadData);\r
+ this.hbProc = new Process\r
+ {\r
+ StartInfo =\r
+ {\r
+ FileName = handbrakeCLIPath,\r
+ Arguments =\r
+ String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, dvdnav),\r
+ RedirectStandardOutput = true,\r
+ RedirectStandardError = true,\r
+ UseShellExecute = false,\r
+ CreateNoWindow = true\r
+ }\r
+ };\r
+ this.hbProc.Start();\r
+\r
+ this.readData = new Parser(this.hbProc.StandardError.BaseStream);\r
+ this.readData.OnScanProgress += new ScanProgressEventHandler(this.OnScanProgress);\r
+ this.thisDvd = DVD.Parse(this.readData);\r
\r
// Write the Buffer out to file.\r
StreamWriter scanLog = new StreamWriter(dvdInfoPath);\r
- scanLog.Write(ReadData.Buffer);\r
+ scanLog.Write(this.readData.Buffer);\r
scanLog.Flush();\r
scanLog.Close();\r
\r
- if (ScanCompleted != null)\r
- ScanCompleted(this, new EventArgs());\r
+ if (this.ScanCompleted != null)\r
+ this.ScanCompleted(this, new EventArgs());\r
}\r
catch (Exception exc)\r
{\r
/// <summary>\r
/// Fire an event when the scan process progresses\r
/// </summary>\r
- /// <param name="sender"></param>\r
- /// <param name="currentTitle"></param>\r
- /// <param name="titleCount"></param>\r
+ /// <param name="sender">the sender</param>\r
+ /// <param name="currentTitle">the current title being scanned</param>\r
+ /// <param name="titleCount">the total number of titles</param>\r
private void OnScanProgress(object sender, int currentTitle, int titleCount)\r
{\r
- ScanProgress = string.Format("Processing Title: {0} of {1}", currentTitle, titleCount);\r
- if (ScanStatusChanged != null)\r
- ScanStatusChanged(this, new EventArgs());\r
+ this.scanProgress = string.Format("Processing Title: {0} of {1}", currentTitle, titleCount);\r
+ if (this.ScanStatusChanged != null)\r
+ this.ScanStatusChanged(this, new EventArgs());\r
}\r
}\r
}
\ No newline at end of file
/* System.cs $\r
- \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;\r
-using System.Windows.Forms;\r
-using Microsoft.Win32;\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.Functions\r
{\r
- class SystemInfo\r
+ using System.Windows.Forms;\r
+ using Microsoft.Win32;\r
+\r
+ /// <summary>\r
+ /// The System Information.\r
+ /// </summary>\r
+ public class SystemInfo\r
{\r
/// <summary>\r
- /// Returns the total physical ram in a system\r
+ /// Gets the total physical ram in a system\r
/// </summary>\r
- /// <returns></returns>\r
+ /// <returns>The total memory in the system</returns>\r
public static uint TotalPhysicalMemory\r
{\r
get\r
Win32.GlobalMemoryStatus(ref memStatus);\r
\r
uint memoryInfo = memStatus.dwTotalPhys;\r
- memoryInfo = memoryInfo/1024/1024;\r
+ memoryInfo = memoryInfo / 1024 / 1024;\r
\r
return memoryInfo;\r
}\r
}\r
\r
/// <summary>\r
- /// Get the number of CPU Cores\r
+ /// Gets the number of CPU Cores\r
/// </summary>\r
/// <returns>Object</returns>\r
- public static Object GetCpuCount\r
+ public static object GetCpuCount\r
{\r
get\r
{\r
}\r
\r
/// <summary>\r
- /// Get the System screen size information.\r
+ /// Gets the System screen size information.\r
/// </summary>\r
/// <returns>System.Windows.Forms.Scree</returns>\r
public static Screen ScreenBounds\r
-using System;\r
-using System.Threading;\r
+/* UpdateCheckInformation.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.Functions\r
{\r
+ using System;\r
+ using System.Threading;\r
+\r
/// <summary>\r
/// Provides information about an update check.\r
/// </summary>\r
public struct UpdateCheckInformation\r
{\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether a New Version is Available.\r
+ /// </summary>\r
public bool NewVersionAvailable { get; set; }\r
- public bool ErrorOccured { get { return Error != null; } }\r
\r
/// <summary>\r
- /// Gets information about the new build, if any. This will be null if there is no new verison.\r
+ /// Gets a value indicating whether an Error Occured.\r
+ /// </summary>\r
+ public bool ErrorOccured\r
+ {\r
+ get { return this.Error != null; }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets or sets information about the new build, if any. This will be null if there is no new verison.\r
/// </summary>\r
public AppcastReader BuildInformation { get; set; }\r
\r
/// <summary>\r
- /// Gets the error that occurred, if any. This will be null if no error occured.\r
+ /// Gets or sets the error that occurred, if any. This will be null if no error occured.\r
/// </summary>\r
public Exception Error { get; set; }\r
}\r
/// </summary>\r
public class UpdateCheckResult : IAsyncResult\r
{\r
+ /// <summary>\r
+ /// Initializes a new instance of the <see cref="UpdateCheckResult"/> class.\r
+ /// </summary>\r
+ /// <param name="asyncState">\r
+ /// The async state.\r
+ /// </param>\r
+ /// <param name="info">\r
+ /// The info.\r
+ /// </param>\r
public UpdateCheckResult(object asyncState, UpdateCheckInformation info)\r
{\r
- AsyncState = asyncState;\r
- Result = info;\r
+ this.AsyncState = asyncState;\r
+ this.Result = info;\r
}\r
\r
/// <summary>\r
/// </summary>\r
public UpdateCheckInformation Result { get; private set; }\r
\r
- public WaitHandle AsyncWaitHandle { get { throw new NotImplementedException(); } }\r
- public bool CompletedSynchronously { get { throw new NotImplementedException(); } }\r
- public bool IsCompleted { get { throw new NotImplementedException(); } }\r
+ /// <summary>\r
+ /// Gets AsyncWaitHandle.\r
+ /// </summary>\r
+ /// <exception cref="NotImplementedException">\r
+ /// </exception>\r
+ public WaitHandle AsyncWaitHandle\r
+ {\r
+ get { throw new NotImplementedException(); }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets a value indicating whether CompletedSynchronously.\r
+ /// </summary>\r
+ /// <exception cref="NotImplementedException">\r
+ /// </exception>\r
+ public bool CompletedSynchronously\r
+ {\r
+ get { throw new NotImplementedException(); }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets a value indicating whether IsCompleted.\r
+ /// </summary>\r
+ /// <exception cref="NotImplementedException">\r
+ /// </exception>\r
+ public bool IsCompleted\r
+ {\r
+ get { throw new NotImplementedException(); }\r
+ }\r
}\r
}\r
/* win32.cs $\r
- \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
+ 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
\r
-using System;\r
-using System.Runtime.InteropServices;\r
-\r
namespace Handbrake.Functions\r
{\r
- class Win32\r
+ using System;\r
+ using System.Runtime.InteropServices;\r
+\r
+ /// <summary>\r
+ /// Win32 API calls\r
+ /// </summary>\r
+ public class Win32\r
{\r
+ /// <summary>\r
+ /// Set the Forground Window\r
+ /// </summary>\r
+ /// <param name="hWnd">\r
+ /// The h wnd.\r
+ /// </param>\r
+ /// <returns>\r
+ /// A Boolean true when complete.\r
+ /// </returns>\r
[DllImport("user32.dll")]\r
public static extern bool SetForegroundWindow(int hWnd);\r
\r
+ /// <summary>\r
+ /// Lock the workstation\r
+ /// </summary>\r
[DllImport("user32.dll")]\r
public static extern void LockWorkStation();\r
\r
+ /// <summary>\r
+ /// Exit Windows\r
+ /// </summary>\r
+ /// <param name="uFlags">\r
+ /// The u flags.\r
+ /// </param>\r
+ /// <param name="dwReason">\r
+ /// The dw reason.\r
+ /// </param>\r
+ /// <returns>\r
+ /// an integer\r
+ /// </returns>\r
[DllImport("user32.dll")]\r
public static extern int ExitWindowsEx(int uFlags, int dwReason);\r
\r
+ /// <summary>\r
+ /// System Memory Status\r
+ /// </summary>\r
public struct MEMORYSTATUS // Unused var's are required here.\r
{\r
public UInt32 dwLength;\r
public UInt32 dwAvailVirtual;\r
}\r
\r
+ /// <summary>\r
+ /// Global Memory Status\r
+ /// </summary>\r
+ /// <param name="lpBuffer">\r
+ /// The lp buffer.\r
+ /// </param>\r
[DllImport("kernel32.dll")]\r
public static extern void GlobalMemoryStatus\r
(\r
[DllImport("kernel32.dll", SetLastError = true)]\r
public static extern bool GenerateConsoleCtrlEvent(ConsoleCtrlEvent sigevent, int dwProcessGroupId);\r
\r
+ /// <summary>\r
+ /// Console Ctrl Event\r
+ /// </summary>\r
public enum ConsoleCtrlEvent\r
{\r
CTRL_C = 0,\r
--- /dev/null
+<Configuration>\r
+ <CodeStyleSettings>\r
+ <ExternalPath IsNull="False">\r
+ </ExternalPath>\r
+ <Sharing>SOLUTION</Sharing>\r
+ <CSharp>\r
+ <FormatSettings>\r
+ <MODIFIERS_ORDER IsNull="False">\r
+ <Item>public</Item>\r
+ <Item>protected</Item>\r
+ <Item>internal</Item>\r
+ <Item>private</Item>\r
+ <Item>new</Item>\r
+ <Item>abstract</Item>\r
+ <Item>virtual</Item>\r
+ <Item>override</Item>\r
+ <Item>sealed</Item>\r
+ <Item>static</Item>\r
+ <Item>readonly</Item>\r
+ <Item>extern</Item>\r
+ <Item>unsafe</Item>\r
+ <Item>volatile</Item>\r
+ </MODIFIERS_ORDER>\r
+ </FormatSettings>\r
+ <UsingsSettings>\r
+ <AddImportsToDeepestScope>True</AddImportsToDeepestScope>\r
+ </UsingsSettings>\r
+ <Naming2>\r
+ <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>\r
+ <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />\r
+ <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />\r
+ <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />\r
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />\r
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />\r
+ </Naming2>\r
+ </CSharp>\r
+ <VB>\r
+ <FormatSettings />\r
+ <ImportsSettings />\r
+ <Naming2>\r
+ <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>\r
+ <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />\r
+ <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />\r
+ <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />\r
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />\r
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />\r
+ </Naming2>\r
+ </VB>\r
+ <Web>\r
+ <Naming2 />\r
+ </Web>\r
+ <Xaml>\r
+ <Naming2 />\r
+ </Xaml>\r
+ <XML>\r
+ <FormatSettings />\r
+ </XML>\r
+ <FileHeader><![CDATA[/* file.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. */]]></FileHeader>\r
+ <GenerateMemberBody />\r
+ <Naming2>\r
+ <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>\r
+ <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />\r
+ <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />\r
+ <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="PublicFields" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />\r
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />\r
+ <Abbreviation Text="CLI" />\r
+ </Naming2>\r
+ </CodeStyleSettings>\r
+</Configuration>
\ No newline at end of file
<Target Name="AfterBuild">\r
</Target>\r
-->\r
+ <Import Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.3\Microsoft.StyleCop.targets" /> \r
</Project>
\ No newline at end of file
--- /dev/null
+<Configuration>\r
+ <Localizable>No</Localizable>\r
+</Configuration>
\ No newline at end of file
--- /dev/null
+<StyleCopSettings Version="4.3">\r
+ <GlobalSettings>\r
+ <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>\r
+ </GlobalSettings>\r
+ <Analyzers>\r
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules">\r
+ <Rules>\r
+ <Rule Name="FileHeaderMustShowCopyright">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="FileHeaderMustHaveCopyrightText">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="FileHeaderMustContainFileName">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="FileHeaderMustHaveValidCompanyText">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="FileMustHaveHeader">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="PropertyDocumentationMustHaveValueText">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">True</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="DocumentationTextMustMeetMinimumCharacterLength">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ </Rules>\r
+ <AnalyzerSettings>\r
+ <StringProperty Name="CompanyName">HandBrake Project</StringProperty>\r
+ <StringProperty Name="Copyright">Copyright 2010 HandBrake Team - It may be used under the terms of the GNU General Public License.</StringProperty>\r
+ </AnalyzerSettings>\r
+ </Analyzer>\r
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.MaintainabilityRules">\r
+ <Rules>\r
+ <Rule Name="StatementMustNotUseUnnecessaryParenthesis">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ </Rules>\r
+ <AnalyzerSettings />\r
+ </Analyzer>\r
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.SpacingRules">\r
+ <Rules>\r
+ <Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ </Rules>\r
+ <AnalyzerSettings />\r
+ </Analyzer>\r
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.LayoutRules">\r
+ <Rules>\r
+ <Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="SingleLineCommentMustBePrecededByBlankLine">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="CurlyBracketsMustNotBeOmitted">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ </Rules>\r
+ <AnalyzerSettings />\r
+ </Analyzer>\r
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.ReadabilityRules">\r
+ <Rules>\r
+ <Rule Name="BlockStatementsMustNotContainEmbeddedComments">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="DoNotPlaceRegionsWithinElements">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ </Rules>\r
+ <AnalyzerSettings />\r
+ </Analyzer>\r
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">\r
+ <Rules>\r
+ <Rule Name="FieldNamesMustNotUseHungarianNotation">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ </Rules>\r
+ <AnalyzerSettings />\r
+ </Analyzer>\r
+ </Analyzers>\r
+</StyleCopSettings>
\ No newline at end of file