using System;\r
using System.Diagnostics;\r
using System.Windows.Forms;\r
-using System.Globalization;\r
using System.IO;\r
using System.Runtime.InteropServices;\r
\r
\r
// Declarations\r
Process hbProc = new Process();\r
- Boolean encoding = false;\r
-\r
- // CLI output is based on en-US locale,\r
- static readonly private CultureInfo Culture = new CultureInfo("en-US", false);\r
+ Boolean encoding;\r
\r
/// <summary>\r
/// Execute a HandBrakeCLI process.\r
switch (Properties.Settings.Default.CompletionOption)\r
{\r
case "Shutdown":\r
- System.Diagnostics.Process.Start("Shutdown", "-s -t 60");\r
+ Process.Start("Shutdown", "-s -t 60");\r
break;\r
case "Log Off":\r
ExitWindowsEx(0, 0);\r
if (Properties.Settings.Default.saveLog == "Checked")\r
{\r
string logPath = Path.Combine(Path.GetTempPath(), "hb_encode_log.dat");\r
- Functions.QueryParser parsed = Functions.QueryParser.Parse(query);\r
\r
if (Properties.Settings.Default.saveLogWithVideo == "Checked")\r
{\r
/// </summary>\r
public Boolean isEncoding\r
{\r
- get { if (encoding == false) return false; else return true; }\r
+ get { return encoding; }\r
}\r
\r
}\r
\r
if (chapters.Success)\r
{\r
- var actTitles = new string[2];\r
- actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
+ string[] actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
thisQuery.q_chaptersStart = int.Parse(actTitles[0]);\r
if (actTitles.Length > 1)\r
{\r
if (crop.Success)\r
{\r
thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");\r
- var actCropValues = new string[3];\r
- actCropValues = thisQuery.q_cropValues.Split(':');\r
+ string[] actCropValues = thisQuery.q_cropValues.Split(':');\r
thisQuery.q_croptop = actCropValues[0];\r
thisQuery.q_cropbottom = actCropValues[1];\r
thisQuery.q_cropLeft = actCropValues[2];\r
thisQuery.q_twoPass = twoPass.Success;\r
thisQuery.q_turboFirst = turboFirstPass.Success;\r
thisQuery.q_largeMp4 = largerMp4.Success;\r
- if (videoFramerate.Success)\r
- thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ", "");\r
- else\r
- thisQuery.q_videoFramerate = "Same as source";\r
+ thisQuery.q_videoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source";\r
\r
if (videoBitrate.Success)\r
thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");\r
if (videoFilesize.Success)\r
thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", "");\r
\r
- double qConvert = 0;\r
+ double qConvert;\r
if (videoQuality.Success)\r
{\r
qConvert = double.Parse(videoQuality.ToString().Replace("-q ", ""), Culture)*100;\r
String read_file;\r
Thread monitor;\r
Functions.Encode encodeHandler;\r
- int position = 0; // Position in the arraylist reached by the current log output in the rtf box.\r
+ int position; // Position in the arraylist reached by the current log output in the rtf box.\r
\r
/// <summary>\r
/// This window should be used to display the RAW output of the handbrake CLI which is produced during an encode.\r
public frmActivityWindow(string file, Functions.Encode eh)\r
{\r
InitializeComponent();\r
- this.rtf_actLog.Text = string.Empty;\r
+ rtf_actLog.Text = string.Empty;\r
\r
// When the window closes, we want to abort the monitor thread.\r
this.Disposed += new EventHandler(forceQuit);\r
{\r
// Add a header to the log file indicating that it's from the Windows GUI and display the windows version\r
rtf_actLog.AppendText(String.Format("### Windows GUI {1} {0} \n", Properties.Settings.Default.hb_build, Properties.Settings.Default.hb_version));\r
- rtf_actLog.AppendText(String.Format("### Running: {0} \n###\n", Environment.OSVersion.ToString()));\r
+ rtf_actLog.AppendText(String.Format("### Running: {0} \n###\n", Environment.OSVersion));\r
rtf_actLog.AppendText(String.Format("### CPU: {0} \n", getCpuCount()));\r
rtf_actLog.AppendText(String.Format("### Ram: {0} MB \n", TotalPhysicalMemory()));\r
rtf_actLog.AppendText(String.Format("### Screen: {0}x{1} \n", screenBounds().Bounds.Width, screenBounds().Bounds.Height));\r
updateTextFromThread();\r
while (true)\r
{\r
- if (encodeHandler.isEncoding == true)\r
+ if (encodeHandler.isEncoding)\r
updateTextFromThread();\r
else\r
{\r
{\r
try\r
{\r
- string text = "";\r
+ string text;\r
List<string> data = readFile();\r
int count = data.Count;\r
\r
while (position < count)\r
{\r
- text = data[position].ToString();\r
- if (data[position].ToString().Contains("has exited"))\r
+ text = data[position];\r
+ if (data[position].Contains("has exited"))\r
text = "\n ############ End of Log ############## \n";\r
position++;\r
\r
// InvokeRequired required compares the thread ID of the\r
// calling thread to the thread ID of the creating thread.\r
// If these threads are different, it returns true.\r
- if (this.IsHandleCreated) // Make sure the windows has a handle before doing anything\r
+ if (IsHandleCreated) // Make sure the windows has a handle before doing anything\r
{\r
- if (this.rtf_actLog.InvokeRequired)\r
+ if (rtf_actLog.InvokeRequired)\r
{\r
SetTextCallback d = new SetTextCallback(SetText);\r
- this.Invoke(d, new object[] { text });\r
+ Invoke(d, new object[] { text });\r
}\r
else\r
- this.rtf_actLog.AppendText(text);\r
+ rtf_actLog.AppendText(text);\r
}\r
}\r
catch (Exception exc)\r
while (line != null)\r
{\r
if (line.Trim() != "")\r
- logData.Add(line + System.Environment.NewLine);\r
+ logData.Add(line + Environment.NewLine);\r
\r
line = sr.ReadLine();\r
}\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show("Error in readFile() \n Unable to read the log file.\n You may have to restart HandBrake.\n Error Information: \n\n" + exc.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ MessageBox.Show("Error in readFile() \n Unable to read the log file.\n You may have to restart HandBrake.\n Error Information: \n\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
}\r
return null;\r
}\r
#region System Information\r
private struct MEMORYSTATUS\r
{\r
- public UInt32 dwLength;\r
- public UInt32 dwMemoryLoad;\r
public UInt32 dwTotalPhys; // Used\r
- public UInt32 dwAvailPhys;\r
- public UInt32 dwTotalPageFile;\r
- public UInt32 dwAvailPageFile;\r
- public UInt32 dwTotalVirtual;\r
- public UInt32 dwAvailVirtual;\r
}\r
\r
[DllImport("kernel32.dll")]\r
/// Get the System screen size information.\r
/// </summary>\r
/// <returns>System.Windows.Forms.Scree</returns>\r
- public System.Windows.Forms.Screen screenBounds()\r
+ public Screen screenBounds()\r
{\r
- return System.Windows.Forms.Screen.PrimaryScreen;\r
+ return Screen.PrimaryScreen;\r
}\r
\r
#endregion\r
if (check_pictureSettings.Checked)\r
pictureSettings = true;\r
\r
- if (presetCode.addPreset(txt_preset_name.Text.Trim(), query, pictureSettings) == true)\r
+ if (presetCode.addPreset(txt_preset_name.Text.Trim(), query, pictureSettings))\r
{\r
frmMainWindow.loadPresetPanel();\r
this.Close();\r
{\r
public partial class frmDownload : Form\r
{\r
- private Thread downloadThread;\r
+ private readonly Thread downloadThread;\r
private Stream responceStream;\r
private Stream loacalStream;\r
private HttpWebRequest webRequest;\r
responceStream = wcDownload.OpenRead(hbUpdate);\r
loacalStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None);\r
\r
- int bytesSize = 0;\r
+ int bytesSize;\r
byte[] downBuffer = new byte[2048];\r
\r
long flength = 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
+ 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
+ Invoke(new DownloadFailedCallback(this.downloadFailed));\r
else\r
- this.Invoke(new DownloadCompleteCallback(this.downloadComplete));\r
+ Invoke(new DownloadCompleteCallback(this.downloadComplete));\r
}\r
catch (Exception)\r
{\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show("Integer Conversion Error On Download \n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show("Integer Conversion Error On Download \n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
\r
btn_cancel.Text = "Close";\r
\r
string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe");\r
-\r
- Process startInstall = Process.Start(tempPath);\r
+ Process.Start(tempPath);\r
this.Close();\r
Application.Exit();\r
}\r
\r
private void btn_play_Click(object sender, EventArgs e)\r
{\r
- String currently_playing;\r
-\r
// Get the Destination of the sample video.\r
- currently_playing = "";\r
+ String currently_playing = "";\r
if (mainWindow.text_destination.Text != "")\r
currently_playing = mainWindow.text_destination.Text.Replace(".m", "_sample.m").Replace(".avi", "_sample.avi").Replace(".ogm", "_sample.ogm");\r
\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(encodingMessage));\r
+ BeginInvoke(new UpdateHandler(encodingMessage));\r
return;\r
}\r
lbl_status.Text = "Encoding, Please wait ...";\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(updateUIElements));\r
+ BeginInvoke(new UpdateHandler(updateUIElements));\r
return;\r
}\r
\r
private frmGenPreview vlcpreview;\r
private frmPreview qtpreview;\r
private string lastAction;\r
- public int maxWidth = 0;\r
- public int maxHeight = 0;\r
+ public int maxWidth;\r
+ public int maxHeight;\r
\r
\r
Process hbproc;\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new updateStatusChanger(startupUpdateCheck));\r
+ BeginInvoke(new updateStatusChanger(startupUpdateCheck));\r
return;\r
}\r
\r
Boolean update = hb_common_func.updateCheck(false);\r
- if (update == true)\r
+ if (update)\r
{\r
frmUpdater updateWindow = new frmUpdater();\r
updateWindow.Show();\r
}\r
private void queueRecovery()\r
{\r
- if (hb_common_func.check_queue_recovery() == true)\r
+ if (hb_common_func.check_queue_recovery())\r
{\r
DialogResult 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
}\r
private void mnu_encodeLog_Click(object sender, EventArgs e)\r
{\r
- String file = String.Empty;\r
+ String file;\r
if (lastAction == "scan")\r
file = "dvdinfo.dat";\r
else\r
private void mnu_delete_preset_Click(object sender, EventArgs e)\r
{\r
// Empty the preset file\r
- string presetsFile = Application.StartupPath.ToString() + "\\presets.xml";\r
+ string presetsFile = Application.StartupPath + "\\presets.xml";\r
if (File.Exists(presetsFile))\r
File.Delete(presetsFile);\r
\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show("An error has occured during the preset removal process.\n If you are using Windows Vista, you may need to run under Administrator Mode to complete this task. \n" + exc.ToString());\r
+ MessageBox.Show("An error has occured during the preset removal process.\n If you are using Windows Vista, you may need to run under Administrator Mode to complete this task. \n" + exc);\r
}\r
\r
// Reload the preset panel\r
int i = 0;\r
foreach (TreeNode node in treeView_presets.Nodes)\r
{\r
- if (nodeStatus[i] == true)\r
+ if (nodeStatus[i])\r
node.Expand();\r
\r
i++;\r
int i = 0;\r
foreach (TreeNode node in treeView_presets.Nodes)\r
{\r
- if (nodeStatus[i] == true)\r
+ if (nodeStatus[i])\r
node.Expand();\r
\r
foreach (TreeNode subNode in node.Nodes)\r
{\r
- if (nodeStatus[i] == true)\r
+ if (nodeStatus[i])\r
subNode.Expand();\r
}\r
\r
{\r
foreach (TreeNode node in treenode.Nodes)\r
{\r
- if (node.Text.ToString().Equals("Normal"))\r
+ if (node.Text.Equals("Normal"))\r
treeView_presets.SelectedNode = treeView_presets.Nodes[treenode.Index].Nodes[0];\r
}\r
}\r
// This is used for tracking which file to load in the activity window\r
lastAction = "encode";\r
\r
- String query;\r
- if (rtf_query.Text != "")\r
- query = rtf_query.Text;\r
- else\r
- query = queryGen.GenerateTheQuery(this);\r
+ String query = rtf_query.Text != "" ? rtf_query.Text : queryGen.GenerateTheQuery(this);\r
\r
if (encodeQueue.count() == 0)\r
{\r
}\r
private void btn_ActivityWindow_Click(object sender, EventArgs e)\r
{\r
-\r
-\r
- String file = String.Empty;\r
- if (lastAction == "scan")\r
- file = "dvdinfo.dat";\r
- else\r
- file = "hb_encode_log.dat";\r
+ String file = lastAction == "scan" ? "dvdinfo.dat" : "hb_encode_log.dat";\r
\r
frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeHandler);\r
ActivityWindow.Show();\r
if (FormWindowState.Minimized == this.WindowState)\r
{\r
notifyIcon.Visible = true;\r
- if (lbl_encode.Text != "")\r
- notifyIcon.BalloonTipText = lbl_encode.Text;\r
- else\r
- notifyIcon.BalloonTipText = "Not Encoding";\r
+ notifyIcon.BalloonTipText = lbl_encode.Text != "" ? lbl_encode.Text : "Not Encoding";\r
notifyIcon.ShowBalloonTip(500);\r
this.Hide();\r
}\r
// This is used for tracking which file to load in the activity window\r
lastAction = "scan";\r
\r
- String filename = "";\r
+ String filename;\r
text_source.Text = "";\r
\r
DVD_Open.ShowDialog();\r
// This is used for tracking which file to load in the activity window\r
lastAction = "scan";\r
\r
- String filename = "";\r
+ String filename;\r
text_source.Text = "";\r
\r
ISO_Open.ShowDialog();\r
// This is used for tracking which file to load in the activity window\r
lastAction = "scan";\r
\r
- String filename = "";\r
if (mnu_dvd_drive.Text.Contains("VIDEO_TS"))\r
{\r
string[] path = mnu_dvd_drive.Text.Split(' ');\r
- filename = path[0];\r
+ String filename = path[0];\r
setupGUIforScan(filename);\r
startScan(filename);\r
}\r
}\r
private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
- int c_start, c_end = 1;\r
+ int c_start, c_end;\r
\r
if (drop_chapterFinish.Text == "Auto" && drop_chapterFinish.Items.Count != 0)\r
drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count - 1;\r
}\r
private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
- int c_start, c_end = 1;\r
+ int c_start, c_end;\r
\r
if (drop_chapterStart.Text == "Auto" && drop_chapterStart.Items.Count >= 1)\r
drop_chapterStart.SelectedIndex = 1;\r
// Run the Autonaming function\r
if (Properties.Settings.Default.autoNaming == "Checked")\r
text_destination.Text = hb_common_func.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex);\r
- \r
+\r
// Add more rows to the Chapter menu if needed.\r
if (Check_ChapterMarkers.Checked)\r
{\r
int n = data_chpt.Rows.Add();\r
data_chpt.Rows[n].Cells[0].Value = (i + 1);\r
data_chpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);\r
- data_chpt.Rows[n].Cells[0].ValueType = typeof (int);\r
- data_chpt.Rows[n].Cells[1].ValueType = typeof (string);\r
+ data_chpt.Rows[n].Cells[0].ValueType = typeof(int);\r
+ data_chpt.Rows[n].Cells[1].ValueType = typeof(string);\r
i++;\r
}\r
}\r
}\r
private void slider_videoQuality_Scroll(object sender, EventArgs e)\r
{\r
- SliderValue.Text = slider_videoQuality.Value.ToString() + "%";\r
+ SliderValue.Text = slider_videoQuality.Value + "%";\r
text_bitrate.Text = "";\r
text_filesize.Text = "";\r
check_2PassEncode.Enabled = false;\r
\r
int width;\r
Boolean parsed = int.TryParse(text_width.Text, out width);\r
- if (parsed != false)\r
+ if (parsed)\r
{\r
- if ((width % 16) != 0)\r
- text_width.BackColor = Color.LightCoral;\r
- else\r
- text_width.BackColor = Color.LightGreen;\r
-\r
+ text_width.BackColor = (width % 16) != 0 ? Color.LightCoral : Color.LightGreen;\r
\r
if (lbl_Aspect.Text != "Select a Title" && maxWidth == 0 && maxHeight == 0)\r
{\r
\r
int height;\r
Boolean parsed = int.TryParse(text_height.Text, out height);\r
- if (parsed != false)\r
- {\r
- if ((height % 16) != 0)\r
- text_height.BackColor = Color.LightCoral;\r
- else\r
- text_height.BackColor = Color.LightGreen;\r
- }\r
+ if (parsed)\r
+ text_height.BackColor = (height % 16) != 0 ? Color.LightCoral : Color.LightGreen;\r
}\r
private void check_customCrop_CheckedChanged(object sender, EventArgs e)\r
{\r
}\r
private void slider_deblock_Scroll(object sender, EventArgs e)\r
{\r
- if (slider_deblock.Value == 4)\r
- lbl_deblockVal.Text = "Off";\r
- else\r
- lbl_deblockVal.Text = slider_deblock.Value.ToString();\r
+ lbl_deblockVal.Text = slider_deblock.Value == 4 ? "Off" : slider_deblock.Value.ToString();\r
}\r
\r
//Audio Tab\r
drp_audmix_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text;\r
drp_audsr_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text;\r
drp_audbit_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text;\r
- double drcValue = 0; int drcCalculated = 0;\r
+ double drcValue; int drcCalculated;\r
double.TryParse(lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text, out drcValue);\r
drcValue = (drcValue * 10) - 10;\r
int.TryParse(drcValue.ToString(), out drcCalculated);\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show("frmMain.cs - startScan " + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show("frmMain.cs - startScan " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
private void scanProcess(object state)\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show("frmMain.cs - scanProcess() " + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show("frmMain.cs - scanProcess() " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
enableGUI();\r
}\r
}\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new ProgressUpdateHandler(getDriveInfoThread));\r
+ BeginInvoke(new ProgressUpdateHandler(getDriveInfoThread));\r
return;\r
}\r
\r
{\r
if (curDrive.IsReady)\r
{\r
- if (File.Exists(curDrive.RootDirectory.ToString() + "VIDEO_TS\\VIDEO_TS.IFO"))\r
- mnu_dvd_drive.Text = curDrive.RootDirectory.ToString() + "VIDEO_TS (" + curDrive.VolumeLabel + ")";\r
+ if (File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))\r
+ mnu_dvd_drive.Text = curDrive.RootDirectory + "VIDEO_TS (" + curDrive.VolumeLabel + ")";\r
else\r
mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
\r
#region Audio Panel Code Helpers\r
private void setAudioByContainer(String path)\r
{\r
- string oldval = "";\r
+ string oldval;\r
\r
if ((path.EndsWith(".mp4")) || (path.EndsWith(".m4v")))\r
{\r
}\r
private void setVideoByContainer(String path)\r
{\r
- string oldval = "";\r
+ string oldval;\r
\r
if ((path.EndsWith(".mp4")) || (path.EndsWith(".m4v")))\r
{\r
dropdown.Items.Add("Dolby Surround");\r
dropdown.Items.Add("Dolby Pro Logic II");\r
}\r
- private void audioEncoderChange(ComboBox audenc, ComboBox audMix, ComboBox audbit, ComboBox audsr)\r
- {\r
- if (audenc.Text == "AC3")\r
- {\r
- audMix.Enabled = false;\r
- audbit.Enabled = false;\r
- audsr.Enabled = false;\r
-\r
- audMix.Text = "Automatic";\r
- audbit.Text = "160";\r
- audsr.Text = "Auto";\r
- }\r
- else\r
- {\r
- // Just make sure not to re-enable the following boxes if the track above is none\r
- /* if (drp_track2Audio.Text != "None")\r
- {\r
- audMix.Enabled = true;\r
- audbit.Enabled = true;\r
- audsr.Enabled = true;\r
-\r
- audMix.Text = "Automatic";\r
- audbit.Text = "160";\r
- audsr.Text = "Auto";\r
- }*/\r
- }\r
- }\r
#endregion\r
\r
#region Public Methods\r
/// 1 = Encode Running\r
/// 0 = Encode Finished.\r
/// </summary>\r
- /// <param name="i">Int</param>\r
public void setEncodeFinished()\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateWindowHandler(setEncodeFinished));\r
+ BeginInvoke(new UpdateWindowHandler(setEncodeFinished));\r
return;\r
}\r
\r
notifyIcon.BalloonTipText = lbl_encode.Text;\r
notifyIcon.ShowBalloonTip(500);\r
}\r
-\r
}\r
catch (Exception exc)\r
{\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateWindowHandler(setEncodeStarted));\r
+ BeginInvoke(new UpdateWindowHandler(setEncodeStarted));\r
return;\r
}\r
\r
\r
treeView_presets.Nodes.Clear();\r
\r
- List<Presets.Preset> presetNameList = new List<Presets.Preset>();\r
- List<string> presetNames = new List<string>();\r
- TreeNode preset_treeview = new TreeNode();\r
+ List<Presets.Preset> presetNameList;\r
+ List<string> presetNames;\r
+ TreeNode preset_treeview;\r
\r
TreeNode rootNode = new TreeNode();\r
TreeNode rootNodeTwo = new TreeNode();\r
- TreeNode childNode = new TreeNode();\r
+ TreeNode childNode;\r
int workingLevel = 0;\r
string previousCategory = String.Empty;\r
string currentCategory = String.Empty;\r
private void check_saveLogWithVideo_CheckedChanged(object sender, EventArgs e)\r
{\r
Properties.Settings.Default.saveLogWithVideo = check_saveLogWithVideo.CheckState.ToString();\r
- if (check_saveLogWithVideo.Checked == true)\r
+ if (check_saveLogWithVideo.Checked)\r
text_logPath.Text = "";\r
}\r
\r
\r
private void play()\r
{\r
- player = new Thread(OpenMovie);\r
- player.IsBackground = true;\r
+ player = new Thread(OpenMovie) {IsBackground = true};\r
player.Start();\r
}\r
\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateUIHandler(OpenMovie));\r
+ BeginInvoke(new UpdateUIHandler(OpenMovie));\r
return;\r
}\r
QTControl.URL = currently_playing;\r
catch (COMException ex)\r
{\r
QTUtils qtu = new QTUtils();\r
- MessageBox.Show("Unable to open movie:\n\nError Code: " + ex.ErrorCode.ToString("X") + "\nQT Error code : " + qtu.QTErrorFromErrorCode(ex.ErrorCode).ToString());\r
+ MessageBox.Show("Unable to open movie:\n\nError Code: " + ex.ErrorCode.ToString("X") + "\nQT Error code : " + qtu.QTErrorFromErrorCode(ex.ErrorCode));\r
}\r
catch (Exception ex)\r
{\r
- MessageBox.Show("Unable to open movie:\n\n" + ex.ToString());\r
+ MessageBox.Show("Unable to open movie:\n\n" + ex);\r
}\r
}\r
\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateUIHandler(encodeCompleted));\r
+ BeginInvoke(new UpdateUIHandler(encodeCompleted));\r
return;\r
}\r
btn_encode.Enabled = true;\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show("frmPreview.cs encodeCompleted " + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show("frmPreview.cs encodeCompleted " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
#endregion\r
/// <summary>\r
/// Initializes the Queue list with the Arraylist from the Queue class\r
/// </summary>\r
- /// <param name="qw"></param>\r
public void setQueue()\r
{\r
updateUIElements();\r
// Start and Stop Controls\r
private void btn_encode_Click(object sender, EventArgs e)\r
{\r
- if (queue.isPaused == true)\r
+ if (queue.isPaused)\r
{\r
setUIEncodeStarted();\r
MessageBox.Show("Encoding restarted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
// Window Display Management\r
private void setUIEncodeStarted()\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(setUIEncodeStarted));\r
+ BeginInvoke(new UpdateHandler(setUIEncodeStarted));\r
return;\r
}\r
btn_encode.Enabled = false;\r
}\r
private void setUIEncodeFinished()\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(setUIEncodeFinished));\r
+ BeginInvoke(new UpdateHandler(setUIEncodeFinished));\r
return;\r
}\r
btn_pause.Visible = false;\r
}\r
private void resetQueue()\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(resetQueue));\r
+ BeginInvoke(new UpdateHandler(resetQueue));\r
return;\r
}\r
btn_pause.Visible = false;\r
}\r
private void redrawQueue()\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(redrawQueue));\r
+ BeginInvoke(new UpdateHandler(redrawQueue));\r
return;\r
}\r
\r
Functions.QueryParser parsed = Functions.QueryParser.Parse(q_item);\r
\r
// Get the DVD Title\r
- string title = "";\r
- if (parsed.DVDTitle == 0)\r
- title = "Auto";\r
- else\r
- title = parsed.DVDTitle.ToString();\r
+ string title = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();\r
\r
// Get the DVD Chapters\r
- string chapters = "";\r
+ string chapters;\r
if (parsed.DVDChapterStart == 0)\r
chapters = "Auto";\r
else\r
}\r
private void updateUIElements()\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(updateUIElements));\r
+ BeginInvoke(new UpdateHandler(updateUIElements));\r
return;\r
}\r
\r
{\r
try\r
{\r
- if (this.InvokeRequired)\r
+ if (InvokeRequired)\r
{\r
- this.BeginInvoke(new UpdateHandler(setCurrentEncodeInformation));\r
+ BeginInvoke(new UpdateHandler(setCurrentEncodeInformation));\r
}\r
\r
// found query is a global varible\r
lbl_source.Text = queue.getLastQueryItem().Source;\r
lbl_dest.Text = queue.getLastQueryItem().Destination;\r
\r
- if (parsed.DVDTitle == 0)\r
- lbl_title.Text = "Auto";\r
- else\r
- lbl_title.Text = parsed.DVDTitle.ToString();\r
+ lbl_title.Text = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();\r
\r
- string chapters = "";\r
- if (parsed.DVDChapterStart == 0)\r
- {\r
- lbl_chapt.Text = "Auto";\r
- }\r
+ if (Equals(parsed.DVDChapterStart, 0))\r
+ lbl_chapt.Text = "Auto";\r
else\r
{\r
- chapters = parsed.DVDChapterStart.ToString();\r
+ string chapters = parsed.DVDChapterStart.ToString();\r
if (parsed.DVDChapterFinish != 0)\r
chapters = chapters + " - " + parsed.DVDChapterFinish;\r
lbl_chapt.Text = chapters;\r