summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-08-27 23:45:44 +0000
committersr55 <[email protected]>2008-08-27 23:45:44 +0000
commitc1f31822b78859305328750ca0adcd0b1699f690 (patch)
tree9751e09ecee8a9199e5f49ae0af351f71a8be794 /win/C#/Functions
parent1833f566d3f9c7fbe0ef61b4f9304b6e0f7fddb5 (diff)
WinGui:
- Code Refactoring and optimization to numerous files git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1655 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r--win/C#/Functions/Common.cs18
-rw-r--r--win/C#/Functions/Presets.cs16
-rw-r--r--win/C#/Functions/Queue.cs15
-rw-r--r--win/C#/Functions/x264Panel.cs6
4 files changed, 24 insertions, 31 deletions
diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs
index 7ff2ec806..02e7628ca 100644
--- a/win/C#/Functions/Common.cs
+++ b/win/C#/Functions/Common.cs
@@ -235,7 +235,7 @@ namespace Handbrake.Functions
#region Audio
// Handle Track 1
- if (presetQuery.AudioTrack1 == "")
+ if (presetQuery.AudioTrack1 == string.Empty)
mainWindow.drp_track1Audio.Text = "Automatic";
else
mainWindow.drp_track1Audio.Text = presetQuery.AudioTrack1;
@@ -527,13 +527,13 @@ namespace Handbrake.Functions
query += " --crop 0:0:0:0 ";
else if (mainWindow.drp_crop.Text == "Custom")
{
- if (mainWindow.text_top.Text == "")
+ if (mainWindow.text_top.Text == string.Empty)
cropTop = "0";
- if (mainWindow.text_bottom.Text == "")
+ if (mainWindow.text_bottom.Text == string.Empty)
cropBottom = "0";
- if (mainWindow.text_left.Text == "")
+ if (mainWindow.text_left.Text == string.Empty)
cropLeft = "0";
- if (mainWindow.text_right.Text == "")
+ if (mainWindow.text_right.Text == string.Empty)
cropRight = "0";
query += " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
@@ -728,7 +728,7 @@ namespace Handbrake.Functions
if (aencoder2 != "")
{
- if (aencoder1 == "")
+ if (aencoder1 == string.Empty)
query += " -E faac," + getAudioEncoder(aencoder2);
else
query += "," + getAudioEncoder(aencoder2);
@@ -748,7 +748,7 @@ namespace Handbrake.Functions
if (audioBitrate2 != "")
{
- if (audioBitrate1 == "")
+ if (audioBitrate1 == string.Empty)
query += " -B 160," + audioBitrate2;
else
query += "," + audioBitrate2;
@@ -767,7 +767,7 @@ namespace Handbrake.Functions
if (audioSampleRate2 != "")
{
- if (audioSampleRate1 == "")
+ if (audioSampleRate1 == string.Empty)
query += " -R 0," + audioSampleRate2.Replace("Auto", "0");
else
query += "," + audioSampleRate2.Replace("Auto", "0");
@@ -779,7 +779,7 @@ namespace Handbrake.Functions
if ((track2 != "") && (track2 != "None"))
{
- if (audioSampleRate1 == "")
+ if (audioSampleRate1 == string.Empty)
query += " -R 0,0";
else
query += ",0";
diff --git a/win/C#/Functions/Presets.cs b/win/C#/Functions/Presets.cs
index 2e725c52d..0e176b12a 100644
--- a/win/C#/Functions/Presets.cs
+++ b/win/C#/Functions/Presets.cs
@@ -1,5 +1,5 @@
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
@@ -10,8 +10,8 @@ namespace Handbrake.Functions
{
public class Presets
{
- ArrayList presets = new ArrayList();
- ArrayList user_presets = new ArrayList();
+ List<string> presets = new List<string>();
+ List<string> user_presets = new List<string>();
/// <summary>
/// Add a new preset to the system
@@ -40,8 +40,8 @@ namespace Handbrake.Functions
/// <param name="name">String, the preset name</param>
public void remove(string name)
{
- ArrayList newPresets = new ArrayList();
- ArrayList newUserPresets = new ArrayList();
+ List<string> newPresets = new List<string>();
+ List<string> newUserPresets = new List<string>();
// Built In Presets
foreach (string item in presets)
@@ -91,9 +91,9 @@ namespace Handbrake.Functions
/// Includes both built in and user presets.
/// </summary>
/// <returns>Arraylist of preset names</returns>
- public ArrayList getPresetNames()
+ public List<string> getPresetNames()
{
- ArrayList names = new ArrayList();
+ List<string> names = new List<string>();
// Built In Presets
foreach (string item in presets)
@@ -219,7 +219,7 @@ namespace Handbrake.Functions
// Check if a preset already exists in either the built in or user presets
private Boolean checkIfPresetExists(string name)
{
- if (name == "")
+ if (name == string.Empty)
return true;
// Built In Presets
diff --git a/win/C#/Functions/Queue.cs b/win/C#/Functions/Queue.cs
index ad4ecaf44..dc2345358 100644
--- a/win/C#/Functions/Queue.cs
+++ b/win/C#/Functions/Queue.cs
@@ -45,15 +45,8 @@ namespace Handbrake.Functions
/// <returns>Bolean true if successful</returns>
public Boolean remove(int index)
{
- try
- {
- queue.RemoveAt(index);
- return true;
- }
- catch (Exception)
- {
- return false;
- }
+ queue.RemoveAt(index);
+ return true;
}
/// <summary>
@@ -125,7 +118,7 @@ namespace Handbrake.Functions
}
catch (Exception)
{
- // Any Errors will be out of diskspace/permissions problems. Don't report them as they'll annoy the user.
+ // Any Errors will be out of diskspace/permissions problems. Don't report them as they'll annoy the user.
}
}
@@ -150,7 +143,7 @@ namespace Handbrake.Functions
}
catch (Exception exc)
{
- MessageBox.Show("HandBrake was unable to recover the queue. \nError Information:" + exc.ToString(),"Queue Recovery Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show("HandBrake was unable to recover the queue. \nError Information:" + exc.ToString(), "Queue Recovery Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
diff --git a/win/C#/Functions/x264Panel.cs b/win/C#/Functions/x264Panel.cs
index 0101f0fcf..8a93a2121 100644
--- a/win/C#/Functions/x264Panel.cs
+++ b/win/C#/Functions/x264Panel.cs
@@ -232,7 +232,7 @@ namespace Handbrake.Functions
for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)
{
thisOpt = currentOptsArray[loopcounter];
- if (currentOptsArray[currentOptsArrayCount - 1] == "")
+ if (currentOptsArray[currentOptsArrayCount - 1] == string.Empty)
break;
String[] splitOptRange = thisOpt.Split('=');
@@ -257,11 +257,11 @@ namespace Handbrake.Functions
}
/* Construct New String for opts here */
- if (thisOpt == "")
+ if (thisOpt == string.Empty)
changedOptString = changedOptString + thisOpt;
else
{
- if (changedOptString == "")
+ if (changedOptString == string.Empty)
changedOptString = thisOpt;
else
changedOptString = changedOptString + ":" + thisOpt;