{\r
public class Encode\r
{\r
+ private int ProcessID { get; set; }\r
+\r
+ /// <summary>\r
+ /// The HB Process\r
+ /// </summary>\r
public Process HbProcess { get; set; }\r
- public int ProcessID { get; set; }\r
+ \r
+ /// <summary>\r
+ /// The Process Handle\r
+ /// </summary>\r
public IntPtr ProcessHandle { get; set; }\r
- public String CurrentQuery { get; set; }\r
- public Boolean IsEncoding { get; set; }\r
+ \r
+ /// <summary>\r
+ /// Returns true of HandBrakeCLI.exe is running\r
+ /// </summary>\r
+ public Boolean IsEncoding { get; set; } \r
\r
+ /// <summary>\r
+ /// Fires when a new CLI Job starts\r
+ /// </summary>\r
public event EventHandler EncodeStarted;\r
+\r
+ /// <summary>\r
+ /// Fires when a CLI job finishes.\r
+ /// </summary>\r
public event EventHandler EncodeEnded;\r
\r
/// <summary>\r
/// Create a preview sample video\r
/// </summary>\r
/// <param name="query"></param>\r
- public void CreatePreviewSampe(string query)\r
+ public void CreatePreviewSample(string query)\r
{\r
Run(query);\r
}\r
Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
HbProcess = Process.Start(cliStart);\r
ProcessID = Main.GetCliProcess(before);\r
- CurrentQuery = query;\r
+\r
if (HbProcess != null)\r
ProcessHandle = HbProcess.MainWindowHandle; // Set the process Handle\r
\r
protected void Finish()\r
{\r
IsEncoding = false;\r
- CurrentQuery = String.Empty;\r
\r
//Growl\r
if (Properties.Settings.Default.growlQueue)\r
It may be used under the terms of the GNU General Public License. */\r
\r
using System;\r
-using Handbrake.Parsing;\r
\r
namespace Handbrake.EncodeQueue\r
{\r
using System.Windows.Forms;\r
using System.Xml.Serialization;\r
using Handbrake.Functions;\r
-using Handbrake.Parsing;\r
\r
namespace Handbrake.EncodeQueue\r
{\r
}\r
\r
/// <summary>\r
- /// Stops the current job.\r
+ /// Run through all the jobs on the queue.\r
/// </summary>\r
- public void End()\r
- {\r
- Stop();\r
- }\r
-\r
+ /// <param name="state"></param>\r
private void StartQueue(object state)\r
{\r
// Run through each item on the queue\r
/// <summary>\r
/// Get the build information from the required appcasts. Run before accessing the public vars.\r
/// </summary>\r
- public void getInfo(string input)\r
+ public void GetInfo(string input)\r
{\r
try\r
{\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
- } catch( Exception)\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
{\r
- // Ignore Error.\r
+ return;\r
}\r
}\r
\r
XmlDocument rssDoc = new XmlDocument();\r
rssDoc.Load(rssReader);\r
\r
- for (int i = 0; i < rssDoc.ChildNodes.Count; i++)\r
+ foreach (XmlNode t in rssDoc.ChildNodes)\r
{\r
- if (rssDoc.ChildNodes[i].Name == "rss")\r
- nodeRss = rssDoc.ChildNodes[i];\r
+ if (t.Name == "rss")\r
+ nodeRss = t;\r
}\r
\r
if (nodeRss != null)\r
- for (int i = 0; i < nodeRss.ChildNodes.Count; i++)\r
+ foreach (XmlNode t in nodeRss.ChildNodes)\r
{\r
- if (nodeRss.ChildNodes[i].Name == "channel")\r
- nodeChannel = nodeRss.ChildNodes[i];\r
+ if (t.Name == "channel")\r
+ nodeChannel = t;\r
}\r
\r
if (nodeChannel != null)\r
- for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)\r
+ foreach (XmlNode t in nodeChannel.ChildNodes)\r
{\r
- if (nodeChannel.ChildNodes[i].Name == "item")\r
- nodeItem = nodeChannel.ChildNodes[i];\r
+ if (t.Name == "item")\r
+ nodeItem = t;\r
}\r
\r
return nodeItem;\r
/// <summary>\r
/// Get Information about an update to HandBrake\r
/// </summary>\r
- public Uri descriptionUrl { get; set; }\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
+ 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
+ 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
+ public string DownloadFile { get; set; }\r
}\r
}
\ No newline at end of file
}\r
}\r
\r
-\r
/// <summary>\r
/// Begins checking for an update to HandBrake.\r
/// </summary>\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
+ reader.GetInfo(new StreamReader(response.GetResponseStream()).ReadToEnd());\r
\r
// Further parse the information\r
- string build = reader.build;\r
+ string build = reader.Build;\r
\r
int latest = int.Parse(build);\r
int current = Properties.Settings.Default.hb_build;\r
sr.Dispose();\r
\r
}\r
- catch (Exception exc)\r
+ catch (Exception)\r
{\r
Reset();\r
appendText = new StringBuilder();\r
MessageBox.Show(this, "Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
{\r
- Process.CreatePreviewSampe((string)state);\r
+ Process.CreatePreviewSample((string)state);\r
if (Process.HbProcess != null)\r
{\r
Process.HbProcess.WaitForExit();\r
{\r
public partial class frmUpdater : Form\r
{\r
- readonly AppcastReader _appcast;\r
+ readonly AppcastReader Appcast;\r
public frmUpdater(AppcastReader reader)\r
{\r
InitializeComponent();\r
\r
- _appcast = reader;\r
+ Appcast = reader;\r
GetRss();\r
SetVersions();\r
}\r
\r
private void GetRss()\r
{\r
- wBrowser.Url = _appcast.descriptionUrl;\r
+ wBrowser.Url = Appcast.DescriptionUrl;\r
}\r
\r
private void SetVersions()\r
{\r
string old = "(You have: " + Properties.Settings.Default.hb_version.Trim() + " / " + Properties.Settings.Default.hb_build.ToString().Trim() + ")";\r
- string newBuild = _appcast.version.Trim() + " (" + _appcast.build + ")";\r
+ string newBuild = Appcast.Version.Trim() + " (" + Appcast.Build + ")";\r
lbl_update_text.Text = "HandBrake " + newBuild + " is now available. " + old;\r
}\r
\r
private void btn_installUpdate_Click(object sender, EventArgs e)\r
{\r
- frmDownload download = new frmDownload(_appcast.downloadFile);\r
+ frmDownload download = new frmDownload(Appcast.DownloadFile);\r
download.ShowDialog();\r
this.Close();\r
}\r
\r
private void btn_skip_Click(object sender, EventArgs e)\r
{\r
- Properties.Settings.Default.skipversion = int.Parse(_appcast.build);\r
+ Properties.Settings.Default.skipversion = int.Parse(Appcast.Build);\r
Properties.Settings.Default.Save();\r
\r
this.Close();\r