/* QueryParser.cs $\r
- \r
- This file is part of the HandBrake source code.\r
- Homepage: <http://handbrake.fr>.\r
- It may be used under the terms of the GNU General Public License. */\r
-\r
-using System;\r
-using System.Globalization;\r
-using System.Text.RegularExpressions;\r
-using System.Windows.Forms;\r
-using System.Collections;\r
+ This file is part of the HandBrake source code.\r
+ Homepage: <http://handbrake.fr>.\r
+ It may be used under the terms of the GNU General Public License. */\r
\r
namespace Handbrake.Functions\r
{\r
- internal class QueryParser\r
+ using System;\r
+ using System.Collections;\r
+ using System.Globalization;\r
+ using System.Text.RegularExpressions;\r
+ using System.Windows.Forms;\r
+ using Model;\r
+\r
+ /// <summary>\r
+ /// Parse a CLI Query\r
+ /// </summary>\r
+ public class QueryParser\r
{\r
+ /// <summary>\r
+ /// The Culture\r
+ /// </summary>\r
private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
\r
#region Varibles\r
\r
- // Source\r
- public int DVDTitle { get; set; }\r
- public int DVDChapterStart { get; set; }\r
- public int DVDChapterFinish { get; set; }\r
+ #region Source Title / Chapters\r
+ /// <summary>\r
+ /// Gets or sets Title.\r
+ /// </summary>\r
+ public int Title { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets ChapterStart.\r
+ /// </summary>\r
+ public int ChapterStart { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets ChapterFinish.\r
+ /// </summary>\r
+ public int ChapterFinish { get; set; }\r
+ #endregion\r
\r
- // Output Settings\r
+ #region Output Settings\r
+ /// <summary>\r
+ /// Gets or sets the file Format. e.g mkv or mp4\r
+ /// </summary>\r
public string Format { get; set; }\r
- public Boolean LargeMP4 { get; set; }\r
- public Boolean IpodAtom { get; set; }\r
- public Boolean OptimizeMP4 { get; set; }\r
\r
- // Picture Settings\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether LargeMP4 support is enabled.\r
+ /// This is the 64bit MP4 file that allows >4GB files\r
+ /// </summary>\r
+ public bool LargeMP4 { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether IpodAtom is inserted\r
+ /// </summary>\r
+ public bool IpodAtom { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether OptimizeMP4 is enabed for web streaming\r
+ /// </summary>\r
+ public bool OptimizeMP4 { get; set; }\r
+ #endregion\r
+\r
+ #region Picture Settings\r
+\r
+ /// <summary>\r
+ /// Gets or sets Width.\r
+ /// </summary>\r
public int Width { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Height.\r
+ /// </summary>\r
public int Height { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets MaxWidth.\r
+ /// </summary>\r
public int MaxWidth { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets MaxHeight.\r
+ /// </summary>\r
public int MaxHeight { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets CropValues.\r
+ /// </summary>\r
public string CropValues { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets CropTop.\r
+ /// </summary>\r
public string CropTop { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets CropBottom.\r
+ /// </summary>\r
public string CropBottom { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets CropLeft.\r
+ /// </summary>\r
public string CropLeft { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets CropRight.\r
+ /// </summary>\r
public string CropRight { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets AnamorphicMode.\r
+ /// </summary>\r
public int AnamorphicMode { get; set; }\r
- public Boolean keepDisplayAsect { get; set; }\r
- public double displayWidthValue { get; set; }\r
- public int pixelAspectWidth { get; set; }\r
- public int pixelAspectHeight { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether KeepDisplayAsect.\r
+ /// </summary>\r
+ public bool KeepDisplayAsect { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets DisplayWidthValue.\r
+ /// </summary>\r
+ public double DisplayWidthValue { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets PixelAspectWidth.\r
+ /// </summary>\r
+ public int PixelAspectWidth { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets PixelAspectHeight.\r
+ /// </summary>\r
+ public int PixelAspectHeight { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets AnamorphicModulus.\r
+ /// </summary>\r
public int AnamorphicModulus { get; set; }\r
+ #endregion\r
\r
- // Video Filters\r
+ #region Video Filters\r
+\r
+ /// <summary>\r
+ /// Gets or sets DeTelecine.\r
+ /// </summary>\r
public string DeTelecine { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets DeBlock.\r
+ /// </summary>\r
public int DeBlock { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets DeInterlace.\r
+ /// </summary>\r
public string DeInterlace { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets DeNoise.\r
+ /// </summary>\r
public string DeNoise { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Decomb.\r
+ /// </summary>\r
public string Decomb { get; set; }\r
+ #endregion\r
\r
- // Video Settings\r
+ #region Video Settings\r
+ /// <summary>\r
+ /// Gets or sets VideoEncoder.\r
+ /// </summary>\r
public string VideoEncoder { get; set; }\r
- public Boolean Grayscale { get; set; }\r
- public Boolean TwoPass { get; set; }\r
- public Boolean TurboFirstPass { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether Grayscale.\r
+ /// </summary>\r
+ public bool Grayscale { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether TwoPass.\r
+ /// </summary>\r
+ public bool TwoPass { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether TurboFirstPass.\r
+ /// </summary>\r
+ public bool TurboFirstPass { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets VideoFramerate.\r
+ /// </summary>\r
public string VideoFramerate { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets AverageVideoBitrate.\r
+ /// </summary>\r
public string AverageVideoBitrate { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets VideoTargetSize.\r
+ /// </summary>\r
public string VideoTargetSize { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets VideoQuality.\r
+ /// </summary>\r
public float VideoQuality { get; set; }\r
+ #endregion\r
\r
- // Audio Settings\r
+ #region Audio Settings\r
+\r
+ /// <summary>\r
+ /// Gets or sets AudioInformation.\r
+ /// </summary>\r
public ArrayList AudioInformation { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Subtitles.\r
+ /// </summary>\r
public string Subtitles { get; set; }\r
- public Boolean ForcedSubtitles { get; set; }\r
\r
- // Chapter Markers\r
- public Boolean ChapterMarkers { get; set; }\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether ForcedSubtitles.\r
+ /// </summary>\r
+ public bool ForcedSubtitles { get; set; }\r
+ #endregion\r
\r
- // Other\r
+ #region Other\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether ChapterMarkers.\r
+ /// </summary>\r
+ public bool ChapterMarkers { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets H264Query.\r
+ /// </summary>\r
public string H264Query { get; set; }\r
- public Boolean Verbose { get; set; }\r
\r
- // Preset Information\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether Verbose.\r
+ /// </summary>\r
+ public bool Verbose { get; set; }\r
+ #endregion\r
+\r
+ #region Preset Information\r
+\r
+ /// <summary>\r
+ /// Gets or sets PresetBuildNumber.\r
+ /// </summary>\r
public int PresetBuildNumber { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets PresetDescription.\r
+ /// </summary>\r
public string PresetDescription { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets PresetName.\r
+ /// </summary>\r
public string PresetName { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Type.\r
+ /// </summary>\r
public string Type { get; set; }\r
- public Boolean UsesMaxPictureSettings { get; set; }\r
- public Boolean UsesPictureFilters { get; set; }\r
- public Boolean UsesPictureSettings { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether UsesMaxPictureSettings.\r
+ /// </summary>\r
+ public bool UsesMaxPictureSettings { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether UsesPictureFilters.\r
+ /// </summary>\r
+ public bool UsesPictureFilters { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether UsesPictureSettings.\r
+ /// </summary>\r
+ public bool UsesPictureSettings { get; set; }\r
+ #endregion\r
\r
#endregion\r
\r
/// </summary>\r
/// <param name="input">A ClI Query</param>\r
/// <returns>A Parsed Query</returns>\r
- public static QueryParser Parse(String input)\r
+ public static QueryParser Parse(string input)\r
{\r
var thisQuery = new QueryParser();\r
\r
#region Regular Expressions\r
\r
- //Source\r
+ // Source\r
Match title = Regex.Match(input, @"-t ([0-9]*)");\r
Match chapters = Regex.Match(input, @"-c ([0-9-]*)");\r
\r
- //Output Settings\r
+ // Output Settings\r
Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)");\r
Match grayscale = Regex.Match(input, @" -g");\r
Match largerMp4 = Regex.Match(input, @" -4");\r
Match ipodAtom = Regex.Match(input, @" -I");\r
\r
- //Picture Settings Tab\r
+ // Picture Settings Tab\r
Match width = Regex.Match(input, @"-w ([0-9]*)");\r
Match height = Regex.Match(input, @"-l ([0-9]*)");\r
Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");\r
Match customAnamorphic = Regex.Match(input, @"--custom-anamorphic");\r
\r
Match keepDisplayAsect = Regex.Match(input, @"--keep-display-aspect");\r
- Match displayWidth = Regex.Match(input, @"--display-width ([0-9*])");\r
+ Match displayWidth = Regex.Match(input, @"--display-width ([0-9]*)");\r
Match pixelAspect = Regex.Match(input, @"--pixel-aspect ([0-9]*):([0-9]*)");\r
- Match modulus = Regex.Match(input, @"--modulus ([0-9*])");\r
+ Match modulus = Regex.Match(input, @"--modulus ([0-9]*)");\r
\r
// Picture Settings - Filters\r
Match decomb = Regex.Match(input, @" --decomb");\r
Match detelecine = Regex.Match(input, @"--detelecine");\r
Match detelecineValue = Regex.Match(input, @" --detelecine=\""([a-zA-Z0-9.:]*)\""");\r
\r
- //Video Settings Tab\r
+ // Video Settings Tab\r
Match videoEncoder = Regex.Match(input, @"-e ([a-zA-Z0-9]*)");\r
Match videoFramerate = Regex.Match(input, @"-r ([0-9.]*)");\r
Match videoBitrate = Regex.Match(input, @"-b ([0-9]*)");\r
Match turboFirstPass = Regex.Match(input, @" -T");\r
Match optimizeMP4 = Regex.Match(input, @" -O");\r
\r
- //Audio Settings Tab\r
+ // Audio Settings Tab\r
Match noAudio = Regex.Match(input, @"-a none");\r
Match audioTracks = Regex.Match(input, @"-a ([0-9,]*)");\r
Match audioTrackMixes = Regex.Match(input, @"-6 ([0-9a-zA-Z,]*)");\r
Match audioEncoders = Regex.Match(input, @"-E ([a-zA-Z0-9+,]*)");\r
- Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z\r
- Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z\r
+ Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z\r
+ Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z\r
Match drcValues = Regex.Match(input, @"-D ([0-9.,]*)");\r
\r
Match subtitles = Regex.Match(input, @"-s ([0-9a-zA-Z]*)");\r
Match chapterMarkers = Regex.Match(input, @" -m");\r
Match chapterMarkersFileMode = Regex.Match(input, @"--markers");\r
\r
- //H264 Tab\r
+ // H264 Tab\r
Match x264 = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");\r
\r
- //Program Options\r
+ // Program Options\r
Match verbose = Regex.Match(input, @" -v");\r
\r
#endregion\r
#region Source Tab\r
\r
if (title.Success)\r
- thisQuery.DVDTitle = int.Parse(title.ToString().Replace("-t ", ""));\r
+ thisQuery.Title = int.Parse(title.ToString().Replace("-t ", string.Empty));\r
\r
if (chapters.Success)\r
{\r
- string[] actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
- thisQuery.DVDChapterStart = int.Parse(actTitles[0]);\r
+ string[] actTitles = chapters.ToString().Replace("-c ", string.Empty).Split('-');\r
+ thisQuery.ChapterStart = int.Parse(actTitles[0]);\r
if (actTitles.Length > 1)\r
{\r
- thisQuery.DVDChapterFinish = int.Parse(actTitles[1]);\r
+ thisQuery.ChapterFinish = int.Parse(actTitles[1]);\r
}\r
\r
- if ((thisQuery.DVDChapterStart == 1) && (thisQuery.DVDChapterFinish == 0))\r
- thisQuery.DVDChapterFinish = thisQuery.DVDChapterStart;\r
+ if ((thisQuery.ChapterStart == 1) && (thisQuery.ChapterFinish == 0))\r
+ thisQuery.ChapterFinish = thisQuery.ChapterStart;\r
}\r
+\r
#endregion\r
\r
#region Output Settings\r
\r
if (format.Success)\r
- thisQuery.Format = format.ToString().Replace("-f ", "");\r
+ thisQuery.Format = format.ToString().Replace("-f ", string.Empty);\r
thisQuery.LargeMP4 = largerMp4.Success;\r
thisQuery.IpodAtom = ipodAtom.Success;\r
thisQuery.OptimizeMP4 = optimizeMP4.Success;\r
#region Picture Tab\r
\r
if (width.Success)\r
- thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", ""));\r
+ thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", string.Empty));\r
\r
if (height.Success)\r
- thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", ""));\r
+ thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", string.Empty));\r
\r
if (maxWidth.Success)\r
- thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", ""));\r
+ thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", string.Empty));\r
\r
if (maxHeight.Success)\r
- thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", ""));\r
+ thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", string.Empty));\r
\r
if (crop.Success)\r
{\r
- thisQuery.CropValues = crop.ToString().Replace("--crop ", "");\r
+ thisQuery.CropValues = crop.ToString().Replace("--crop ", string.Empty);\r
string[] actCropValues = thisQuery.CropValues.Split(':');\r
thisQuery.CropTop = actCropValues[0];\r
thisQuery.CropBottom = actCropValues[1];\r
else\r
thisQuery.AnamorphicMode = 0;\r
\r
- thisQuery.keepDisplayAsect = keepDisplayAsect.Success;\r
+ thisQuery.KeepDisplayAsect = keepDisplayAsect.Success;\r
\r
if (displayWidth.Success)\r
- thisQuery.displayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));\r
+ thisQuery.DisplayWidthValue =\r
+ double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", string.Empty));\r
\r
if (pixelAspect.Success)\r
- thisQuery.pixelAspectWidth = int.Parse(pixelAspect.Groups[0].Value.Replace("--pixel-aspect ", ""));\r
+ thisQuery.PixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", string.Empty));\r
\r
- if (pixelAspect.Success)\r
- thisQuery.pixelAspectHeight = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));\r
+ if (pixelAspect.Success && pixelAspect.Groups.Count >= 3)\r
+ thisQuery.PixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", string.Empty));\r
\r
if (modulus.Success)\r
- thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", ""));\r
-\r
+ thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", string.Empty));\r
\r
#endregion\r
\r
{\r
thisQuery.Decomb = "Default";\r
if (decombValue.Success)\r
- thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", "").Replace("\"", "");\r
+ thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", string.Empty).Replace("\"", string.Empty);\r
}\r
\r
thisQuery.DeInterlace = "Off";\r
if (deinterlace.Success)\r
{\r
- thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", "");\r
- thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");\r
+ thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", string.Empty).Replace("\"", string.Empty);\r
+ thisQuery.DeInterlace =\r
+ thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");\r
thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("slowest", "Slowest");\r
}\r
\r
thisQuery.DeNoise = "Off";\r
if (denoise.Success)\r
{\r
- thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", "").Replace("\"", "");\r
- thisQuery.DeNoise = thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");\r
+ thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", string.Empty).Replace("\"", string.Empty);\r
+ thisQuery.DeNoise =\r
+ thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");\r
}\r
\r
- string deblockValue = "";\r
+ string deblockValue = string.Empty;\r
thisQuery.DeBlock = 0;\r
if (deblock.Success)\r
- deblockValue = deblock.ToString().Replace("--deblock=", "");\r
+ deblockValue = deblock.ToString().Replace("--deblock=", string.Empty);\r
\r
int dval = 0;\r
- if (deblockValue != "")\r
+ if (deblockValue != string.Empty)\r
int.TryParse(deblockValue, out dval);\r
thisQuery.DeBlock = dval;\r
\r
{\r
thisQuery.DeTelecine = "Default";\r
if (detelecineValue.Success)\r
- thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", "").Replace("\"", "");\r
+ thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", string.Empty).Replace("\"", string.Empty);\r
}\r
\r
#endregion\r
\r
#region Video Settings Tab\r
\r
- string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");\r
+ string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", string.Empty);\r
switch (videoEncoderConvertion)\r
{\r
case "ffmpeg":\r
break;\r
}\r
thisQuery.VideoEncoder = videoEncoderConvertion;\r
- thisQuery.VideoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source";\r
+ thisQuery.VideoFramerate = videoFramerate.Success\r
+ ? videoFramerate.ToString().Replace("-r ", string.Empty)\r
+ : "Same as source";\r
thisQuery.Grayscale = grayscale.Success;\r
thisQuery.TwoPass = twoPass.Success;\r
thisQuery.TurboFirstPass = turboFirstPass.Success;\r
\r
if (videoBitrate.Success)\r
- thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", "");\r
+ thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", string.Empty);\r
if (videoFilesize.Success)\r
- thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", "");\r
+ thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", string.Empty);\r
\r
if (videoQuality.Success)\r
{\r
- float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture);\r
+ float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", string.Empty), Culture);\r
thisQuery.VideoQuality = qConvert;\r
}\r
+ else\r
+ thisQuery.VideoQuality = -1;\r
+\r
#endregion\r
\r
#region Audio Tab\r
+\r
// Find out how many tracks we need to add by checking how many encoders or audio tracks are selected.\r
int encoderCount = 0;\r
if (audioEncoders.Success)\r
{\r
- string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", "").Split(',');\r
+ string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');\r
encoderCount = audioDataCounters.Length;\r
}\r
\r
string[] trackDRCvalues = null;\r
\r
if (audioTracks.Success)\r
- trackData = audioTracks.ToString().Replace("-a ", "").Split(',');\r
+ trackData = audioTracks.ToString().Replace("-a ", string.Empty).Split(',');\r
if (audioTrackMixes.Success)\r
- trackMixes = audioTrackMixes.ToString().Replace("-6 ", "").Split(',');\r
+ trackMixes = audioTrackMixes.ToString().Replace("-6 ", string.Empty).Split(',');\r
if (audioEncoders.Success)\r
- trackEncoders = audioEncoders.ToString().Replace("-E ", "").Split(',');\r
+ trackEncoders = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');\r
if (audioBitrates.Success)\r
- trackBitrates = audioBitrates.ToString().Replace("-B ", "").Split(',');\r
+ trackBitrates = audioBitrates.ToString().Replace("-B ", string.Empty).Split(',');\r
if (audioSampleRates.Success)\r
- trackSamplerates = audioSampleRates.ToString().Replace("-R ", "").Split(',');\r
+ trackSamplerates = audioSampleRates.ToString().Replace("-R ", string.Empty).Split(',');\r
if (drcValues.Success)\r
- trackDRCvalues = drcValues.ToString().Replace("-D ", "").Split(',');\r
+ trackDRCvalues = drcValues.ToString().Replace("-D ", string.Empty).Split(',');\r
\r
// Create new Audio Track Classes and store them in the ArrayList\r
- ArrayList AllAudioTrackInfo = new ArrayList();\r
+ ArrayList allAudioTrackInfo = new ArrayList();\r
for (int x = 0; x < encoderCount; x++)\r
{\r
AudioTrack track = new AudioTrack();\r
if (trackData != null)\r
- if (trackData.Length >= (x + 1)) // Audio Track\r
+ if (trackData.Length >= (x + 1)) // Audio Track\r
track.Track = trackData[x].Trim();\r
\r
if (trackMixes != null)\r
- if (trackMixes.Length >= (x + 1)) // Audio Mix\r
- track.MixDown = getMixDown(trackMixes[x].Trim());\r
+ if (trackMixes.Length >= (x + 1)) // Audio Mix\r
+ track.MixDown = GetMixDown(trackMixes[x].Trim());\r
\r
if (trackEncoders != null)\r
- if (trackEncoders.Length >= (x + 1)) // Audio Mix\r
- track.Encoder = getAudioEncoder(trackEncoders[x].Trim());\r
+ if (trackEncoders.Length >= (x + 1)) // Audio Mix\r
+ track.Encoder = GetAudioEncoder(trackEncoders[x].Trim());\r
\r
if (trackBitrates != null)\r
- if (trackBitrates.Length >= (x + 1)) // Audio Encoder\r
+ if (trackBitrates.Length >= (x + 1)) // Audio Encoder\r
track.Bitrate = trackBitrates[x].Trim() == "auto" ? "Auto" : trackBitrates[x].Trim();\r
\r
if (trackSamplerates != null)\r
- if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate\r
+ if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate\r
track.SampleRate = trackSamplerates[x].Trim() == "0" ? "Auto" : trackSamplerates[x].Trim();\r
\r
if (trackDRCvalues != null)\r
- if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values\r
+ if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values\r
track.DRC = trackDRCvalues[x].Trim();\r
\r
- AllAudioTrackInfo.Add(track);\r
+ allAudioTrackInfo.Add(track);\r
}\r
- thisQuery.AudioInformation = AllAudioTrackInfo;\r
+ thisQuery.AudioInformation = allAudioTrackInfo;\r
\r
// Subtitle Stuff\r
if (subtitles.Success)\r
- thisQuery.Subtitles = subtitles.ToString().Replace("-s ", "");\r
+ thisQuery.Subtitles = subtitles.ToString().Replace("-s ", string.Empty);\r
else\r
thisQuery.Subtitles = subScan.Success ? "Autoselect" : "None";\r
\r
thisQuery.ForcedSubtitles = forcedSubtitles.Success;\r
+\r
#endregion\r
\r
#region Chapters Tab\r
+\r
if (chapterMarkersFileMode.Success || chapterMarkers.Success)\r
thisQuery.ChapterMarkers = true;\r
+\r
#endregion\r
\r
#region H.264 and other\r
\r
if (x264.Success)\r
- thisQuery.H264Query = x264.ToString().Replace("-x ", "");\r
+ thisQuery.H264Query = x264.ToString().Replace("-x ", string.Empty);\r
\r
thisQuery.Verbose = verbose.Success;\r
\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show(\r
- "An error has occured in the Query Parser. Please report this error on the forum in the 'Windows' support section. \n\n" +\r
- exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ frmExceptionWindow exceptionWindow = new frmExceptionWindow();\r
+ exceptionWindow.Setup("An error has occured in the Query Parser.", exc.ToString());\r
+ exceptionWindow.ShowDialog();\r
}\r
\r
#endregion\r
\r
return thisQuery;\r
}\r
- private static string getMixDown(string mixdown)\r
+\r
+ /// <summary>\r
+ /// Get the GUI equiv to a CLI mixdown\r
+ /// </summary>\r
+ /// <param name="mixdown">The Audio Mixdown</param>\r
+ /// <returns>The GUI representation of the mixdown</returns>\r
+ private static string GetMixDown(string mixdown)\r
{\r
switch (mixdown.Trim())\r
{\r
return "Automatic";\r
}\r
}\r
- private static string getAudioEncoder(string audioEnc)\r
+\r
+ /// <summary>\r
+ /// Get the GUI equiv to a CLI audio encoder\r
+ /// </summary>\r
+ /// <param name="audioEnc">The Audio Encoder</param>\r
+ /// <returns>The GUI representation of that audio encoder</returns>\r
+ private static string GetAudioEncoder(string audioEnc)\r
{\r
switch (audioEnc)\r
{\r
}\r
}\r
}\r
-\r
- public class AudioTrack\r
- {\r
- public AudioTrack()\r
- {\r
- // Default Values\r
- Track = "Automatic";\r
- MixDown = "Automatic";\r
- SampleRate = "Auto";\r
- Bitrate = "Auto";\r
- DRC = "1";\r
- }\r
- public string Track { get; set; }\r
- public string MixDown { get; set; }\r
- public string Encoder { get; set; }\r
- public string Bitrate { get; set; }\r
- public string SampleRate { get; set; }\r
- public string DRC { get; set; }\r
- }\r
}
\ No newline at end of file