#region Audio\r
\r
// Handle Track 1\r
- if (presetQuery.AudioTrack1 == "")\r
+ if (presetQuery.AudioTrack1 == string.Empty)\r
mainWindow.drp_track1Audio.Text = "Automatic";\r
else\r
mainWindow.drp_track1Audio.Text = presetQuery.AudioTrack1;\r
query += " --crop 0:0:0:0 ";\r
else if (mainWindow.drp_crop.Text == "Custom")\r
{\r
- if (mainWindow.text_top.Text == "")\r
+ if (mainWindow.text_top.Text == string.Empty)\r
cropTop = "0";\r
- if (mainWindow.text_bottom.Text == "")\r
+ if (mainWindow.text_bottom.Text == string.Empty)\r
cropBottom = "0";\r
- if (mainWindow.text_left.Text == "")\r
+ if (mainWindow.text_left.Text == string.Empty)\r
cropLeft = "0";\r
- if (mainWindow.text_right.Text == "")\r
+ if (mainWindow.text_right.Text == string.Empty)\r
cropRight = "0";\r
\r
query += " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;\r
\r
if (aencoder2 != "")\r
{\r
- if (aencoder1 == "")\r
+ if (aencoder1 == string.Empty)\r
query += " -E faac," + getAudioEncoder(aencoder2);\r
else\r
query += "," + getAudioEncoder(aencoder2);\r
\r
if (audioBitrate2 != "")\r
{\r
- if (audioBitrate1 == "")\r
+ if (audioBitrate1 == string.Empty)\r
query += " -B 160," + audioBitrate2;\r
else\r
query += "," + audioBitrate2;\r
\r
if (audioSampleRate2 != "")\r
{\r
- if (audioSampleRate1 == "")\r
+ if (audioSampleRate1 == string.Empty)\r
query += " -R 0," + audioSampleRate2.Replace("Auto", "0");\r
else\r
query += "," + audioSampleRate2.Replace("Auto", "0");\r
\r
if ((track2 != "") && (track2 != "None"))\r
{\r
- if (audioSampleRate1 == "")\r
+ if (audioSampleRate1 == string.Empty)\r
query += " -R 0,0";\r
else\r
query += ",0";\r
using System;\r
-using System.Collections;\r
+using System.Collections.Generic;\r
using System.Text;\r
using System.Windows.Forms;\r
using System.IO;\r
{\r
public class Presets\r
{\r
- ArrayList presets = new ArrayList();\r
- ArrayList user_presets = new ArrayList();\r
+ List<string> presets = new List<string>();\r
+ List<string> user_presets = new List<string>();\r
\r
/// <summary>\r
/// Add a new preset to the system\r
/// <param name="name">String, the preset name</param>\r
public void remove(string name)\r
{\r
- ArrayList newPresets = new ArrayList();\r
- ArrayList newUserPresets = new ArrayList();\r
+ List<string> newPresets = new List<string>();\r
+ List<string> newUserPresets = new List<string>();\r
\r
// Built In Presets\r
foreach (string item in presets)\r
/// Includes both built in and user presets.\r
/// </summary>\r
/// <returns>Arraylist of preset names</returns>\r
- public ArrayList getPresetNames()\r
+ public List<string> getPresetNames()\r
{\r
- ArrayList names = new ArrayList();\r
+ List<string> names = new List<string>();\r
\r
// Built In Presets\r
foreach (string item in presets)\r
// Check if a preset already exists in either the built in or user presets\r
private Boolean checkIfPresetExists(string name)\r
{\r
- if (name == "")\r
+ if (name == string.Empty)\r
return true;\r
\r
// Built In Presets\r
/// <returns>Bolean true if successful</returns>\r
public Boolean remove(int index)\r
{\r
- try\r
- {\r
- queue.RemoveAt(index);\r
- return true;\r
- }\r
- catch (Exception)\r
- {\r
- return false;\r
- }\r
+ queue.RemoveAt(index);\r
+ return true;\r
}\r
\r
/// <summary>\r
}\r
catch (Exception)\r
{\r
- // Any Errors will be out of diskspace/permissions problems. Don't report them as they'll annoy the user.\r
+ // Any Errors will be out of diskspace/permissions problems. Don't report them as they'll annoy the user.\r
}\r
}\r
\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show("HandBrake was unable to recover the queue. \nError Information:" + exc.ToString(),"Queue Recovery Error",MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show("HandBrake was unable to recover the queue. \nError Information:" + exc.ToString(), "Queue Recovery Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
\r
for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)\r
{\r
thisOpt = currentOptsArray[loopcounter];\r
- if (currentOptsArray[currentOptsArrayCount - 1] == "")\r
+ if (currentOptsArray[currentOptsArrayCount - 1] == string.Empty)\r
break;\r
\r
String[] splitOptRange = thisOpt.Split('=');\r
}\r
\r
/* Construct New String for opts here */\r
- if (thisOpt == "")\r
+ if (thisOpt == string.Empty)\r
changedOptString = changedOptString + thisOpt;\r
else\r
{\r
- if (changedOptString == "")\r
+ if (changedOptString == string.Empty)\r
changedOptString = thisOpt;\r
else\r
changedOptString = changedOptString + ":" + thisOpt;\r
\r
namespace Handbrake.Parsing\r
{\r
- \r
+\r
/// <summary>\r
/// An object representing a scanned DVD\r
/// </summary>\r
public static DVD Parse(StreamReader output)\r
{\r
DVD thisDVD = new DVD();\r
- try\r
- {\r
- while (!output.EndOfStream)\r
- {\r
- if ((char)output.Peek() == '+')\r
- thisDVD.m_titles.AddRange(Title.ParseList(output.ReadToEnd()));\r
- else\r
- output.ReadLine();\r
- }\r
- }\r
- catch (Exception exc)\r
+\r
+ while (!output.EndOfStream)\r
{\r
- MessageBox.Show("DVD.CS - Parse" + exc.ToString());\r
+ if ((char)output.Peek() == '+')\r
+ thisDVD.m_titles.AddRange(Title.ParseList(output.ReadToEnd()));\r
+ else\r
+ output.ReadLine();\r
}\r
+\r
return thisDVD;\r
}\r
}\r
/// Default constructor for this object\r
/// </summary>\r
/// <param name="baseStream">The stream to parse from</param>\r
- public Parser(Stream baseStream) : base(baseStream)\r
+ public Parser(Stream baseStream)\r
+ : base(baseStream)\r
{\r
this.m_buffer = string.Empty;\r
}\r
public override string ReadLine()\r
{\r
string tmp = base.ReadLine();\r
- try\r
- {\r
- \r
- this.m_buffer += tmp;\r
- Match m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)");\r
- if (OnReadLine != null)\r
- OnReadLine(this, tmp);\r
-\r
- if (m.Success && OnScanProgress != null)\r
- OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show("Parser.cs - ReadLine " + exc.ToString());\r
- }\r
+\r
+ this.m_buffer += tmp;\r
+ Match m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)");\r
+ if (OnReadLine != null)\r
+ OnReadLine(this, tmp);\r
+\r
+ if (m.Success && OnScanProgress != null)\r
+ OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
+\r
return tmp;\r
}\r
\r
public override string ReadToEnd()\r
{\r
string tmp = base.ReadToEnd();\r
- try\r
- {\r
- this.m_buffer += tmp;\r
- if (OnReadToEnd != null)\r
- OnReadToEnd(this, tmp);\r
\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show("Parser.cs - ReadToEnd " + exc.ToString());\r
- }\r
+ this.m_buffer += tmp;\r
+ if (OnReadToEnd != null)\r
+ OnReadToEnd(this, tmp);\r
+\r
return tmp;\r
}\r
}\r
public static Title Parse(StringReader output)\r
{\r
Title thisTitle = new Title();\r
- try\r
- {\r
- Match m = Regex.Match(output.ReadLine(), @"^\+ title ([0-9]*):");\r
- // Match track number for this title\r
- if (m.Success)\r
- thisTitle.m_titleNumber = int.Parse(m.Groups[1].Value.Trim().ToString());\r
\r
- output.ReadLine();\r
+ Match m = Regex.Match(output.ReadLine(), @"^\+ title ([0-9]*):");\r
+ // Match track number for this title\r
+ if (m.Success)\r
+ thisTitle.m_titleNumber = int.Parse(m.Groups[1].Value.Trim().ToString());\r
\r
- // Get duration for this title\r
+ output.ReadLine();\r
\r
- m = Regex.Match(output.ReadLine(), @"^ \+ duration: ([0-9]{2}:[0-9]{2}:[0-9]{2})");\r
- if (m.Success)\r
- thisTitle.m_duration = TimeSpan.Parse(m.Groups[1].Value);\r
+ // Get duration for this title\r
\r
- // Get resolution, aspect ratio and FPS for this title\r
- m = Regex.Match(output.ReadLine(), @"^ \+ size: ([0-9]*)x([0-9]*), aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");\r
- if (m.Success)\r
- {\r
- thisTitle.m_resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
- thisTitle.m_aspectRatio = float.Parse(m.Groups[3].Value, Functions.Encode.Culture);\r
- }\r
+ m = Regex.Match(output.ReadLine(), @"^ \+ duration: ([0-9]{2}:[0-9]{2}:[0-9]{2})");\r
+ if (m.Success)\r
+ thisTitle.m_duration = TimeSpan.Parse(m.Groups[1].Value);\r
\r
- // Get autocrop region for this title\r
- m = Regex.Match(output.ReadLine(), @"^ \+ autocrop: ([0-9]*)/([0-9]*)/([0-9]*)/([0-9]*)");\r
- if (m.Success)\r
- 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) };\r
+ // Get resolution, aspect ratio and FPS for this title\r
+ m = Regex.Match(output.ReadLine(), @"^ \+ size: ([0-9]*)x([0-9]*), aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");\r
+ if (m.Success)\r
+ {\r
+ thisTitle.m_resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
+ thisTitle.m_aspectRatio = float.Parse(m.Groups[3].Value, Functions.Encode.Culture);\r
+ }\r
\r
- thisTitle.m_chapters.AddRange(Chapter.ParseList(output));\r
+ // Get autocrop region for this title\r
+ m = Regex.Match(output.ReadLine(), @"^ \+ autocrop: ([0-9]*)/([0-9]*)/([0-9]*)/([0-9]*)");\r
+ if (m.Success)\r
+ 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) };\r
\r
- thisTitle.m_audioTracks.AddRange(AudioTrack.ParseList(output));\r
+ thisTitle.m_chapters.AddRange(Chapter.ParseList(output));\r
\r
- thisTitle.m_subtitles.AddRange(Subtitle.ParseList(output));\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show("Title.cs - Parse " + exc.ToString());\r
- }\r
+ thisTitle.m_audioTracks.AddRange(AudioTrack.ParseList(output));\r
+\r
+ thisTitle.m_subtitles.AddRange(Subtitle.ParseList(output));\r
\r
return thisTitle;\r
}\r
public static Title[] ParseList(string output)\r
{\r
List<Title> titles = new List<Title>();\r
- try\r
- {\r
- StringReader sr = new StringReader(output);\r
- while ((char)sr.Peek() == '+')\r
- {\r
- titles.Add(Title.Parse(sr));\r
- }\r
- }\r
- catch (Exception exc)\r
+\r
+ StringReader sr = new StringReader(output);\r
+ while ((char)sr.Peek() == '+')\r
{\r
- MessageBox.Show("Title.cs - ParseList " + exc.ToString());\r
+ titles.Add(Title.Parse(sr));\r
}\r
+\r
return titles.ToArray();\r
}\r
}\r
\r
using System;\r
using System.Collections;\r
+using System.Collections.Generic;\r
using System.ComponentModel;\r
using System.Data;\r
using System.Drawing;\r
private void updateTextFromThread()\r
{\r
string text = "";\r
- ArrayList data = readFile();\r
+ List<string> data = readFile();\r
+ int count = data.Count;\r
\r
- while (position < data.Count)\r
+ while (position < count)\r
{\r
text = data[position].ToString();\r
if (data[position].ToString().Contains("has exited"))\r
}\r
}\r
\r
- private ArrayList readFile()\r
+ private List<string> readFile()\r
{\r
// Ok, the task here is to, Get an arraylist of log data.\r
// And update some global varibles which are pointers to the last displayed log line.\r
- ArrayList logData = new ArrayList();\r
+ List<string> logData = new List<string>();\r
\r
try\r
{\r
{\r
InitializeComponent();\r
\r
- try\r
- {\r
- downloadThread = new Thread(Download);\r
- downloadThread.Start();\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show("An error occured on the Download Thread \n" + exc.ToString(),"Error",MessageBoxButtons.OK, MessageBoxIcon.Error);\r
- }\r
+ downloadThread = new Thread(Download);\r
+ downloadThread.Start();\r
}\r
\r
private void Download()\r
{\r
Functions.AppcastReader rssRead = new Functions.AppcastReader();\r
-\r
string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe");\r
+ string hbUpdate = rssRead.downloadFile();\r
+ WebClient wcDownload = new WebClient();\r
\r
- if (File.Exists(tempPath))\r
- File.Delete(tempPath);\r
+ try\r
+ {\r
+ if (File.Exists(tempPath))\r
+ File.Delete(tempPath);\r
\r
- string hbUpdate = rssRead.downloadFile();\r
+ webRequest = (HttpWebRequest)WebRequest.Create(hbUpdate);\r
+ webRequest.Credentials = CredentialCache.DefaultCredentials;\r
+ webResponse = (HttpWebResponse)webRequest.GetResponse();\r
+ Int64 fileSize = webResponse.ContentLength;\r
\r
- WebClient wcDownload = new WebClient();\r
- try\r
- {\r
- webRequest = (HttpWebRequest)WebRequest.Create(hbUpdate);\r
- webRequest.Credentials = CredentialCache.DefaultCredentials;\r
- webResponse = (HttpWebResponse)webRequest.GetResponse();\r
- Int64 fileSize = webResponse.ContentLength;\r
-\r
- responceStream = wcDownload.OpenRead(hbUpdate);\r
- loacalStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None);\r
-\r
- int bytesSize = 0;\r
- byte[] downBuffer = new byte[2048];\r
-\r
- long flength = 0;\r
- while ((bytesSize = responceStream.Read(downBuffer, 0, downBuffer.Length)) > 0)\r
- {\r
- loacalStream.Write(downBuffer, 0, bytesSize);\r
- flength = loacalStream.Length;\r
- this.Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { loacalStream.Length, fileSize });\r
- }\r
-\r
- responceStream.Close();\r
- loacalStream.Close();\r
-\r
- if (flength != fileSize)\r
- this.Invoke(new DownloadFailedCallback(this.downloadFailed));\r
- else\r
- this.Invoke(new DownloadCompleteCallback(this.downloadComplete));\r
- }\r
- catch (Exception)\r
+ responceStream = wcDownload.OpenRead(hbUpdate);\r
+ loacalStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None);\r
+\r
+ int bytesSize = 0;\r
+ byte[] downBuffer = new byte[2048];\r
+\r
+ long flength = 0;\r
+ while ((bytesSize = responceStream.Read(downBuffer, 0, downBuffer.Length)) > 0)\r
{\r
- // Do Nothing \r
+ loacalStream.Write(downBuffer, 0, bytesSize);\r
+ flength = loacalStream.Length;\r
+ this.Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { loacalStream.Length, fileSize });\r
}\r
+\r
+ responceStream.Close();\r
+ loacalStream.Close();\r
+\r
+ if (flength != fileSize)\r
+ this.Invoke(new DownloadFailedCallback(this.downloadFailed));\r
+ else\r
+ this.Invoke(new DownloadCompleteCallback(this.downloadComplete));\r
+ }\r
+ catch (Exception)\r
+ {\r
+ // Do Nothing \r
+ }\r
}\r
\r
private void UpdateProgress(Int64 BytesRead, Int64 TotalBytes)\r
\r
using System;\r
using System.Collections;\r
+using System.Collections.Generic;\r
using System.Drawing;\r
using System.Text;\r
using System.Windows.Forms;\r
Properties.Settings.Default.hb_build = int.Parse(x[1].ToString());\r
Properties.Settings.Default.hb_version = x[0].ToString();\r
}\r
- catch (Exception) \r
+ catch (Exception)\r
{\r
Properties.Settings.Default.hb_build = 0;\r
Properties.Settings.Default.hb_version = "0";\r
{\r
// Try to load the users default settings.\r
string userDefaults = Properties.Settings.Default.defaultUserSettings;\r
- try\r
- {\r
- Functions.QueryParser presetQuery = Functions.QueryParser.Parse(userDefaults);\r
- hb_common_func.presetLoader(this, presetQuery, "User Defaults ");\r
- }\r
- catch (Exception) { /* Do Nothing */ }\r
+\r
+ Functions.QueryParser presetQuery = Functions.QueryParser.Parse(userDefaults);\r
+ hb_common_func.presetLoader(this, presetQuery, "User Defaults ");\r
}\r
private void queueRecovery()\r
{\r
if (hb_common_func.check_queue_recovery() == true)\r
{\r
DialogResult result;\r
- result = MessageBox.Show("HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?","Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
+ result = MessageBox.Show("HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?", "Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
\r
if (result == DialogResult.Yes)\r
encodeQueue.recoverQueue(); // Start Recovery\r
}\r
private void btn_start_Click(object sender, EventArgs e)\r
{\r
- if (text_source.Text == "" || text_source.Text == "Click 'Source' to continue" || text_destination.Text == "")\r
+ if (text_source.Text == string.Empty || text_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)\r
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
{\r
}\r
private void btn_add2Queue_Click(object sender, EventArgs e)\r
{\r
- if (text_source.Text == "" || text_source.Text == "Click 'Source' to continue" || text_destination.Text == "")\r
+ if (text_source.Text == string.Empty || text_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)\r
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
{\r
drop_chapterStart.BackColor = Color.White;\r
if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))\r
{\r
- try\r
- {\r
- int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
- int chapterStart = int.Parse(drop_chapterStart.Text);\r
+ int chapterFinish, chapterStart = 0;\r
+ int.TryParse(drop_chapterFinish.Text, out chapterFinish);\r
+ int.TryParse(drop_chapterStart.Text, out chapterStart);\r
\r
- if (chapterFinish < chapterStart)\r
- drop_chapterStart.BackColor = Color.LightCoral;\r
- }\r
- catch (Exception)\r
- {\r
+ if (chapterFinish < chapterStart)\r
drop_chapterStart.BackColor = Color.LightCoral;\r
- }\r
}\r
// Run the Autonaming function\r
hb_common_func.autoName(this);\r
drop_chapterFinish.BackColor = Color.White;\r
if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))\r
{\r
- try\r
- {\r
- int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
- int chapterStart = int.Parse(drop_chapterStart.Text);\r
+ int chapterFinish, chapterStart = 0;\r
+ int.TryParse(drop_chapterFinish.Text, out chapterFinish);\r
+ int.TryParse(drop_chapterStart.Text, out chapterStart);\r
\r
- if (chapterFinish < chapterStart)\r
- drop_chapterFinish.BackColor = Color.LightCoral;\r
- }\r
- catch (Exception)\r
- {\r
+ if (chapterFinish < chapterStart)\r
drop_chapterFinish.BackColor = Color.LightCoral;\r
- }\r
}\r
\r
// Run the Autonaming function\r
//Picture Tab\r
private void text_width_TextChanged(object sender, EventArgs e)\r
{\r
- try\r
+ int width;\r
+ Boolean parsed = int.TryParse(text_width.Text, out width);\r
+ if (parsed != false)\r
{\r
- if ((int.Parse(text_width.Text) % 16) != 0)\r
+ if ((width % 16) != 0)\r
text_width.BackColor = Color.LightCoral;\r
else\r
text_width.BackColor = Color.LightGreen;\r
{\r
if (drp_anamorphic.Text == "None")\r
{\r
- int height = cacluateNonAnamorphicHeight(int.Parse(text_width.Text));\r
+ int height = cacluateNonAnamorphicHeight(width);\r
text_height.Text = height.ToString();\r
}\r
}\r
}\r
- catch (Exception)\r
- {\r
- // No need to throw an error here.\r
- }\r
}\r
private void text_height_TextChanged(object sender, EventArgs e)\r
{\r
- try\r
+ int height;\r
+ Boolean parsed = int.TryParse(text_height.Text, out height);\r
+ if (parsed != false)\r
{\r
- if ((int.Parse(text_height.Text) % 16) != 0)\r
+ if ((height % 16) != 0)\r
text_height.BackColor = Color.LightCoral;\r
else\r
text_height.BackColor = Color.LightGreen;\r
}\r
- catch (Exception)\r
- {\r
- // No need to alert the user.\r
- }\r
}\r
private void drp_crop_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
x264PanelFunctions.X264_StandardizeOptString(this);\r
x264PanelFunctions.X264_SetCurrentSettingsInPanel(this);\r
\r
- if (rtf_x264Query.Text == "")\r
+ if (rtf_x264Query.Text == string.Empty)\r
x264PanelFunctions.reset2Defaults(this);\r
}\r
}\r
// Chapter Selection Duration calculation\r
public void calculateDuration()\r
{\r
- int start_chapter;\r
- int end_chapter;\r
TimeSpan Duration = TimeSpan.FromSeconds(0.0);\r
\r
- try\r
+ // Get the durations between the 2 chapter points and add them together.\r
+ if (drop_chapterStart.Text != "Auto" && drop_chapterFinish.Text != "Auto")\r
{\r
- // Get the durations between the 2 chapter points and add them together.\r
- if (drop_chapterStart.Text != "Auto" && drop_chapterFinish.Text != "Auto")\r
- {\r
- start_chapter = int.Parse(drop_chapterStart.Text);\r
- end_chapter = int.Parse(drop_chapterFinish.Text);\r
+ int start_chapter, end_chapter = 0;\r
+ int.TryParse(drop_chapterStart.Text, out start_chapter);\r
+ int.TryParse(drop_chapterFinish.Text, out end_chapter);\r
\r
- int position = start_chapter - 1;\r
+ int position = start_chapter - 1;\r
\r
- while (position != end_chapter)\r
- {\r
- TimeSpan dur = selectedTitle.Chapters[position].Duration;\r
- Duration = Duration + dur;\r
- position++;\r
- }\r
+ while (position != end_chapter)\r
+ {\r
+ TimeSpan dur = selectedTitle.Chapters[position].Duration;\r
+ Duration = Duration + dur;\r
+ position++;\r
}\r
}\r
- catch (Exception) { /* Don't do anything */ }\r
\r
// Set the Duration\r
lbl_duration.Text = Duration.ToString();\r
drp_audenc_1.Items.Add("MP3");\r
drp_audenc_1.Items.Add("AC3");\r
drp_audenc_1.Items.Add("Vorbis");\r
- if (drp_audenc_1.Text == "")\r
+ if (drp_audenc_1.Text == string.Empty)\r
drp_audenc_1.SelectedIndex = 0;\r
\r
\r
drp_audenc_2.Items.Add("Vorbis");\r
if (drp_audenc_2.Enabled)\r
{\r
- if (drp_audenc_2.Text == "")\r
+ if (drp_audenc_2.Text == string.Empty)\r
drp_audenc_2.SelectedIndex = 0;\r
}\r
\r
drp_audenc_3.Items.Add("Vorbis");\r
if (drp_audenc_3.Enabled)\r
{\r
- if (drp_audenc_3.Text == "")\r
+ if (drp_audenc_3.Text == string.Empty)\r
drp_audenc_3.SelectedIndex = 0;\r
}\r
\r
drp_audenc_4.Items.Add("Vorbis");\r
if (drp_audenc_4.Enabled)\r
{\r
- if (drp_audenc_4.Text == "")\r
+ if (drp_audenc_4.Text == string.Empty)\r
drp_audenc_4.SelectedIndex = 0;\r
}\r
}\r
presetHandler.loadPresetFiles();\r
\r
treeView_presets.Nodes.Clear();\r
- ArrayList presetNameList = new ArrayList();\r
+ List<string> presetNameList = new List<string>();\r
presetNameList = presetHandler.getPresetNames();\r
\r
// Adds a new preset name to the preset list.\r
public frmUpdater()\r
{\r
InitializeComponent();\r
- \r
+\r
getRss();\r
setVersions();\r
}\r
\r
private void getRss()\r
- { \r
+ {\r
wBrowser.DocumentText = "<font face=\"verdana\" size=\"1\">" + rssRead.versionInfo() + "</font>";\r
}\r
\r
private void setVersions()\r
{\r
- lbl_oldVersion.Text = "(you have: " + Properties.Settings.Default.hb_version + " / " + Properties.Settings.Default.hb_build + ").";\r
+ lbl_oldVersion.Text = "(you have: " + Properties.Settings.Default.hb_version + " / " + Properties.Settings.Default.hb_build + ").";\r
lbl_newVersion.Text = rssRead.version() + " (" + rssRead.build() + ")";\r
}\r
\r
{\r
frmDownload download = new frmDownload();\r
download.Show();\r
- this.Close(); \r
+ this.Close();\r
}\r
\r
private void btn_remindLater_Click(object sender, EventArgs e)\r
\r
private void btn_skip_Click(object sender, EventArgs e)\r
{\r
- try\r
- {\r
- Properties.Settings.Default.skipversion = int.Parse(rssRead.build());\r
- Properties.Settings.Default.Save();\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show(exc.ToString());\r
- }\r
+ Properties.Settings.Default.skipversion = int.Parse(rssRead.build());\r
+ Properties.Settings.Default.Save();\r
+\r
this.Close();\r
}\r
\r