From 5757d7c7295572f8dd8f078dcceddf8728e075f3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 19 Dec 2007 22:10:27 +0000 Subject: WinGui: - Some code clean up + removal of old unused code. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1137 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/CLI.cs | 23 -------- win/C#/Functions/RssReader.cs | 95 ++++++++++++---------------------- win/C#/Parsing/AudioTrack.cs | 1 - win/C#/Parsing/Chapter.cs | 1 - win/C#/Parsing/DVD.cs | 7 --- win/C#/Parsing/Parser.cs | 29 ----------- win/C#/Parsing/Subtitle.cs | 1 - win/C#/Parsing/Title.cs | 1 - win/C#/Properties/Settings.Designer.cs | 2 +- win/C#/Properties/Settings.settings | 2 +- win/C#/app.config | 2 +- win/C#/frmMain.cs | 5 +- 12 files changed, 39 insertions(+), 130 deletions(-) diff --git a/win/C#/Functions/CLI.cs b/win/C#/Functions/CLI.cs index 259a98c3a..b0b79d32f 100644 --- a/win/C#/Functions/CLI.cs +++ b/win/C#/Functions/CLI.cs @@ -60,28 +60,5 @@ namespace Handbrake.Functions } return hbProc; } - - public void killCLI() - { - try - { - hbProc.Kill(); - } - catch (Exception) - { - // No need to do anything. Chances are the process was already dead. - } - } - - public void closeCLI() - { - hbProc.Close(); - hbProc.Dispose(); - } - - public void setNull() - { - hbProc = new Process(); - } } } diff --git a/win/C#/Functions/RssReader.cs b/win/C#/Functions/RssReader.cs index 36d105d8d..ce8dd568b 100644 --- a/win/C#/Functions/RssReader.cs +++ b/win/C#/Functions/RssReader.cs @@ -55,11 +55,14 @@ namespace Handbrake.Functions return latestTitle; } + private string hb_versionInfo; + private string hb_version; + private string hb_build; + private string hb_file; - public string versionInfo() + public void getInfo() { readRss(); - string vinfo = ""; for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) { if (nodeChannel.ChildNodes[6].Name == "item") @@ -68,79 +71,49 @@ namespace Handbrake.Functions t = readRss(); if (nodeItem["title"].InnerText == t) { - vinfo = nodeItem["description"].InnerText; - break; - } - } - } + // Get the Version Information + hb_versionInfo = nodeItem["description"].InnerText; - return vinfo; - } - - public string version() - { - readRss(); - string vinfo = ""; - for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) - { - if (nodeChannel.ChildNodes[6].Name == "item") - { - nodeItem = nodeChannel.ChildNodes[0]; - string t = readRss(); - if (nodeItem["title"].InnerText == t) - { + // Get the version string input = nodeItem.InnerXml; Match ver = Regex.Match(input, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\"""); - vinfo = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", ""); + hb_version = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", ""); + + // Get the build number + input = nodeItem.InnerXml; + ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\"""); + hb_build = ver.ToString().Replace("sparkle:version=", "").Replace("\"", ""); + + // Get the update file + hb_file = nodeItem["windows"].InnerText; - break; } } } - return vinfo; + } + + public string versionInfo() + { + getInfo(); + return hb_versionInfo; + } + + public string version() + { + getInfo(); + return hb_version; } public string build() { - readRss(); - string vinfo = ""; - for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) - { - if (nodeChannel.ChildNodes[6].Name == "item") - { - nodeItem = nodeChannel.ChildNodes[0]; - string t = readRss(); - if (nodeItem["title"].InnerText == t) - { - string input = nodeItem.InnerXml; - Match ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\"""); - vinfo = ver.ToString().Replace("sparkle:version=", "").Replace("\"", ""); - break; - } - } - } - return vinfo; + getInfo(); + return hb_build; } public string downloadFile() { - readRss(); - string file = ""; - for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) - { - if (nodeChannel.ChildNodes[6].Name == "item") - { - nodeItem = nodeChannel.ChildNodes[0]; - t = readRss(); - if (nodeItem["title"].InnerText == t) - { - file = nodeItem["windows"].InnerText; - break; - } - } - } - - return file; - } + getInfo(); + return hb_file; + } } } \ No newline at end of file diff --git a/win/C#/Parsing/AudioTrack.cs b/win/C#/Parsing/AudioTrack.cs index 22861b9e6..95d9f307e 100644 --- a/win/C#/Parsing/AudioTrack.cs +++ b/win/C#/Parsing/AudioTrack.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using System.IO; using System.Text.RegularExpressions; diff --git a/win/C#/Parsing/Chapter.cs b/win/C#/Parsing/Chapter.cs index 6496354c9..caea54bb5 100644 --- a/win/C#/Parsing/Chapter.cs +++ b/win/C#/Parsing/Chapter.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using System.IO; using System.Text.RegularExpressions; diff --git a/win/C#/Parsing/DVD.cs b/win/C#/Parsing/DVD.cs index 62a40d81b..f0982a47c 100644 --- a/win/C#/Parsing/DVD.cs +++ b/win/C#/Parsing/DVD.cs @@ -1,14 +1,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Text.RegularExpressions; using System.Windows.Forms; using System.IO; -using System.Threading; -using System.Diagnostics; namespace Handbrake.Parsing { diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs index b3edc89d9..799e8a303 100644 --- a/win/C#/Parsing/Parser.cs +++ b/win/C#/Parsing/Parser.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using System.IO; using System.Text.RegularExpressions; using System.Windows.Forms; @@ -22,18 +21,6 @@ namespace Handbrake.Parsing /// The total number of titiles to be processed public delegate void ScanProgressEventHandler(object Sender, int CurrentTitle, int TitleCount); - /// - /// A delegate to handle encode progress updates - /// - /// The object which raised the event - /// The current task being processed from the queue - /// The total number of tasks in queue - /// The percentage this task is complete - /// The current encoding fps - /// The average encoding fps for this task - /// The estimated time remaining for this task to complete - public delegate void EncodeProgressEventHandler(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining); - /// /// A simple wrapper around a StreamReader to keep track of the entire output from a cli process /// @@ -66,7 +53,6 @@ namespace Handbrake.Parsing /// public event ScanProgressEventHandler OnScanProgress; - public event EncodeProgressEventHandler OnEncodeProgress; /// /// Default constructor for this object @@ -93,21 +79,6 @@ namespace Handbrake.Parsing { OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value)); } - m = Regex.Match(tmp, @"^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\.[0-9]*) %( \(([0-9]*\.[0-9]*) fps, avg ([0-9]*\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\))?"); - if (m.Success && OnEncodeProgress != null) - { - int currentTask = int.Parse(m.Groups[1].Value); - int totalTasks = int.Parse(m.Groups[2].Value); - float percent = float.Parse(m.Groups[3].Value, Functions.CLI.Culture); - float currentFps = m.Groups[5].Value == string.Empty ? 0.0F : float.Parse(m.Groups[5].Value, Functions.CLI.Culture); - float avgFps = m.Groups[6].Value == string.Empty ? 0.0F : float.Parse(m.Groups[6].Value, Functions.CLI.Culture); - TimeSpan remaining = TimeSpan.Zero; - if (m.Groups[7].Value != string.Empty) - { - remaining = TimeSpan.Parse(m.Groups[7].Value + ":" + m.Groups[8].Value + ":" + m.Groups[9].Value); - } - OnEncodeProgress(this, currentTask, totalTasks, percent, currentFps, avgFps, remaining); - } } catch (Exception exc) { diff --git a/win/C#/Parsing/Subtitle.cs b/win/C#/Parsing/Subtitle.cs index 8fb889f8f..6d83d2613 100644 --- a/win/C#/Parsing/Subtitle.cs +++ b/win/C#/Parsing/Subtitle.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using System.IO; using System.Text.RegularExpressions; diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index 744e5b619..b1f02d9c6 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using System.Drawing; using System.IO; using System.Windows.Forms; diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index 9fea5a39b..7c112d8a6 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -158,7 +158,7 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("1101")] + [global::System.Configuration.DefaultSettingValueAttribute("1000")] public int build { get { return ((int)(this["build"])); diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index 40cb829cb..2479d16ab 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -36,7 +36,7 @@ - 1101 + 1000 0 diff --git a/win/C#/app.config b/win/C#/app.config index 1b1b5194b..e019fd4a1 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -41,7 +41,7 @@ - 1101 + 1000 0 diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 407d00be7..863fb62e6 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -14,7 +14,6 @@ using System.Runtime.InteropServices; using System.Globalization; using System.Text.RegularExpressions; - namespace Handbrake { public partial class frmMain : Form @@ -1207,8 +1206,6 @@ namespace Handbrake public string GenerateTheQuery() { - - // Source tab #region source string source = text_source.Text; @@ -1859,6 +1856,7 @@ namespace Handbrake this.thisDVD = dvd; } + // Automatic File Naming public void autoName() { if (Properties.Settings.Default.autoNaming == "Checked") @@ -1921,6 +1919,7 @@ namespace Handbrake } } + // Chapter Marker Tab private void chapterNaming() { try -- cgit v1.2.3