From 06f3a36204082f77a6ec4657ee8d834cbcd2723a Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 25 Jul 2010 14:59:19 +0000 Subject: [PATCH] WinGui: - Cleanup stylecop warnings. Import new stylecop for resharper settings. git-svn-id: svn://localhost/HandBrake/trunk@3459 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/Filters.cs | 3 + win/C#/Controls/x264Panel.cs | 8 +- win/C#/Functions/AppcastReader.cs | 5 +- win/C#/Functions/Main.cs | 5 +- win/C#/Functions/PresetLoader.cs | 3 - win/C#/Functions/Win32.cs | 5 +- win/C#/HandBrake.5.0.ReSharper | 379 --------------------- win/C#/HandBrake.5.1.ReSharper | 337 +++++++++++++++++- .../Functions/Logging.cs | 3 + .../Functions/Win32.cs | 5 +- win/C#/HandBrake.ApplicationServices/Init.cs | 1 - .../Services/Encode.cs | 14 +- .../Services/Interfaces/IQueue.cs | 17 +- .../Services/Queue.cs | 7 +- win/C#/HandBrakeCS.csproj.ReSharper | 3 - win/C#/Presets/PresetsHandler.cs | 2 +- win/C#/Program.cs | 11 +- win/C#/Settings.StyleCop | 15 + win/C#/frmAddPreset.cs | 4 +- win/C#/frmDownload.cs | 61 ++-- win/C#/frmMain.cs | 15 +- win/C#/frmOptions.cs | 5 +- win/C#/frmQueue.cs | 1 + 23 files changed, 431 insertions(+), 478 deletions(-) delete mode 100644 win/C#/HandBrake.5.0.ReSharper delete mode 100644 win/C#/HandBrakeCS.csproj.ReSharper diff --git a/win/C#/Controls/Filters.cs b/win/C#/Controls/Filters.cs index 9f75f69d..dda8c954 100644 --- a/win/C#/Controls/Filters.cs +++ b/win/C#/Controls/Filters.cs @@ -8,6 +8,9 @@ namespace Handbrake.Controls using System; using System.Windows.Forms; + /// + /// The Filters Panel + /// public partial class Filters : UserControl { /// diff --git a/win/C#/Controls/x264Panel.cs b/win/C#/Controls/x264Panel.cs index 8d223f6a..1be38937 100644 --- a/win/C#/Controls/x264Panel.cs +++ b/win/C#/Controls/x264Panel.cs @@ -8,6 +8,9 @@ namespace Handbrake.Controls using System; using System.Windows.Forms; + /// + /// The x264 Panel + /// public partial class x264Panel : UserControl { /* @@ -38,7 +41,10 @@ namespace Handbrake.Controls { return rtf_x264Query.Text; } - set { rtf_x264Query.Text = value; } + set + { + rtf_x264Query.Text = value; + } } /// diff --git a/win/C#/Functions/AppcastReader.cs b/win/C#/Functions/AppcastReader.cs index e6bd64b0..6b4a4847 100644 --- a/win/C#/Functions/AppcastReader.cs +++ b/win/C#/Functions/AppcastReader.cs @@ -54,9 +54,8 @@ namespace Handbrake.Functions Match verShort = Regex.Match(result, @"sparkle:shortVersionString=""(([svn]*)([0-9.\s]*))\"""); this.Build = ver.ToString().Replace("sparkle:version=", string.Empty).Replace("\"", string.Empty); - this.Version = verShort.ToString().Replace("sparkle:shortVersionString=", string.Empty).Replace("\"", - string. - Empty); + this.Version = verShort.ToString().Replace("sparkle:shortVersionString=", string.Empty).Replace( + "\"", string.Empty); this.DownloadFile = nodeItem["windows"].InnerText; this.DescriptionUrl = new Uri(nodeItem["sparkle:releaseNotesLink"].InnerText); } diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 148f8f31..4d82fb13 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -411,6 +411,9 @@ namespace Handbrake.Functions /// /// Recover a queue from file. /// + /// + /// The encode Queue. + /// public static void RecoverQueue(IQueue encodeQueue) { DialogResult result = DialogResult.None; @@ -449,7 +452,7 @@ namespace Handbrake.Functions } /// - /// Checks if this HandBrake is running multiple instances + /// Gets a value indicating whether HandBrake is running in multi instance mode /// /// True if the UI has another instance running public static bool IsMultiInstance diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index 64980491..790d5116 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -26,9 +26,6 @@ namespace Handbrake.Functions /// /// Name of the preset /// - /// - /// Save picture settings in the preset - /// public static void LoadPreset(frmMain mainWindow, QueryParser presetQuery, string name) { #region Source diff --git a/win/C#/Functions/Win32.cs b/win/C#/Functions/Win32.cs index a5010268..982ba1e9 100644 --- a/win/C#/Functions/Win32.cs +++ b/win/C#/Functions/Win32.cs @@ -99,10 +99,7 @@ namespace Handbrake.Functions /// The lp buffer. /// [DllImport("kernel32.dll")] - public static extern void GlobalMemoryStatus - ( - ref MEMORYSTATUS lpBuffer - ); + public static extern void GlobalMemoryStatus(ref MEMORYSTATUS lpBuffer); /// /// Generate a Console Ctrl Event diff --git a/win/C#/HandBrake.5.0.ReSharper b/win/C#/HandBrake.5.0.ReSharper deleted file mode 100644 index 22ca7997..00000000 --- a/win/C#/HandBrake.5.0.ReSharper +++ /dev/null @@ -1,379 +0,0 @@ - - - - - SOLUTION - - - False - 1 - 1 - 1 - SEPARATE - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - False - False - 1 - 1 - False - - public - protected - internal - private - new - abstract - virtual - override - sealed - static - readonly - extern - unsafe - volatile - - False - False - False - False - True - ALWAYS_USE - ON_SINGLE_LINE - False - True - False - False - True - False - True - True - CHOP_IF_LONG - True - CHOP_IF_LONG - CHOP_IF_LONG - - - True - True - - - $object$_On$event$ - $event$Handler - - - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]]> - - - - - - $object$_On$event$ - $event$Handler - - - - - - - - - - - - - - $object$_On$event$ - $event$Handler - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/C#/HandBrake.5.1.ReSharper b/win/C#/HandBrake.5.1.ReSharper index 4c4f8817..22ca7997 100644 --- a/win/C#/HandBrake.5.1.ReSharper +++ b/win/C#/HandBrake.5.1.ReSharper @@ -5,6 +5,20 @@ SOLUTION + False + 1 + 1 + 1 + SEPARATE + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + False + False + 1 + 1 + False public protected @@ -21,12 +35,305 @@ unsafe volatile + False + False + False + False + True + ALWAYS_USE + ON_SINGLE_LINE + False + True + False + False + True + False + True + True + CHOP_IF_LONG + True + CHOP_IF_LONG + CHOP_IF_LONG - + + True + True + $object$_On$event$ $event$Handler + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> @@ -49,22 +356,24 @@ $object$_On$event$ $event$Handler + + + + + + + + + + + + + + + - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs b/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs index aba92dbb..8231ba6c 100644 --- a/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs +++ b/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs @@ -23,6 +23,9 @@ namespace HandBrake.ApplicationServices.Functions /// /// The Encode Job Object /// + /// + /// The create cli log header. + /// public static string CreateCliLogHeader(Job encJob) { StringBuilder logHeader = new StringBuilder(); diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs b/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs index a45d7441..98f22479 100644 --- a/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs +++ b/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs @@ -99,10 +99,7 @@ namespace HandBrake.ApplicationServices.Functions /// The lp buffer. /// [DllImport("kernel32.dll")] - public static extern void GlobalMemoryStatus - ( - ref MEMORYSTATUS lpBuffer - ); + public static extern void GlobalMemoryStatus(ref MEMORYSTATUS lpBuffer); /// /// Generate a Console Ctrl Event diff --git a/win/C#/HandBrake.ApplicationServices/Init.cs b/win/C#/HandBrake.ApplicationServices/Init.cs index e8f2e18a..bacf1323 100644 --- a/win/C#/HandBrake.ApplicationServices/Init.cs +++ b/win/C#/HandBrake.ApplicationServices/Init.cs @@ -140,6 +140,5 @@ namespace HandBrake.ApplicationServices /// Prevent system sleep /// public static bool PreventSleep; - } } diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs index 09099ba1..9ca8cdf5 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs @@ -252,14 +252,15 @@ namespace HandBrake.ApplicationServices.Services SendKeys.Send("^C"); SendKeys.Flush(); - //if (HbProcess != null) + /*/if (HbProcess != null) //{ // HbProcess.StandardInput.AutoFlush = true; // HbProcess.StandardInput.WriteLine("^c^z"); - //} + //}*/ } /* Helpers */ + /// /// Save a copy of the log to the users desired location or a default location /// if this feature is enabled in options. @@ -314,9 +315,6 @@ namespace HandBrake.ApplicationServices.Services private void HbProcess_Exited(object sender, EventArgs e) { IsEncoding = false; - - // ReadFile(null); - if (this.EncodeEnded != null) this.EncodeEnded(this, new EventArgs()); @@ -344,9 +342,6 @@ namespace HandBrake.ApplicationServices.Services /// /// Read the log file /// - /// - /// The object. - /// private void ReadFile() { logBuffer = new StringBuilder(); @@ -398,6 +393,9 @@ namespace HandBrake.ApplicationServices.Services /// /// Setup the logging. /// + /// + /// The encode Job. + /// private void SetupLogging(Job encodeJob) { string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; diff --git a/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IQueue.cs b/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IQueue.cs index 981f3c19..b489f75b 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IQueue.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IQueue.cs @@ -58,16 +58,6 @@ namespace HandBrake.ApplicationServices.Services.Interfaces int Count { get; } /// - /// Gets a value indicating whether IsEncoding. - /// - bool IsEncoding { get; } - - /// - /// Gets ActivityLog. - /// - string ActivityLog { get; } - - /// /// Adds an item to the queue. /// /// @@ -121,7 +111,12 @@ namespace HandBrake.ApplicationServices.Services.Interfaces /// /// Writes the current state of the queue in the form of a batch (.bat) file. /// - /// The location of the file to write the batch file to. + /// + /// The location of the file to write the batch file to. + /// + /// + /// The write batch script to file. + /// bool WriteBatchScriptToFile(string file); /// diff --git a/win/C#/HandBrake.ApplicationServices/Services/Queue.cs b/win/C#/HandBrake.ApplicationServices/Services/Queue.cs index 59c084f1..7500dfec 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Queue.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Queue.cs @@ -252,7 +252,12 @@ namespace HandBrake.ApplicationServices.Services /// /// Writes the current state of the queue in the form of a batch (.bat) file. /// - /// The location of the file to write the batch file to. + /// + /// The location of the file to write the batch file to. + /// + /// + /// The write batch script to file. + /// public bool WriteBatchScriptToFile(string file) { string queries = string.Empty; diff --git a/win/C#/HandBrakeCS.csproj.ReSharper b/win/C#/HandBrakeCS.csproj.ReSharper deleted file mode 100644 index 9b050787..00000000 --- a/win/C#/HandBrakeCS.csproj.ReSharper +++ /dev/null @@ -1,3 +0,0 @@ - - No - \ No newline at end of file diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs index 971a4785..d53a64dd 100644 --- a/win/C#/Presets/PresetsHandler.cs +++ b/win/C#/Presets/PresetsHandler.cs @@ -46,7 +46,7 @@ namespace Handbrake.Presets private List userPresets = new List(); /// - /// Last preset added + /// Gets or sets the Last preset added /// public Preset LastPresetAdded { get; set; } diff --git a/win/C#/Program.cs b/win/C#/Program.cs index 1c428c87..ff917467 100644 --- a/win/C#/Program.cs +++ b/win/C#/Program.cs @@ -12,10 +12,9 @@ namespace Handbrake using HandBrake.ApplicationServices; + using Handbrake.Presets; using Handbrake.Properties; - using Presets; - /// /// HandBrake Starts Here /// @@ -24,6 +23,9 @@ namespace Handbrake /// /// The main entry point for the application. /// + /// + /// The args. + /// [STAThread] public static void Main(string[] args) { @@ -121,9 +123,6 @@ namespace Handbrake } } - - public static int InstanceId = 0; - - + public static int InstanceId; } } \ No newline at end of file diff --git a/win/C#/Settings.StyleCop b/win/C#/Settings.StyleCop index 73638a71..a9622d88 100644 --- a/win/C#/Settings.StyleCop +++ b/win/C#/Settings.StyleCop @@ -87,6 +87,11 @@ False + + + False + + @@ -102,6 +107,11 @@ False + + + False + + @@ -222,6 +232,11 @@ False + + + False + + diff --git a/win/C#/frmAddPreset.cs b/win/C#/frmAddPreset.cs index 22ba835d..8a497d7a 100644 --- a/win/C#/frmAddPreset.cs +++ b/win/C#/frmAddPreset.cs @@ -28,7 +28,9 @@ namespace Handbrake /// /// Initializes a new instance of the class. /// - /// + /// + /// The Main Window + /// /// /// The preset handler. /// diff --git a/win/C#/frmDownload.cs b/win/C#/frmDownload.cs index a3067e17..e7f06f6e 100644 --- a/win/C#/frmDownload.cs +++ b/win/C#/frmDownload.cs @@ -12,15 +12,18 @@ namespace Handbrake using System.Threading; using System.Windows.Forms; + /// + /// The Download Window + /// public partial class frmDownload : Form { - private readonly Thread _downloadThread; - private Stream _responceStream; - private Stream _loacalStream; - private HttpWebRequest _webRequest; - private HttpWebResponse _webResponse; - private static int _progress; - private bool _killThread; + private readonly Thread downloadThread; + private Stream responceStream; + private Stream localStream; + private HttpWebRequest webRequest; + private HttpWebResponse webResponse; + private static int progress; + private bool killThread; private delegate void UpdateProgessCallback(long bytesRead, long totalBytes); @@ -32,14 +35,14 @@ namespace Handbrake { InitializeComponent(); - _downloadThread = new Thread(Download); - _downloadThread.Start(filename); + this.downloadThread = new Thread(Download); + this.downloadThread.Start(filename); } private void Download(object file) { string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe"); - string hbUpdate = (string) file; + string hbUpdate = (string)file; WebClient wcDownload = new WebClient(); try @@ -47,29 +50,29 @@ namespace Handbrake if (File.Exists(tempPath)) File.Delete(tempPath); - _webRequest = (HttpWebRequest) WebRequest.Create(hbUpdate); - _webRequest.Credentials = CredentialCache.DefaultCredentials; - _webResponse = (HttpWebResponse) _webRequest.GetResponse(); - long fileSize = _webResponse.ContentLength; + this.webRequest = (HttpWebRequest)WebRequest.Create(hbUpdate); + this.webRequest.Credentials = CredentialCache.DefaultCredentials; + this.webResponse = (HttpWebResponse)this.webRequest.GetResponse(); + long fileSize = this.webResponse.ContentLength; - _responceStream = wcDownload.OpenRead(hbUpdate); - _loacalStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None); + this.responceStream = wcDownload.OpenRead(hbUpdate); + this.localStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None); int bytesSize; byte[] downBuffer = new byte[2048]; long flength = 0; - while ((bytesSize = _responceStream.Read(downBuffer, 0, downBuffer.Length)) > 0) + while ((bytesSize = this.responceStream.Read(downBuffer, 0, downBuffer.Length)) > 0) { - if (_killThread) + if (this.killThread) return; - _loacalStream.Write(downBuffer, 0, bytesSize); - flength = _loacalStream.Length; - Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] {_loacalStream.Length, fileSize}); + this.localStream.Write(downBuffer, 0, bytesSize); + flength = this.localStream.Length; + Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] {this.localStream.Length, fileSize}); } - _responceStream.Close(); - _loacalStream.Close(); + this.responceStream.Close(); + this.localStream.Close(); if (flength != fileSize) Invoke(new DownloadFailedCallback(this.DownloadFailed)); @@ -85,8 +88,8 @@ namespace Handbrake private void UpdateProgress(long bytesRead, long totalBytes) { long p = (bytesRead * 100) / totalBytes; - int.TryParse(p.ToString(), out _progress); - progress_download.Value = _progress; + int.TryParse(p.ToString(), out progress); + progress_download.Value = progress; lblProgress.Text = (bytesRead / 1024) + "k of " + (totalBytes / 1024) + "k "; } @@ -108,11 +111,11 @@ namespace Handbrake private void btn_cancel_Click(object sender, EventArgs e) { - _killThread = true; + this.killThread = true; lblProgress.Text = "Cancelling ..."; - if (_webResponse != null) _webResponse.Close(); - if (_responceStream != null) _responceStream.Close(); - if (_loacalStream != null) _loacalStream.Close(); + if (this.webResponse != null) this.webResponse.Close(); + if (this.responceStream != null) this.responceStream.Close(); + if (this.localStream != null) this.localStream.Close(); this.Close(); } } diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 83135c6c..642eb1f8 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -26,6 +26,9 @@ namespace Handbrake using Presets; using Properties; + /// + /// The Main Window + /// public partial class frmMain : Form { // Objects which may be used by one or more other objects ************* @@ -910,7 +913,7 @@ namespace Handbrake MessageBox.Show("This feature has not been implimented yet.", "Not Implimented", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; - SaveFileDialog savefiledialog = new SaveFileDialog(); + /*SaveFileDialog savefiledialog = new SaveFileDialog(); savefiledialog.Filter = "plist|*.plist"; if (treeView_presets.SelectedNode != null) @@ -921,7 +924,7 @@ namespace Handbrake Preset preset = presetHandler.GetPreset(treeView_presets.SelectedNode.Text); PlistPresetHandler.Export(savefiledialog.FileName, preset); } - } + }*/ } #endregion @@ -1126,7 +1129,6 @@ namespace Handbrake lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue"; queueWindow.Show(); - } /// @@ -1288,7 +1290,6 @@ namespace Handbrake int id; if (int.TryParse(driveId, out id)) { - this.dvdDrivePath = drives[id].RootDirectory; this.dvdDriveLabel = drives[id].VolumeLabel; @@ -1761,7 +1762,7 @@ namespace Handbrake } } - private double _cachedCqStep = Properties.Settings.Default.x264cqstep; + private double cachedCqStep = Properties.Settings.Default.x264cqstep; /// /// Update the CQ slider for x264 for a new CQ step. This is set from option @@ -1769,7 +1770,7 @@ namespace Handbrake public void setQualityFromSlider() { // Work out the current RF value. - double cqStep = _cachedCqStep; + double cqStep = this.cachedCqStep; double rfValue = 51.0 - slider_videoQuality.Value * cqStep; // Change the maximum value for the slider @@ -1788,7 +1789,7 @@ namespace Handbrake } // Cache the CQ step for the next calculation - _cachedCqStep = Properties.Settings.Default.x264cqstep; + this.cachedCqStep = Properties.Settings.Default.x264cqstep; } private void slider_videoQuality_Scroll(object sender, EventArgs e) diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index 4475d907..6af23b0e 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -10,12 +10,15 @@ namespace Handbrake using System.Diagnostics; using System.Globalization; using System.Windows.Forms; - using Functions; using HandBrake.ApplicationServices; + using Handbrake.Functions; using Handbrake.Properties; + /// + /// The Options Window + /// public partial class frmOptions : Form { private frmMain mainWindow; diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 7d52ddef..e4c5089f 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -425,6 +425,7 @@ namespace Handbrake } /* Right Click Menu */ + /// /// Handle the Move Up Menu Item /// -- 2.11.0