diff options
author | sr55 <[email protected]> | 2009-01-08 20:11:26 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-01-08 20:11:26 +0000 |
commit | 979826e24b3f187c3b488da47b720234c93f293d (patch) | |
tree | 1341bb819559c40cd68ff39237fc354aa6f27dea /win/C# | |
parent | a385d189c2830994e460b8739546825d7f4418d2 (diff) |
WinGui:
- Code cleanup. Remoes old using tags, removes unused code, cleans up some functions to make them shorter/more readable etc.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2069 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/Functions/AppcastReader.cs | 3 | ||||
-rw-r--r-- | win/C#/Functions/Encode.cs | 2 | ||||
-rw-r--r-- | win/C#/Functions/Main.cs | 3 | ||||
-rw-r--r-- | win/C#/Functions/QueryParser.cs | 575 | ||||
-rw-r--r-- | win/C#/Parsing/AudioTrack.cs | 70 | ||||
-rw-r--r-- | win/C#/Parsing/Chapter.cs | 29 | ||||
-rw-r--r-- | win/C#/Parsing/DVD.cs | 26 | ||||
-rw-r--r-- | win/C#/Parsing/Parser.cs | 3 | ||||
-rw-r--r-- | win/C#/Parsing/Subtitle.cs | 28 | ||||
-rw-r--r-- | win/C#/Parsing/Title.cs | 108 | ||||
-rw-r--r-- | win/C#/Presets/PresetsHandler.cs | 1 | ||||
-rw-r--r-- | win/C#/Presets/preset.cs | 44 | ||||
-rw-r--r-- | win/C#/Queue/QueueHandler.cs | 2 | ||||
-rw-r--r-- | win/C#/Queue/QueueItem.cs | 37 | ||||
-rw-r--r-- | win/C#/frmAbout.cs | 11 | ||||
-rw-r--r-- | win/C#/frmActivityWindow.cs | 6 | ||||
-rw-r--r-- | win/C#/frmAddPreset.cs | 6 | ||||
-rw-r--r-- | win/C#/frmDownload.cs | 1 | ||||
-rw-r--r-- | win/C#/frmGenPreview.cs | 7 | ||||
-rw-r--r-- | win/C#/frmMain/PresetLoader.cs | 2 | ||||
-rw-r--r-- | win/C#/frmOptions.cs | 5 | ||||
-rw-r--r-- | win/C#/frmPreview.cs | 9 | ||||
-rw-r--r-- | win/C#/frmQueue.cs | 8 | ||||
-rw-r--r-- | win/C#/frmReadDVD.cs | 7 | ||||
-rw-r--r-- | win/C#/frmSplashScreen.cs | 7 | ||||
-rw-r--r-- | win/C#/frmUpdater.cs | 3 |
26 files changed, 330 insertions, 673 deletions
diff --git a/win/C#/Functions/AppcastReader.cs b/win/C#/Functions/AppcastReader.cs index e14d2c1a7..11f75fe09 100644 --- a/win/C#/Functions/AppcastReader.cs +++ b/win/C#/Functions/AppcastReader.cs @@ -4,9 +4,6 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-using System;
-using System.Collections.Generic;
-using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index 99db0bc94..b6a4a0a43 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -5,8 +5,6 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections.Generic;
-using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
using System.Globalization;
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 52e4e0e04..1f14766c5 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -6,11 +6,8 @@ using System;
using System.Collections;
-using System.Text;
using System.Windows.Forms;
-using System.Globalization;
using System.IO;
-using System.Drawing;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Collections.Generic;
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index ae53f467b..6c1d768d5 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -5,774 +5,611 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections.Generic;
-using System.Text;
+using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Forms;
-using System.Globalization;
namespace Handbrake.Functions
{
- class QueryParser
+ internal class QueryParser
{
- static readonly private CultureInfo Culture = new CultureInfo("en-US", false);
+ private static readonly CultureInfo Culture = new CultureInfo("en-US", false);
- // All the Main Window GUI options
#region Varibles
#region Source
+
+ private int q_chaptersFinish;
+ private int q_chaptersStart;
private int q_dvdTitle;
+
/// <summary>
/// Returns an Integer
/// DVD Title number.
/// </summary>
public int DVDTitle
{
- get
- {
- return this.q_dvdTitle;
- }
+ get { return q_dvdTitle; }
}
- private int q_chaptersStart;
/// <summary>
/// Returns an Int
/// DVD Chapter number or chapter range.
/// </summary>
public int DVDChapterStart
{
- get
- {
- return this.q_chaptersStart;
- }
+ get { return q_chaptersStart; }
}
- private int q_chaptersFinish;
/// <summary>
/// Returns an Int
/// DVD Chapter number or chapter range.
/// </summary>
public int DVDChapterFinish
{
- get
- {
- return this.q_chaptersFinish;
- }
+ get { return q_chaptersFinish; }
}
-#endregion
+
+ #endregion
#region Destination
+
private string q_format;
+ private string q_videoEncoder;
+
/// <summary>
/// Returns a String
/// Full path of the destination.
/// </summary>
public string Format
{
- get
- {
- return this.q_format;
- }
+ get { return q_format; }
}
- private string q_videoEncoder;
/// <summary>
/// Returns an String
/// The Video Encoder used.
/// </summary>
public string VideoEncoder
{
- get
- {
- return this.q_videoEncoder;
- }
+ get { return q_videoEncoder; }
}
+
#endregion
#region Picture Settings
+
+ private Boolean q_anamorphic;
+ private Boolean q_chapterMarkers;
+ private string q_cropbottom;
+ private string q_cropLeft;
+ private string q_cropRight;
+ private string q_croptop;
+ private string q_cropValues;
+ private int q_deBlock;
+ private Boolean q_decomb;
+ private string q_deinterlace;
+ private string q_denoise;
+ private Boolean q_detelecine;
+ private Boolean q_looseAnamorphic;
+ private int q_maxHeight;
+ private int q_maxWidth;
+ private int q_videoHeight;
private int q_videoWidth;
+
/// <summary>
/// Returns an Int
/// The selected Width for the encoding.
/// </summary>
public int Width
{
- get
- {
- return this.q_videoWidth;
- }
+ get { return q_videoWidth; }
}
- private int q_videoHeight;
/// <summary>
/// Returns an Int
/// The selected Height for the encoding.
/// </summary>
public int Height
{
- get
- {
- return this.q_videoHeight;
- }
+ get { return q_videoHeight; }
}
- private int q_maxWidth;
/// <summary>
/// Returns an Int
/// The selected Width for the encoding.
/// </summary>
public int MaxWidth
{
- get
- {
- return this.q_maxWidth;
- }
+ get { return q_maxWidth; }
}
- private int q_maxHeight;
/// <summary>
/// Returns an Int
/// The selected Height for the encoding.
/// </summary>
public int MaxHeight
{
- get
- {
- return this.q_maxHeight;
- }
+ get { return q_maxHeight; }
}
- private string q_cropValues;
/// <summary>
/// Returns an String
/// Cropping values.
/// </summary>
public string CropValues
{
- get
- {
- return this.q_cropValues;
- }
+ get { return q_cropValues; }
}
- private string q_croptop;
/// <summary>
/// Returns an String
/// Cropping values.
/// </summary>
public string CropTop
{
- get
- {
- return this.q_croptop;
- }
+ get { return q_croptop; }
}
- private string q_cropbottom;
/// <summary>
/// Returns an String
/// Cropping values.
/// </summary>
public string CropBottom
{
- get
- {
- return this.q_cropbottom;
- }
+ get { return q_cropbottom; }
}
- private string q_cropLeft;
/// <summary>
/// Returns an String
/// Cropping values.
/// </summary>
public string CropLeft
{
- get
- {
- return this.q_cropLeft;
- }
+ get { return q_cropLeft; }
}
- private string q_cropRight;
/// <summary>
/// Returns an String
/// Cropping values.
/// </summary>
public string CropRight
{
- get
- {
- return this.q_cropRight;
- }
+ get { return q_cropRight; }
}
- private Boolean q_detelecine;
/// <summary>
/// Returns a boolean to indicate wither DeTelecine is on or off
/// </summary>
public Boolean DeTelecine
{
- get
- {
- return this.q_detelecine;
- }
+ get { return q_detelecine; }
}
- private int q_deBlock;
/// <summary>
/// Returns a boolean to indicate wither DeBlock is on or off.
/// </summary>
public int DeBlock
{
- get
- {
- return this.q_deBlock;
- }
+ get { return q_deBlock; }
}
- private string q_deinterlace;
/// <summary>
/// Returns a string with the De-Interlace option used.
/// </summary>
public string DeInterlace
{
- get
- {
- return this.q_deinterlace;
- }
+ get { return q_deinterlace; }
}
- private string q_denoise;
/// <summary>
/// Returns a string with the DeNoise option used.
/// </summary>
public string DeNoise
{
- get
- {
- return this.q_denoise;
- }
+ get { return q_denoise; }
}
- private Boolean q_decomb;
/// <summary>
/// Returns a string with the DeNoise option used.
/// </summary>
public Boolean Decomb
{
- get
- {
- return this.q_decomb;
- }
+ get { return q_decomb; }
}
- private Boolean q_anamorphic;
/// <summary>
/// Returns a boolean to indicate wither Anamorphic is on or off.
/// </summary>
public Boolean Anamorphic
{
- get
- {
- return this.q_anamorphic;
- }
+ get { return q_anamorphic; }
}
- private Boolean q_looseAnamorphic;
/// <summary>
/// Returns a boolean to indicate wither Anamorphic is on or off.
/// </summary>
public Boolean LooseAnamorphic
{
- get
- {
- return this.q_looseAnamorphic;
- }
+ get { return q_looseAnamorphic; }
}
- private Boolean q_chapterMarkers;
/// <summary>
/// Returns a boolean to indicate wither Chapter Markers is on or off.
/// </summary>
public Boolean ChapterMarkers
{
- get
- {
- return this.q_chapterMarkers;
- }
+ get { return q_chapterMarkers; }
}
+
#endregion
#region Video Settings
+
+ private string q_avgBitrate;
private Boolean q_grayscale;
+ private Boolean q_ipodAtom;
+ private Boolean q_largeMp4;
+ private Boolean q_optimizeMp4;
+ private Boolean q_turboFirst;
+
+ private Boolean q_twoPass;
+ private string q_videoFramerate;
+ private int q_videoQuality;
+ private string q_videoTargetSize;
+
/// <summary>
/// Returns a boolean to indicate wither Grayscale is on or off.
/// </summary>
public Boolean Grayscale
{
- get
- {
- return this.q_grayscale;
- }
+ get { return q_grayscale; }
}
- private Boolean q_twoPass;
/// <summary>
/// Returns a boolean to indicate wither Two Pass Encoding is on or off.
/// </summary>
public Boolean TwoPass
{
- get
- {
- return this.q_twoPass;
- }
+ get { return q_twoPass; }
}
- private Boolean q_turboFirst;
/// <summary>
/// Returns a boolean to indicate wither Chapter Markers is on or off.
/// </summary>
public Boolean TurboFirstPass
{
- get
- {
- return this.q_turboFirst;
- }
+ get { return q_turboFirst; }
}
- private Boolean q_largeMp4;
/// <summary>
/// Returns a boolean to indicate wither Larger MP4 files is on or off.
/// </summary>
public Boolean LargeMP4
{
- get
- {
- return this.q_largeMp4;
- }
+ get { return q_largeMp4; }
}
- private Boolean q_ipodAtom;
/// <summary>
/// Returns a boolean to indicate wither Larger MP4 files is on or off.
/// </summary>
public Boolean IpodAtom
{
- get
- {
- return this.q_ipodAtom;
- }
+ get { return q_ipodAtom; }
}
- private Boolean q_optimizeMp4;
/// <summary>
/// Returns a boolean to indicate wither Larger MP4 files is on or off.
/// </summary>
public Boolean OptimizeMP4
{
- get
- {
- return this.q_optimizeMp4;
- }
+ get { return q_optimizeMp4; }
}
- private string q_videoFramerate;
/// <summary>
/// Returns a string with the video Framerate
/// </summary>
public string VideoFramerate
{
- get
- {
- return this.q_videoFramerate;
- }
+ get { return q_videoFramerate; }
}
- private string q_avgBitrate;
/// <summary>
/// Returns a string with the average video bitrate
/// </summary>
public string AverageVideoBitrate
{
- get
- {
- return this.q_avgBitrate;
- }
+ get { return q_avgBitrate; }
}
- private string q_videoTargetSize;
/// <summary>
/// Returns a string with the video target size
/// </summary>
public string VideoTargetSize
{
- get
- {
- return this.q_videoTargetSize;
- }
+ get { return q_videoTargetSize; }
}
- private int q_videoQuality;
/// <summary>
/// Returns a int with the video quality value
/// </summary>
public int VideoQuality
{
- get
- {
- return this.q_videoQuality;
- }
+ get { return q_videoQuality; }
}
#endregion
#region Audio Settings
+
+ private string q_audioBitrate1;
+ private string q_audioBitrate2;
+ private string q_audioBitrate3;
+ private string q_audioBitrate4;
+ private string q_audioEncoder1;
+ private string q_audioEncoder2;
+ private string q_audioEncoder3;
+ private string q_audioEncoder4;
+ private string q_audioSamplerate1;
+ private string q_audioSamplerate2;
+ private string q_audioSamplerate3;
+ private string q_audioSamplerate4;
private string q_audioTrack1;
+ private string q_audioTrack2;
+ private string q_audioTrack3;
+ private string q_audioTrack4;
+ private string q_audioTrackMix1;
+ private string q_audioTrackMix2;
+ private string q_audioTrackMix3;
+ private string q_audioTrackMix4;
+ private double q_drc1;
+ private double q_drc2;
+ private double q_drc3;
+ private double q_drc4;
+ private Boolean q_forcedSubs;
+ private string q_subtitles;
+
/// <summary>
/// Returns a string with the selected Audio track
/// </summary>
public string AudioTrack1
{
- get
- {
- return this.q_audioTrack1;
- }
+ get { return q_audioTrack1; }
}
- private string q_audioTrack2;
/// <summary>
/// Returns a string with the selected Audio track
/// </summary>
public string AudioTrack2
{
- get
- {
- return this.q_audioTrack2;
- }
+ get { return q_audioTrack2; }
}
- private string q_audioTrack3;
/// <summary>
/// Returns a string with the selected Audio track
/// </summary>
public string AudioTrack3
{
- get
- {
- return this.q_audioTrack3;
- }
+ get { return q_audioTrack3; }
}
- private string q_audioTrack4;
/// <summary>
/// Returns a string with the selected Audio track
/// </summary>
public string AudioTrack4
{
- get
- {
- return this.q_audioTrack4;
- }
+ get { return q_audioTrack4; }
}
- private string q_audioTrackMix1;
/// <summary>
/// Returns a string with the First selected Audio track Mix
/// </summary>
public string AudioTrackMix1
{
- get
- {
- return this.q_audioTrackMix1;
- }
+ get { return q_audioTrackMix1; }
}
- private string q_audioTrackMix2;
/// <summary>
/// Returns a string with the First selected Audio track Mix
/// </summary>
public string AudioTrackMix2
{
- get
- {
- return this.q_audioTrackMix2;
- }
+ get { return q_audioTrackMix2; }
}
- private string q_audioTrackMix3;
/// <summary>
/// Returns a string with the First selected Audio track Mix
/// </summary>
public string AudioTrackMix3
{
- get
- {
- return this.q_audioTrackMix3;
- }
+ get { return q_audioTrackMix3; }
}
- private string q_audioTrackMix4;
/// <summary>
/// Returns a string with the First selected Audio track Mix
/// </summary>
public string AudioTrackMix4
{
- get
- {
- return this.q_audioTrackMix4;
- }
+ get { return q_audioTrackMix4; }
}
- private string q_audioEncoder1;
/// <summary>
/// Returns an String
/// The Audio Encoder used.
/// </summary>
public string AudioEncoder1
{
- get
- {
- return this.q_audioEncoder1;
- }
+ get { return q_audioEncoder1; }
}
- private string q_audioEncoder2;
/// <summary>
/// Returns an String
/// The Audio Encoder used.
/// </summary>
public string AudioEncoder2
{
- get
- {
- return this.q_audioEncoder2;
- }
+ get { return q_audioEncoder2; }
}
- private string q_audioEncoder3;
/// <summary>
/// Returns an String
/// The Audio Encoder used.
/// </summary>
public string AudioEncoder3
{
- get
- {
- return this.q_audioEncoder3;
- }
+ get { return q_audioEncoder3; }
}
- private string q_audioEncoder4;
/// <summary>
/// Returns an String
/// The Audio Encoder used.
/// </summary>
public string AudioEncoder4
{
- get
- {
- return this.q_audioEncoder4;
- }
+ get { return q_audioEncoder4; }
}
- private string q_audioBitrate1;
/// <summary>
/// Returns a string with the audio bitrate
/// </summary>
public string AudioBitrate1
{
- get
- {
- return this.q_audioBitrate1;
- }
+ get { return q_audioBitrate1; }
}
- private string q_audioBitrate2;
/// <summary>
/// Returns a string with the audio bitrate
/// </summary>
public string AudioBitrate2
{
- get
- {
- return this.q_audioBitrate2;
- }
+ get { return q_audioBitrate2; }
}
- private string q_audioBitrate3;
/// <summary>
/// Returns a string with the audio bitrate
/// </summary>
public string AudioBitrate3
{
- get
- {
- return this.q_audioBitrate3;
- }
+ get { return q_audioBitrate3; }
}
- private string q_audioBitrate4;
/// <summary>
/// Returns a string with the audio bitrate
/// </summary>
public string AudioBitrate4
{
- get
- {
- return this.q_audioBitrate4;
- }
+ get { return q_audioBitrate4; }
}
- private string q_audioSamplerate1;
/// <summary>
/// Returns a string with the audio sample rate
/// </summary>
public string AudioSamplerate1
{
- get
- {
- return this.q_audioSamplerate1;
- }
+ get { return q_audioSamplerate1; }
}
- private string q_audioSamplerate2;
/// <summary>
/// Returns a string with the audio sample rate
/// </summary>
public string AudioSamplerate2
{
- get
- {
- return this.q_audioSamplerate2;
- }
+ get { return q_audioSamplerate2; }
}
- private string q_audioSamplerate3;
/// <summary>
/// Returns a string with the audio sample rate
/// </summary>
public string AudioSamplerate3
{
- get
- {
- return this.q_audioSamplerate3;
- }
+ get { return q_audioSamplerate3; }
}
- private string q_audioSamplerate4;
/// <summary>
/// Returns a string with the audio sample rate
/// </summary>
public string AudioSamplerate4
{
- get
- {
- return this.q_audioSamplerate4;
- }
+ get { return q_audioSamplerate4; }
}
- private double q_drc1;
/// <summary>
/// Returns a string with the selected subtitle track
/// </summary>
public double DRC1
{
- get
- {
- return this.q_drc1;
- }
+ get { return q_drc1; }
}
- private double q_drc2;
/// <summary>
/// Returns a string with the selected subtitle track
/// </summary>
public double DRC2
{
- get
- {
- return this.q_drc2;
- }
+ get { return q_drc2; }
}
- private double q_drc3;
/// <summary>
/// Returns a string with the selected subtitle track
/// </summary>
public double DRC3
{
- get
- {
- return this.q_drc3;
- }
+ get { return q_drc3; }
}
- private double q_drc4;
/// <summary>
/// Returns a string with the selected subtitle track
/// </summary>
public double DRC4
{
- get
- {
- return this.q_drc4;
- }
+ get { return q_drc4; }
}
- private string q_subtitles;
/// <summary>
/// Returns a string with the selected subtitle track
/// </summary>
public string Subtitles
{
- get
- {
- return this.q_subtitles;
- }
+ get { return q_subtitles; }
}
- private Boolean q_forcedSubs;
/// <summary>
/// Returns a string with the selected subtitle track
/// </summary>
public Boolean ForcedSubtitles
{
- get
- {
- return this.q_forcedSubs;
- }
+ get { return q_forcedSubs; }
}
#endregion
#region Other
+
private string q_h264;
+ private Boolean q_verbose;
+
/// <summary>
/// Returns a string with the Advanced H264 query string
/// </summary>
public string H264Query
{
- get
- {
- return this.q_h264;
- }
+ get { return q_h264; }
}
- private Boolean q_verbose;
+
/// <summary>
/// Returns a string with the Advanced H264 query string
/// </summary>
public Boolean Verbose
{
- get
- {
- return this.q_verbose;
- }
+ get { return q_verbose; }
}
+
#endregion
#endregion
+ // All the Main Window GUI options
+
/// <summary>
/// Takes in a query which can be in any order and parses it.
/// All varibles are then set so they can be used elsewhere.
@@ -781,9 +618,10 @@ namespace Handbrake.Functions /// <returns>A Parsed Query</returns>
public static QueryParser Parse(String input)
{
- QueryParser thisQuery = new QueryParser();
+ var thisQuery = new QueryParser();
#region Regular Expressions
+
// Useful Destination Finder
//Regex r1 = new Regex(@"(-i)(?:\s\"")([a-zA-Z0-9?';!^%&*()_\-:\\\s\.]+)(?:\"")");
//Match source = r1.Match(input.Replace('"', '\"'));
@@ -830,15 +668,16 @@ namespace Handbrake.Functions Match audioTrack3 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*)");
Match audioTrack4 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*),([0-9]*)");
- Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)");
+ Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)");
Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*)");
Match audioTrack3Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");
- Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");
+ Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");
Match audioEncoder1 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*)");
Match audioEncoder2 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
Match audioEncoder3 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
- Match audioEncoder4 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
+ Match audioEncoder4 = Regex.Match(input,
+ @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
Match audioBitrate1 = Regex.Match(input, @"-B ([0-9auto]*)");
Match audioBitrate2 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*)");
@@ -864,18 +703,21 @@ namespace Handbrake.Functions //Program Options
Match verbose = Regex.Match(input, @" -v");
+
#endregion
#region Set Varibles
+
try
{
#region Source Tab
- if (title.Success != false)
- thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));
- if (chapters.Success != false)
+ if (title.Success)
+ thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));
+
+ if (chapters.Success)
{
- string[] actTitles = new string[2];
+ var actTitles = new string[2];
actTitles = chapters.ToString().Replace("-c ", "").Split('-');
thisQuery.q_chaptersStart = int.Parse(actTitles[0]);
if (actTitles.Length > 1)
@@ -887,7 +729,7 @@ namespace Handbrake.Functions thisQuery.q_chaptersFinish = thisQuery.q_chaptersStart;
}
- if (format.Success != false)
+ if (format.Success)
thisQuery.q_format = format.ToString().Replace("-f ", "");
#endregion
@@ -919,22 +761,22 @@ namespace Handbrake.Functions #region Picture Tab
- if (width.Success != false)
+ if (width.Success)
thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", ""));
- if (height.Success != false)
+ if (height.Success)
thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));
- if (maxWidth.Success != false)
+ if (maxWidth.Success)
thisQuery.q_maxWidth = int.Parse(maxWidth.ToString().Replace("-X ", ""));
- if (maxHeight.Success != false)
+ if (maxHeight.Success)
thisQuery.q_maxHeight = int.Parse(maxHeight.ToString().Replace("-Y ", ""));
- if (crop.Success != false)
+ if (crop.Success)
{
thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");
- string[] actCropValues = new string[3];
+ var actCropValues = new string[3];
actCropValues = thisQuery.q_cropValues.Split(':');
thisQuery.q_croptop = actCropValues[0];
thisQuery.q_cropbottom = actCropValues[1];
@@ -945,7 +787,7 @@ namespace Handbrake.Functions // Deblock Slider
string deblockValue = "";
thisQuery.q_deBlock = 0;
- if (deblock.Success != false)
+ if (deblock.Success)
deblockValue = deblock.ToString().Replace("--deblock=", "");
if (deblockValue != "")
@@ -955,9 +797,9 @@ namespace Handbrake.Functions thisQuery.q_decomb = decomb.Success;
thisQuery.q_deinterlace = "None";
- if (deinterlace.Success != false)
+ if (deinterlace.Success)
{
- switch (deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"",""))
+ switch (deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", ""))
{
case "fast":
thisQuery.q_deinterlace = "Fast";
@@ -978,7 +820,7 @@ namespace Handbrake.Functions }
thisQuery.q_denoise = "None";
- if (denoise.Success != false)
+ if (denoise.Success)
{
switch (denoise.ToString().Replace("--denoise=", "").Replace("\"", ""))
{
@@ -995,36 +837,36 @@ namespace Handbrake.Functions thisQuery.q_denoise = "None";
break;
}
-
}
thisQuery.q_anamorphic = anamorphic.Success;
- if (chapterMarkersFileMode.Success == true || chapterMarkers.Success == true)
+ if (chapterMarkersFileMode.Success || chapterMarkers.Success)
thisQuery.q_chapterMarkers = true;
-
+
thisQuery.q_looseAnamorphic = lanamorphic.Success;
#endregion
-
+
#region Video Settings Tab
+
thisQuery.q_grayscale = grayscale.Success;
thisQuery.q_twoPass = twoPass.Success;
thisQuery.q_turboFirst = turboFirstPass.Success;
thisQuery.q_largeMp4 = largerMp4.Success;
- if (videoFramerate.Success != false)
+ if (videoFramerate.Success)
thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ", "");
else
thisQuery.q_videoFramerate = "Same as source";
- if (videoBitrate.Success != false)
+ if (videoBitrate.Success)
thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");
- if (videoFilesize.Success != false)
+ if (videoFilesize.Success)
thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", "");
double qConvert = 0;
- if (videoQuality.Success != false)
+ if (videoQuality.Success)
{
- qConvert = double.Parse(videoQuality.ToString().Replace("-q ", ""), Culture) * 100;
- qConvert = System.Math.Ceiling(qConvert);
+ qConvert = double.Parse(videoQuality.ToString().Replace("-q ", ""), Culture)*100;
+ qConvert = Math.Ceiling(qConvert);
thisQuery.q_videoQuality = int.Parse(qConvert.ToString());
}
thisQuery.q_ipodAtom = ipodAtom.Success;
@@ -1037,7 +879,7 @@ namespace Handbrake.Functions // Tracks
thisQuery.q_audioTrack1 = "Automatic";
- if (audioTrack2.Success != false)
+ if (audioTrack2.Success)
{
string[] audioChan = audioTrack2.ToString().Split(',');
thisQuery.q_audioTrack2 = audioChan[1];
@@ -1045,7 +887,7 @@ namespace Handbrake.Functions else
thisQuery.q_audioTrack2 = "None";
- if (audioTrack3.Success != false)
+ if (audioTrack3.Success)
{
string[] audioChan = audioTrack3.ToString().Split(',');
thisQuery.q_audioTrack3 = audioChan[2];
@@ -1053,7 +895,7 @@ namespace Handbrake.Functions else
thisQuery.q_audioTrack3 = "None";
- if (audioTrack4.Success != false)
+ if (audioTrack4.Success)
{
string[] audioChan = audioTrack4.ToString().Split(',');
thisQuery.q_audioTrack4 = audioChan[3];
@@ -1061,51 +903,52 @@ namespace Handbrake.Functions else
thisQuery.q_audioTrack4 = "None";
-
+
// Mixdowns
thisQuery.q_audioTrackMix1 = "Automatic";
- if (audioTrack1Mix.Success != false)
- thisQuery.q_audioTrackMix1 = getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", ""));
+ if (audioTrack1Mix.Success)
+ thisQuery.q_audioTrackMix1 =
+ getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", ""));
thisQuery.q_audioTrackMix2 = "Automatic";
- if (audioTrack2Mix.Success != false)
+ if (audioTrack2Mix.Success)
{
string[] audio2mix = audioTrack2Mix.ToString().Split(',');
thisQuery.q_audioTrackMix2 = getMixDown(audio2mix[1].Trim());
}
thisQuery.q_audioTrackMix3 = "Automatic";
- if (audioTrack3Mix.Success != false)
+ if (audioTrack3Mix.Success)
{
string[] audio3mix = audioTrack3Mix.ToString().Split(',');
thisQuery.q_audioTrackMix3 = getMixDown(audio3mix[2].Trim());
}
thisQuery.q_audioTrackMix4 = "Automatic";
- if (audioTrack4Mix.Success != false)
+ if (audioTrack4Mix.Success)
{
string[] audio4mix = audioTrack4Mix.ToString().Split(',');
thisQuery.q_audioTrackMix4 = getMixDown(audio4mix[3].Trim());
}
-
+
// Audio Encoders
- if (audioEncoder1.Success != false)
+ if (audioEncoder1.Success)
thisQuery.q_audioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", ""));
- if (audioEncoder2.Success != false)
+ if (audioEncoder2.Success)
{
string[] audio2enc = audioEncoder2.ToString().Split(',');
thisQuery.q_audioEncoder2 = getAudioEncoder(audio2enc[1].Trim());
}
- if (audioEncoder3.Success != false)
+ if (audioEncoder3.Success)
{
string[] audio3enc = audioEncoder3.ToString().Split(',');
thisQuery.q_audioEncoder3 = getAudioEncoder(audio3enc[2].Trim());
}
- if (audioEncoder4.Success != false)
+ if (audioEncoder4.Success)
{
string[] audio4enc = audioEncoder4.ToString().Split(',');
thisQuery.q_audioEncoder4 = getAudioEncoder(audio4enc[3].Trim());
@@ -1114,22 +957,22 @@ namespace Handbrake.Functions // Audio Bitrate
thisQuery.q_audioBitrate1 = "";
- if (audioBitrate1.Success != false)
+ if (audioBitrate1.Success)
{
thisQuery.q_audioBitrate1 = audioBitrate1.ToString().Replace("-B ", "").Trim();
if (audioBitrate1.ToString().Replace("-B ", "").Trim() == "0") thisQuery.q_audioBitrate1 = "Auto";
}
thisQuery.q_audioBitrate2 = "";
- if (audioBitrate2.Success != false && audioTrack2.Success == true)
+ if (audioBitrate2.Success && audioTrack2.Success)
{
string[] audioBitrateSelect = audioBitrate2.ToString().Split(',');
if (audioBitrateSelect[1].Trim() == "0") audioBitrateSelect[1] = "Auto";
- thisQuery.q_audioBitrate2 = audioBitrateSelect[1].Trim();
+ thisQuery.q_audioBitrate2 = audioBitrateSelect[1].Trim();
}
thisQuery.q_audioBitrate3 = "";
- if (audioBitrate3.Success != false && audioTrack3.Success == true)
+ if (audioBitrate3.Success && audioTrack3.Success)
{
string[] audioBitrateSelect = audioBitrate3.ToString().Split(',');
if (audioBitrateSelect[2].Trim() == "0") audioBitrateSelect[2] = "Auto";
@@ -1137,7 +980,7 @@ namespace Handbrake.Functions }
thisQuery.q_audioBitrate4 = "";
- if (audioBitrate4.Success != false)
+ if (audioBitrate4.Success)
{
string[] audioBitrateSelect = audioBitrate4.ToString().Split(',');
if (audioBitrateSelect[3].Trim() == "0") audioBitrateSelect[3] = "Auto";
@@ -1148,28 +991,28 @@ namespace Handbrake.Functions // Audio Sample Rate
// Make sure to change 0 to Auto
thisQuery.q_audioSamplerate1 = "Auto";
- if (audioSampleRate1.Success != false)
+ if (audioSampleRate1.Success)
{
thisQuery.q_audioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim();
if (thisQuery.q_audioSamplerate1 == "0") thisQuery.q_audioSamplerate1 = "Auto";
}
-
- if (audioSampleRate2.Success != false)
+
+ if (audioSampleRate2.Success)
{
string[] audioSRSelect = audioSampleRate2.ToString().Split(',');
if (audioSRSelect[1] == "0") audioSRSelect[1] = "Auto";
thisQuery.q_audioSamplerate2 = audioSRSelect[1].Trim();
}
- if (audioSampleRate3.Success != false)
+ if (audioSampleRate3.Success)
{
string[] audioSRSelect = audioSampleRate3.ToString().Split(',');
if (audioSRSelect[2] == "0") audioSRSelect[2] = "Auto";
thisQuery.q_audioSamplerate3 = audioSRSelect[2].Trim();
}
- if (audioSampleRate4.Success != false)
+ if (audioSampleRate4.Success)
{
string[] audioSRSelect = audioSampleRate4.ToString().Split(',');
if (audioSRSelect[3] == "0") audioSRSelect[3] = "Auto";
@@ -1180,15 +1023,15 @@ namespace Handbrake.Functions float drcValue;
thisQuery.q_drc1 = 1;
- if (drc1.Success != false)
+ if (drc1.Success)
{
string value = drc1.ToString().Replace("-D ", "");
float.TryParse(value, out drcValue);
thisQuery.q_drc1 = drcValue;
}
-
- thisQuery.q_drc2 = 1;
- if (drc2.Success != false)
+
+ thisQuery.q_drc2 = 1;
+ if (drc2.Success)
{
string[] drcPoint = drc2.ToString().Split(',');
float.TryParse(drcPoint[1], out drcValue);
@@ -1196,7 +1039,7 @@ namespace Handbrake.Functions }
thisQuery.q_drc3 = 1;
- if (drc3.Success != false)
+ if (drc3.Success)
{
string[] drcPoint = drc3.ToString().Split(',');
float.TryParse(drcPoint[2], out drcValue);
@@ -1204,7 +1047,7 @@ namespace Handbrake.Functions }
thisQuery.q_drc4 = 1;
- if (drc4.Success != false)
+ if (drc4.Success)
{
string[] drcPoint = drc4.ToString().Split(',');
float.TryParse(drcPoint[3], out drcValue);
@@ -1212,7 +1055,7 @@ namespace Handbrake.Functions }
// Subtitle Stuff
- if (subtitles.Success != false)
+ if (subtitles.Success)
thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");
else
{
@@ -1227,22 +1070,27 @@ namespace Handbrake.Functions #endregion
#region H.264 and other
+
//
//H264 Tab
//
- if (x264.Success != false)
+ if (x264.Success)
thisQuery.q_h264 = x264.ToString().Replace("-x ", "");
//
//Progam Options
//
thisQuery.q_verbose = verbose.Success;
+
#endregion
}
catch (Exception exc)
{
- MessageBox.Show("An error has occured in the Query Parser. Please report this error on the forum in the 'Windows' support section. \n\n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(
+ "An error has occured in the Query Parser. Please report this error on the forum in the 'Windows' support section. \n\n" +
+ exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
+
#endregion
return thisQuery;
@@ -1266,6 +1114,7 @@ namespace Handbrake.Functions return "Automatic";
}
}
+
private static string getAudioEncoder(string audioEnc)
{
switch (audioEnc)
diff --git a/win/C#/Parsing/AudioTrack.cs b/win/C#/Parsing/AudioTrack.cs index 493fb4dff..d2d6f3fac 100644 --- a/win/C#/Parsing/AudioTrack.cs +++ b/win/C#/Parsing/AudioTrack.cs @@ -16,76 +16,59 @@ namespace Handbrake.Parsing /// </summary>
public class AudioTrack
{
+ private int m_bitrate;
+ private string m_format;
+ private int m_frequency;
+ private string m_language;
+ private string m_subFormat;
private int m_trackNumber;
+
/// <summary>
/// The track number of this Audio Track
/// </summary>
public int TrackNumber
{
- get
- {
- return this.m_trackNumber;
- }
+ get { return m_trackNumber; }
}
- private string m_language;
/// <summary>
/// The language (if detected) of this Audio Track
/// </summary>
public string Language
{
- get
- {
- return this.m_language;
- }
+ get { return m_language; }
}
- private string m_format;
/// <summary>
/// The primary format of this Audio Track
/// </summary>
public string Format
{
- get
- {
- return this.m_format;
- }
+ get { return m_format; }
}
- private string m_subFormat;
/// <summary>
/// Additional format info for this Audio Track
/// </summary>
public string SubFormat
{
- get
- {
- return this.m_subFormat;
- }
+ get { return m_subFormat; }
}
- private int m_frequency;
/// <summary>
/// The frequency (in MHz) of this Audio Track
/// </summary>
public int Frequency
{
- get
- {
- return this.m_frequency;
- }
+ get { return m_frequency; }
}
- private int m_bitrate;
/// <summary>
/// The bitrate (in kbps) of this Audio Track
/// </summary>
public int Bitrate
{
- get
- {
- return this.m_bitrate;
- }
+ get { return m_bitrate; }
}
/// <summary>
@@ -94,32 +77,33 @@ namespace Handbrake.Parsing /// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>
public override string ToString()
{
- if (this.m_subFormat == null)
- return string.Format("{0} {1} ({2})", this.m_trackNumber, this.m_language, this.m_format);
+ if (m_subFormat == null)
+ return string.Format("{0} {1} ({2})", m_trackNumber, m_language, m_format);
else
- return string.Format("{0} {1} ({2}) ({3})", this.m_trackNumber, this.m_language, this.m_format, this.m_subFormat);
+ return string.Format("{0} {1} ({2}) ({3})", m_trackNumber, m_language, m_format, m_subFormat);
}
public static AudioTrack Parse(StringReader output)
{
- String audio_track= output.ReadLine();
- Match m = Regex.Match(audio_track, @"^ \+ ([0-9]*), ([A-Za-z0-9]*) \((.*)\) \((.*)\), ([0-9]*)Hz, ([0-9]*)bps");
+ String audio_track = output.ReadLine();
+ Match m = Regex.Match(audio_track,
+ @"^ \+ ([0-9]*), ([A-Za-z0-9]*) \((.*)\) \((.*)\), ([0-9]*)Hz, ([0-9]*)bps");
Match y = Regex.Match(audio_track, @"^ \+ ([0-9]*), ([A-Za-z0-9]*) \((.*)\)");
if (m.Success)
{
- AudioTrack thisTrack = new AudioTrack();
- thisTrack.m_trackNumber = int.Parse(m.Groups[1].Value.Trim().ToString());
+ var thisTrack = new AudioTrack();
+ thisTrack.m_trackNumber = int.Parse(m.Groups[1].Value.Trim());
thisTrack.m_language = m.Groups[2].Value;
thisTrack.m_format = m.Groups[3].Value;
thisTrack.m_subFormat = m.Groups[4].Value;
- thisTrack.m_frequency = int.Parse(m.Groups[5].Value.Trim().ToString());
- thisTrack.m_bitrate = int.Parse(m.Groups[6].Value.Trim().ToString());
+ thisTrack.m_frequency = int.Parse(m.Groups[5].Value.Trim());
+ thisTrack.m_bitrate = int.Parse(m.Groups[6].Value.Trim());
return thisTrack;
}
else if (y.Success)
{
- AudioTrack thisTrack = new AudioTrack();
- thisTrack.m_trackNumber = int.Parse(y.Groups[1].Value.Trim().ToString());
+ var thisTrack = new AudioTrack();
+ thisTrack.m_trackNumber = int.Parse(y.Groups[1].Value.Trim());
thisTrack.m_language = y.Groups[2].Value;
thisTrack.m_format = y.Groups[3].Value;
return thisTrack;
@@ -130,10 +114,10 @@ namespace Handbrake.Parsing public static AudioTrack[] ParseList(StringReader output)
{
- List<AudioTrack> tracks = new List<AudioTrack>();
+ var tracks = new List<AudioTrack>();
while (true)
{
- AudioTrack thisTrack = AudioTrack.Parse(output);
+ AudioTrack thisTrack = Parse(output);
if (thisTrack != null)
tracks.Add(thisTrack);
else
@@ -142,4 +126,4 @@ namespace Handbrake.Parsing return tracks.ToArray();
}
}
-}
+}
\ No newline at end of file diff --git a/win/C#/Parsing/Chapter.cs b/win/C#/Parsing/Chapter.cs index 526967510..301fa5719 100644 --- a/win/C#/Parsing/Chapter.cs +++ b/win/C#/Parsing/Chapter.cs @@ -17,27 +17,23 @@ namespace Handbrake.Parsing public class Chapter
{
private int m_chapterNumber;
+
+ private TimeSpan m_duration;
+
/// <summary>
/// The number of this Chapter, in regards to it's parent Title
/// </summary>
public int ChapterNumber
{
- get
- {
- return this.m_chapterNumber;
- }
+ get { return m_chapterNumber; }
}
- private TimeSpan m_duration;
/// <summary>
/// The length in time this Chapter spans
/// </summary>
public TimeSpan Duration
{
- get
- {
- return this.m_duration;
- }
+ get { return m_duration; }
}
/// <summary>
@@ -46,16 +42,17 @@ namespace Handbrake.Parsing /// <returns>A string formatted as: {chapter #}</returns>
public override string ToString()
{
- return this.m_chapterNumber.ToString();
+ return m_chapterNumber.ToString();
}
public static Chapter Parse(StringReader output)
{
- Match m = Regex.Match(output.ReadLine(), @"^ \+ ([0-9]*): cells ([0-9]*)->([0-9]*), ([0-9]*) blocks, duration ([0-9]{2}:[0-9]{2}:[0-9]{2})");
+ Match m = Regex.Match(output.ReadLine(),
+ @"^ \+ ([0-9]*): cells ([0-9]*)->([0-9]*), ([0-9]*) blocks, duration ([0-9]{2}:[0-9]{2}:[0-9]{2})");
if (m.Success)
{
- Chapter thisChapter = new Chapter();
- thisChapter.m_chapterNumber = int.Parse(m.Groups[1].Value.Trim().ToString());
+ var thisChapter = new Chapter();
+ thisChapter.m_chapterNumber = int.Parse(m.Groups[1].Value.Trim());
thisChapter.m_duration = TimeSpan.Parse(m.Groups[5].Value);
return thisChapter;
}
@@ -65,7 +62,7 @@ namespace Handbrake.Parsing public static Chapter[] ParseList(StringReader output)
{
- List<Chapter> chapters = new List<Chapter>();
+ var chapters = new List<Chapter>();
// this is to read the " + chapters:" line from the buffer
// so we can start reading the chapters themselvs
@@ -74,7 +71,7 @@ namespace Handbrake.Parsing while (true)
{
// Start of the chapter list for this Title
- Chapter thisChapter = Chapter.Parse(output);
+ Chapter thisChapter = Parse(output);
if (thisChapter != null)
chapters.Add(thisChapter);
@@ -84,4 +81,4 @@ namespace Handbrake.Parsing return chapters.ToArray();
}
}
-}
+}
\ No newline at end of file diff --git a/win/C#/Parsing/DVD.cs b/win/C#/Parsing/DVD.cs index d0802e4c9..31fe2de12 100644 --- a/win/C#/Parsing/DVD.cs +++ b/win/C#/Parsing/DVD.cs @@ -4,47 +4,41 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-using System;
using System.Collections.Generic;
-using System.Windows.Forms;
using System.IO;
namespace Handbrake.Parsing
{
-
/// <summary>
/// An object representing a scanned DVD
/// </summary>
public class DVD
{
+ private readonly List<Title> m_titles;
- private List<Title> m_titles;
/// <summary>
- /// Collection of Titles associated with this DVD
+ /// Default constructor for this object
/// </summary>
- public List<Title> Titles
+ public DVD()
{
- get
- {
- return this.m_titles;
- }
+ m_titles = new List<Title>();
}
/// <summary>
- /// Default constructor for this object
+ /// Collection of Titles associated with this DVD
/// </summary>
- public DVD()
+ public List<Title> Titles
{
- this.m_titles = new List<Title>();
+ get { return m_titles; }
}
public static DVD Parse(StreamReader output)
{
- DVD thisDVD = new DVD();
+ var thisDVD = new DVD();
while (!output.EndOfStream)
{
- if ((char)output.Peek() == '+')
+ if ((char) output.Peek() == '+')
thisDVD.m_titles.AddRange(Title.ParseList(output.ReadToEnd()));
else
output.ReadLine();
@@ -53,4 +47,4 @@ namespace Handbrake.Parsing return thisDVD;
}
}
-}
+}
\ No newline at end of file diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs index bbafc9295..24dcef40f 100644 --- a/win/C#/Parsing/Parser.cs +++ b/win/C#/Parsing/Parser.cs @@ -4,11 +4,8 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-using System;
-using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
-using System.Windows.Forms;
namespace Handbrake.Parsing
{
diff --git a/win/C#/Parsing/Subtitle.cs b/win/C#/Parsing/Subtitle.cs index c5a722b6f..71e00121e 100644 --- a/win/C#/Parsing/Subtitle.cs +++ b/win/C#/Parsing/Subtitle.cs @@ -4,7 +4,6 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
@@ -16,28 +15,23 @@ namespace Handbrake.Parsing /// </summary>
public class Subtitle
{
+ private string m_language;
private int m_trackNumber;
+
/// <summary>
/// The track number of this Subtitle
/// </summary>
public int TrackNumber
{
- get
- {
- return this.m_trackNumber;
- }
+ get { return m_trackNumber; }
}
- private string m_language;
/// <summary>
/// The language (if detected) of this Subtitle
/// </summary>
public string Language
{
- get
- {
- return this.m_language;
- }
+ get { return m_language; }
}
/// <summary>
@@ -46,7 +40,7 @@ namespace Handbrake.Parsing /// <returns>A string formatted as: {track #} {language}</returns>
public override string ToString()
{
- return string.Format("{0} {1}", this.m_trackNumber, this.m_language);
+ return string.Format("{0} {1}", m_trackNumber, m_language);
}
public static Subtitle Parse(StringReader output)
@@ -56,8 +50,8 @@ namespace Handbrake.Parsing Match m = Regex.Match(curLine, @"^ \+ ([0-9]*), ([A-Za-z, ]*) \((.*)\)");
if (m.Success && !curLine.Contains("HandBrake has exited."))
{
- Subtitle thisSubtitle = new Subtitle();
- thisSubtitle.m_trackNumber = int.Parse(m.Groups[1].Value.Trim().ToString());
+ var thisSubtitle = new Subtitle();
+ thisSubtitle.m_trackNumber = int.Parse(m.Groups[1].Value.Trim());
thisSubtitle.m_language = m.Groups[2].Value;
return thisSubtitle;
}
@@ -67,10 +61,10 @@ namespace Handbrake.Parsing public static Subtitle[] ParseList(StringReader output)
{
- List<Subtitle> subtitles = new List<Subtitle>();
- while ((char)output.Peek() != '+')
+ var subtitles = new List<Subtitle>();
+ while ((char) output.Peek() != '+')
{
- Subtitle thisSubtitle = Subtitle.Parse(output);
+ Subtitle thisSubtitle = Parse(output);
if (thisSubtitle != null)
subtitles.Add(thisSubtitle);
@@ -80,4 +74,4 @@ namespace Handbrake.Parsing return subtitles.ToArray();
}
}
-}
+}
\ No newline at end of file diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index 6f0f6ffc3..74ccab752 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -7,10 +7,9 @@ using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Globalization;
using System.IO;
-using System.Windows.Forms;
using System.Text.RegularExpressions;
-using System.Globalization;
namespace Handbrake.Parsing
{
@@ -19,91 +18,82 @@ namespace Handbrake.Parsing /// </summary>
public class Title
{
- private List<Chapter> m_chapters;
+ private static readonly CultureInfo Culture = new CultureInfo("en-US", false);
+ private readonly List<AudioTrack> m_audioTracks;
+ private readonly List<Chapter> m_chapters;
+ private readonly List<Subtitle> m_subtitles;
+ private float m_aspectRatio;
+ private int[] m_autoCrop;
+ private TimeSpan m_duration;
+ private Size m_resolution;
+ private int m_titleNumber;
+
+ /// <summary>
+ /// The constructor for this object
+ /// </summary>
+ public Title()
+ {
+ m_audioTracks = new List<AudioTrack>();
+ m_chapters = new List<Chapter>();
+ m_subtitles = new List<Subtitle>();
+ }
+
/// <summary>
/// Collection of chapters in this Title
/// </summary>
public List<Chapter> Chapters
{
- get
- {
- return this.m_chapters;
- }
+ get { return m_chapters; }
}
- private List<AudioTrack> m_audioTracks;
/// <summary>
/// Collection of audio tracks associated with this Title
/// </summary>
public List<AudioTrack> AudioTracks
{
- get
- {
- return this.m_audioTracks;
- }
+ get { return m_audioTracks; }
}
- private List<Subtitle> m_subtitles;
/// <summary>
/// Collection of subtitles associated with this Title
/// </summary>
public List<Subtitle> Subtitles
{
- get
- {
- return this.m_subtitles;
- }
+ get { return m_subtitles; }
}
- private int m_titleNumber;
/// <summary>
/// The track number of this Title
/// </summary>
public int TitleNumber
{
- get
- {
- return this.m_titleNumber;
- }
+ get { return m_titleNumber; }
}
- private TimeSpan m_duration;
/// <summary>
/// The length in time of this Title
/// </summary>
public TimeSpan Duration
{
- get
- {
- return this.m_duration;
- }
+ get { return m_duration; }
}
- private Size m_resolution;
/// <summary>
/// The resolution (width/height) of this Title
/// </summary>
public Size Resolution
{
- get
- {
- return this.m_resolution;
- }
+ get { return m_resolution; }
}
- private float m_aspectRatio;
/// <summary>
/// The aspect ratio of this Title
/// </summary>
public float AspectRatio
{
- get
- {
- return this.m_aspectRatio;
- }
+ get { return m_aspectRatio; }
}
- private int[] m_autoCrop;
/// <summary>
/// The automatically detected crop region for this Title.
/// This is an int array with 4 items in it as so:
@@ -114,20 +104,7 @@ namespace Handbrake.Parsing /// </summary>
public int[] AutoCropDimensions
{
- get
- {
- return this.m_autoCrop;
- }
- }
-
- /// <summary>
- /// The constructor for this object
- /// </summary>
- public Title()
- {
- this.m_audioTracks = new List<AudioTrack>();
- this.m_chapters = new List<Chapter>();
- this.m_subtitles = new List<Subtitle>();
+ get { return m_autoCrop; }
}
/// <summary>
@@ -136,20 +113,18 @@ namespace Handbrake.Parsing /// <returns>A string representing this track in the format: {title #} (00:00:00)</returns>
public override string ToString()
{
- return string.Format("{0} ({1:00}:{2:00}:{3:00})", this.m_titleNumber, this.m_duration.Hours,
- this.m_duration.Minutes, this.m_duration.Seconds);
+ return string.Format("{0} ({1:00}:{2:00}:{3:00})", m_titleNumber, m_duration.Hours,
+ m_duration.Minutes, m_duration.Seconds);
}
- static readonly private CultureInfo Culture = new CultureInfo("en-US", false);
-
public static Title Parse(StringReader output)
{
- Title thisTitle = new Title();
+ var thisTitle = new Title();
Match m = Regex.Match(output.ReadLine(), @"^\+ title ([0-9]*):");
// Match track number for this title
if (m.Success)
- thisTitle.m_titleNumber = int.Parse(m.Groups[1].Value.Trim().ToString());
+ thisTitle.m_titleNumber = int.Parse(m.Groups[1].Value.Trim());
String testData = output.ReadLine();
@@ -160,7 +135,8 @@ namespace Handbrake.Parsing thisTitle.m_duration = TimeSpan.Parse(m.Groups[1].Value);
// Get resolution, aspect ratio and FPS for this title
- m = Regex.Match(output.ReadLine(), @"^ \+ size: ([0-9]*)x([0-9]*), aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");
+ m = Regex.Match(output.ReadLine(),
+ @"^ \+ size: ([0-9]*)x([0-9]*), aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");
if (m.Success)
{
thisTitle.m_resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
@@ -170,7 +146,11 @@ namespace Handbrake.Parsing // Get autocrop region for this title
m = Regex.Match(output.ReadLine(), @"^ \+ autocrop: ([0-9]*)/([0-9]*)/([0-9]*)/([0-9]*)");
if (m.Success)
- thisTitle.m_autoCrop = new int[4] { int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value), int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value) };
+ thisTitle.m_autoCrop = new int[4]
+ {
+ int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value),
+ int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value)
+ };
thisTitle.m_chapters.AddRange(Chapter.ParseList(output));
@@ -183,8 +163,8 @@ namespace Handbrake.Parsing public static Title[] ParseList(string output)
{
- List<Title> titles = new List<Title>();
- StringReader sr = new StringReader(output);
+ var titles = new List<Title>();
+ var sr = new StringReader(output);
while (sr.Peek() == '+' || sr.Peek() == ' ')
{
@@ -192,10 +172,10 @@ namespace Handbrake.Parsing if (sr.Peek() == ' ') // If the character is a space, then chances are it's the combing detected line.
sr.ReadLine(); // Skip over it
else
- titles.Add(Title.Parse(sr));
+ titles.Add(Parse(sr));
}
return titles.ToArray();
}
}
-}
+}
\ No newline at end of file diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs index 171b313c1..7bf3f903d 100644 --- a/win/C#/Presets/PresetsHandler.cs +++ b/win/C#/Presets/PresetsHandler.cs @@ -1,6 +1,5 @@ using System;
using System.Collections.Generic;
-using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
diff --git a/win/C#/Presets/preset.cs b/win/C#/Presets/preset.cs index ee983427a..34689327b 100644 --- a/win/C#/Presets/preset.cs +++ b/win/C#/Presets/preset.cs @@ -1,66 +1,32 @@ using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.IO;
-using System.Text.RegularExpressions;
-using System.Diagnostics;
namespace Handbrake.Presets
{
public class Preset
{
-
- private int level = 0;
- private string category = null;
- private string name;
- private string query;
- private Boolean pictureSettings;
-
/// <summary>
/// Get or Set the preset's level. This indicated if it is a root or child node
/// </summary>
- public int Level
- {
- get { return level; }
- set { this.level = value; }
- }
+ public int Level { get; set; }
/// <summary>
/// Get or Set the category which the preset resides under
/// </summary>
- public string Category
- {
- get { return category; }
- set { this.category = value; }
- }
+ public string Category { get; set; }
/// <summary>
/// Get or Set the preset name
/// </summary>
- public string Name
- {
- get { return name; }
- set { this.name = value; }
- }
+ public string Name { get; set; }
/// <summary>
/// Get or set the preset query
/// </summary>
- public string Query
- {
- get { return query; }
- set { this.query = value; }
- }
+ public string Query { get; set; }
/// <summary>
/// Get or set the usage of Picture Settings in presets.
/// </summary>
- public Boolean PictureSettings
- {
- get { return pictureSettings; }
- set { this.pictureSettings = value; }
- }
-
+ public Boolean PictureSettings { get; set; }
}
}
\ No newline at end of file diff --git a/win/C#/Queue/QueueHandler.cs b/win/C#/Queue/QueueHandler.cs index aabce4f41..3317fb82f 100644 --- a/win/C#/Queue/QueueHandler.cs +++ b/win/C#/Queue/QueueHandler.cs @@ -1,7 +1,5 @@ using System;
using System.Collections.Generic;
-using System.Text;
-using System.Collections;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
diff --git a/win/C#/Queue/QueueItem.cs b/win/C#/Queue/QueueItem.cs index 1639b168b..e71e308c4 100644 --- a/win/C#/Queue/QueueItem.cs +++ b/win/C#/Queue/QueueItem.cs @@ -1,50 +1,25 @@ -using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Handbrake.Queue
+namespace Handbrake.Queue
{
public class QueueItem
{
- private int id;
- private string query;
- private string source;
- private string destination;
-
/// <summary>
/// Get or Set the job id.
/// </summary>
- public int Id
- {
- get { return id; }
- set { this.id = value; }
- }
+ public int Id { get; set; }
/// <summary>
/// Get or Set the query string.
/// </summary>
- public string Query
- {
- get { return query; }
- set { this.query = value; }
- }
+ public string Query { get; set; }
/// <summary>
/// Get or set the source file of encoding
/// </summary>
- public string Source
- {
- get { return source; }
- set { this.source = value; }
- }
+ public string Source { get; set; }
/// <summary>
/// Get or set the destination for the file to be encoded.
/// </summary>
- public string Destination
- {
- get { return destination; }
- set { this.destination = value; }
- }
+ public string Destination { get; set; }
}
-}
+}
\ No newline at end of file diff --git a/win/C#/frmAbout.cs b/win/C#/frmAbout.cs index 1657cad0c..efc503b80 100644 --- a/win/C#/frmAbout.cs +++ b/win/C#/frmAbout.cs @@ -5,13 +5,7 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
-using System.Diagnostics;
namespace Handbrake
{
@@ -28,10 +22,5 @@ namespace Handbrake {
this.Close();
}
-
- private void label_credits_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- Process.Start("http://handbrake.frtrac/wiki/x264Options");
- }
}
}
\ No newline at end of file diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index d1a1376cb..1ad4e094e 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -5,16 +5,10 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
-using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Win32;
diff --git a/win/C#/frmAddPreset.cs b/win/C#/frmAddPreset.cs index 67dbfa95e..a4def1920 100644 --- a/win/C#/frmAddPreset.cs +++ b/win/C#/frmAddPreset.cs @@ -5,13 +5,7 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
-using System.IO;
namespace Handbrake
{
diff --git a/win/C#/frmDownload.cs b/win/C#/frmDownload.cs index 459348dcb..e055140fe 100644 --- a/win/C#/frmDownload.cs +++ b/win/C#/frmDownload.cs @@ -5,7 +5,6 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections.Generic;
using System.Windows.Forms;
using System.Net;
using System.IO;
diff --git a/win/C#/frmGenPreview.cs b/win/C#/frmGenPreview.cs index 1731a63bd..a7768a104 100644 --- a/win/C#/frmGenPreview.cs +++ b/win/C#/frmGenPreview.cs @@ -1,9 +1,4 @@ using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
@@ -14,7 +9,7 @@ namespace Handbrake public partial class frmGenPreview : Form
{
private delegate void UpdateHandler();
- Handbrake.QueryGenerator queryGen = new Handbrake.QueryGenerator();
+ QueryGenerator queryGen = new QueryGenerator();
Functions.Encode process = new Functions.Encode();
Process hbProc;
frmMain mainWindow;
diff --git a/win/C#/frmMain/PresetLoader.cs b/win/C#/frmMain/PresetLoader.cs index 3a574b98f..aa05cc876 100644 --- a/win/C#/frmMain/PresetLoader.cs +++ b/win/C#/frmMain/PresetLoader.cs @@ -1,6 +1,4 @@ using System;
-using System.Collections.Generic;
-using System.Text;
using System.Windows.Forms;
using System.Drawing;
diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index ff2fab0f0..dae22fe18 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -5,11 +5,6 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
namespace Handbrake
diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs index c7d442d5d..e00bcd976 100644 --- a/win/C#/frmPreview.cs +++ b/win/C#/frmPreview.cs @@ -1,15 +1,8 @@ using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;
-
-using QTOControlLib;
using QTOLibrary;
namespace Handbrake
@@ -17,7 +10,7 @@ namespace Handbrake public partial class frmPreview : Form
{
- Handbrake.QueryGenerator hb_common_func = new Handbrake.QueryGenerator();
+ QueryGenerator hb_common_func = new QueryGenerator();
Functions.Encode process = new Functions.Encode();
private delegate void UpdateUIHandler();
String currently_playing = "";
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 2fb6169a2..1a9f30c7b 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -6,16 +6,8 @@ using System;
using System.Collections.Generic;
-using System.Collections;
using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
-using System.Threading;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.IO;
namespace Handbrake
{
diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index 47639341d..56bf5af4f 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -5,16 +5,10 @@ It may be used under the terms of the GNU General Public License. */
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Diagnostics;
-using System.Collections;
namespace Handbrake
@@ -27,7 +21,6 @@ namespace Handbrake private delegate void UpdateUIHandler();
Process hbproc;
Functions.Main hb_common_func = new Functions.Main();
- Functions.Encode process = new Functions.Encode();
public frmReadDVD(string inputFile, frmMain parent)
{
diff --git a/win/C#/frmSplashScreen.cs b/win/C#/frmSplashScreen.cs index 65250727a..dca8bd2ff 100644 --- a/win/C#/frmSplashScreen.cs +++ b/win/C#/frmSplashScreen.cs @@ -4,14 +4,7 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
-using System.Threading;
namespace Handbrake
{
diff --git a/win/C#/frmUpdater.cs b/win/C#/frmUpdater.cs index 271e17bc0..8496fa538 100644 --- a/win/C#/frmUpdater.cs +++ b/win/C#/frmUpdater.cs @@ -6,9 +6,6 @@ using System;
using System.Windows.Forms;
-using System.IO;
-using System.Xml;
-using System.Net;
namespace Handbrake
{
|