summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/C#/EncodeQueue/Encode.cs11
-rw-r--r--win/C#/EncodeQueue/QueueHandler.cs1
-rw-r--r--win/C#/Functions/PresetLoader.cs1
-rw-r--r--win/C#/Functions/QueryGenerator.cs62
-rw-r--r--win/C#/Functions/Win32.cs27
-rw-r--r--win/C#/frmActivityWindow.cs24
-rw-r--r--win/C#/frmMain.Designer.cs1
-rw-r--r--win/C#/frmMain.cs10
-rw-r--r--win/C#/frmPreview.cs7
9 files changed, 62 insertions, 82 deletions
diff --git a/win/C#/EncodeQueue/Encode.cs b/win/C#/EncodeQueue/Encode.cs
index 77b2b2957..22518bfb2 100644
--- a/win/C#/EncodeQueue/Encode.cs
+++ b/win/C#/EncodeQueue/Encode.cs
@@ -8,19 +8,12 @@ using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.IO;
-using System.Runtime.InteropServices;
using Handbrake.Functions;
namespace Handbrake.EncodeQueue
{
public class Encode
{
- // DLL Imports
- [DllImport("user32.dll")]
- private static extern void LockWorkStation();
- [DllImport("user32.dll")]
- private static extern int ExitWindowsEx(int uFlags, int dwReason);
-
/// <summary>
/// Execute a HandBrakeCLI process.
/// </summary>
@@ -121,7 +114,7 @@ namespace Handbrake.EncodeQueue
Process.Start("Shutdown", "-s -t 60");
break;
case "Log Off":
- ExitWindowsEx(0, 0);
+ Win32.ExitWindowsEx(0, 0);
break;
case "Suspend":
Application.SetSuspendState(PowerState.Suspend, true, true);
@@ -130,7 +123,7 @@ namespace Handbrake.EncodeQueue
Application.SetSuspendState(PowerState.Hibernate, true, true);
break;
case "Lock System":
- LockWorkStation();
+ Win32.LockWorkStation();
break;
case "Quit HandBrake":
Application.Exit();
diff --git a/win/C#/EncodeQueue/QueueHandler.cs b/win/C#/EncodeQueue/QueueHandler.cs
index f34de0190..d16f10ffb 100644
--- a/win/C#/EncodeQueue/QueueHandler.cs
+++ b/win/C#/EncodeQueue/QueueHandler.cs
@@ -10,7 +10,6 @@ using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.Threading;
-using System.Diagnostics;
namespace Handbrake.EncodeQueue
{
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs
index 7d5e479c1..44f9016ee 100644
--- a/win/C#/Functions/PresetLoader.cs
+++ b/win/C#/Functions/PresetLoader.cs
@@ -100,7 +100,6 @@ namespace Handbrake.Functions
mainWindow.pictureSettings.txt_parHeight.Text = presetQuery.pixelAspectHeight.ToString();
mainWindow.pictureSettings.drop_modulus.SelectedItem = presetQuery.AnamorphicModulus;
-
// Reset maxWidth and MaxHeight to 0
mainWindow.pictureSettings.maxWidth = 0;
mainWindow.pictureSettings.maxHeight = 0;
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index 595c9c175..c90d7dbb0 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -5,7 +5,6 @@
It may be used under the terms of the GNU General Public License. */
using System;
-using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.IO;
@@ -20,7 +19,7 @@ namespace Handbrake.Functions
/// </summary>
/// <param name="mainWindow"></param>
/// <returns>The CLI String</returns>
- public string GenerateTheQuery(frmMain mainWindow)
+ public string generateTheQuery(frmMain mainWindow)
{
// Source tab
string query = "";
@@ -61,7 +60,7 @@ namespace Handbrake.Functions
/// <param name="duration">Duration</param>
/// <param name="preview">Start at preview</param>
/// <returns>Returns a CLI query String.</returns>
- public string GeneratePreviewQuery(frmMain mainWindow, string duration, string preview)
+ public string generatePreviewQuery(frmMain mainWindow, string duration, string preview)
{
int seconds;
int.TryParse(duration, out seconds);
@@ -141,7 +140,7 @@ namespace Handbrake.Functions
else
{
if (mainWindow.pictureSettings.text_height.Text != "")
- query += " -Y " + mainWindow.pictureSettings.text_height.Text;
+ query += " -Y " + mainWindow.pictureSettings.text_height.Text;
}
string cropTop = mainWindow.pictureSettings.crop_top.Text;
@@ -179,7 +178,7 @@ namespace Handbrake.Functions
if (mainWindow.pictureSettings.txt_parWidth.Text != "" && mainWindow.pictureSettings.txt_parHeight.Text != "")
query += " --pixel-aspect " + mainWindow.pictureSettings.txt_parWidth.Text + ":" + mainWindow.pictureSettings.txt_parHeight.Text + " ";
break;
- }
+ }
#endregion
#region Filters
@@ -227,7 +226,7 @@ namespace Handbrake.Functions
switch (mainWindow.drp_videoEncoder.Text)
{
case "MPEG-4 (FFmpeg)":
- value = 31 - (mainWindow.slider_videoQuality.Value -1);
+ value = 31 - (mainWindow.slider_videoQuality.Value - 1);
query += " -q " + value.ToString(new CultureInfo("en-US"));
break;
case "H.264 (x264)":
@@ -245,8 +244,8 @@ namespace Handbrake.Functions
value = mainWindow.slider_videoQuality.Value;
query += " -q " + value.ToString(new CultureInfo("en-US"));
break;
- }
- }
+ }
+ }
if (mainWindow.check_2PassEncode.Checked)
query += " -2 ";
@@ -325,7 +324,7 @@ namespace Handbrake.Functions
// Audio Codec (-E)
foreach (String item in codecs)
{
-
+
if (firstLoop)
{
audioItems = item; firstLoop = false;
@@ -411,7 +410,7 @@ namespace Handbrake.Functions
// Attach Source name and dvd title to the start of the chapters.csv filename.
// This is for the queue. It allows different chapter name files for each title.
- string[] destName = mainWindow.text_destination.Text.Split('\\');
+ string[] destName = mainWindow.text_destination.Text.Split('\\');
string dest_name = destName[destName.Length - 1];
dest_name = dest_name.Replace("\"", "");
dest_name = dest_name.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", "");
@@ -424,8 +423,8 @@ namespace Handbrake.Functions
{
if (dest_name.Trim() != String.Empty)
{
- string path = source_title != "Automatic"
- ? Path.Combine(Path.GetTempPath(), dest_name + "-" + source_title + "-chapters.csv")
+ string path = source_title != "Automatic"
+ ? Path.Combine(Path.GetTempPath(), dest_name + "-" + source_title + "-chapters.csv")
: Path.Combine(Path.GetTempPath(), dest_name + "-chapters.csv");
if (chapterCSVSave(mainWindow, path) == false)
@@ -450,19 +449,13 @@ namespace Handbrake.Functions
query += " -v " + Properties.Settings.Default.verboseLevel;
- if (Properties.Settings.Default.dvdnav =="Checked")
+ if (Properties.Settings.Default.dvdnav == "Checked")
query += " --dvdnav";
#endregion
return query;
}
- /// <summary>
- /// Get the CLI equive of the audio mixdown from the widget name.
- /// </summary>
- /// <param name="selectedAudio"></param>
- /// <returns></returns>
- ///
private static string getMixDown(string selectedAudio)
{
switch (selectedAudio)
@@ -483,13 +476,6 @@ namespace Handbrake.Functions
return "auto";
}
}
-
- /// <summary>
- /// Get the CLI equiv of the audio encoder from the widget name.
- /// </summary>
- /// <param name="selectedEncoder"></param>
- /// <returns></returns>
- ///
private static string getAudioEncoder(string selectedEncoder)
{
switch (selectedEncoder)
@@ -508,29 +494,21 @@ namespace Handbrake.Functions
return "";
}
}
-
- /// <summary>
- /// This function saves the data in the chapters tab, dataGridView into a CSV file called chapters.csv
- /// in a directory specified by file_path_name
- /// </summary>
- /// <param name="mainWindow"></param>
- /// <param name="file_path_name"></param>
- /// <returns></returns>
- private static Boolean chapterCSVSave(frmMain mainWindow, string file_path_name)
+ private static Boolean chapterCSVSave(frmMain mainWindow, string filePathName)
{
try
{
- StringBuilder csv = new StringBuilder();
+ string csv = "";
foreach (DataGridViewRow row in mainWindow.data_chpt.Rows)
{
- csv.Append(row.Cells[0].Value.ToString());
- csv.Append(",");
- csv.Append(row.Cells[1].Value.ToString());
- csv.Append(Environment.NewLine);
+ csv += row.Cells[0].Value.ToString();
+ csv += ",";
+ csv += row.Cells[1].Value.ToString();
+ csv += Environment.NewLine;
}
- StreamWriter file = new StreamWriter(file_path_name);
- file.Write(csv.ToString());
+ StreamWriter file = new StreamWriter(filePathName);
+ file.Write(csv);
file.Close();
file.Dispose();
return true;
diff --git a/win/C#/Functions/Win32.cs b/win/C#/Functions/Win32.cs
index 2d067b40e..2bc47e619 100644
--- a/win/C#/Functions/Win32.cs
+++ b/win/C#/Functions/Win32.cs
@@ -1,4 +1,5 @@
-using System.Runtime.InteropServices;
+using System;
+using System.Runtime.InteropServices;
namespace Handbrake.Functions
{
@@ -6,5 +7,29 @@ namespace Handbrake.Functions
{
[DllImport("user32.dll")]
public static extern int SetForegroundWindow(int hWnd);
+
+ [DllImport("user32.dll")]
+ public static extern void LockWorkStation();
+
+ [DllImport("user32.dll")]
+ public static extern int ExitWindowsEx(int uFlags, int dwReason);
+
+ public struct MEMORYSTATUS // Unused var's are requred here.
+ {
+ public UInt32 dwLength;
+ public UInt32 dwMemoryLoad;
+ public UInt32 dwTotalPhys; // Used
+ public UInt32 dwAvailPhys;
+ public UInt32 dwTotalPageFile;
+ public UInt32 dwAvailPageFile;
+ public UInt32 dwTotalVirtual;
+ public UInt32 dwAvailVirtual;
+ }
+
+ [DllImport("kernel32.dll")]
+ public static extern void GlobalMemoryStatus
+ (
+ ref MEMORYSTATUS lpBuffer
+ );
}
}
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs
index 981ed2f34..76364d7e9 100644
--- a/win/C#/frmActivityWindow.cs
+++ b/win/C#/frmActivityWindow.cs
@@ -8,8 +8,8 @@ using System;
using System.Windows.Forms;
using System.IO;
using System.Threading;
-using System.Runtime.InteropServices;
using Handbrake.EncodeQueue;
+using Handbrake.Functions;
using Microsoft.Win32;
@@ -304,23 +304,7 @@ namespace Handbrake
#endregion
#region System Information
- private struct MEMORYSTATUS // Unused var's are requred here.
- {
- public UInt32 dwLength;
- public UInt32 dwMemoryLoad;
- public UInt32 dwTotalPhys; // Used
- public UInt32 dwAvailPhys;
- public UInt32 dwTotalPageFile;
- public UInt32 dwAvailPageFile;
- public UInt32 dwTotalVirtual;
- public UInt32 dwAvailVirtual;
- }
-
- [DllImport("kernel32.dll")]
- private static extern void GlobalMemoryStatus
- (
- ref MEMORYSTATUS lpBuffer
- );
+
/// <summary>
/// Returns the total physical ram in a system
@@ -328,8 +312,8 @@ namespace Handbrake
/// <returns></returns>
public uint TotalPhysicalMemory()
{
- MEMORYSTATUS memStatus = new MEMORYSTATUS();
- GlobalMemoryStatus(ref memStatus);
+ Win32.MEMORYSTATUS memStatus = new Win32.MEMORYSTATUS();
+ Win32.GlobalMemoryStatus(ref memStatus);
uint MemoryInfo = memStatus.dwTotalPhys;
MemoryInfo = MemoryInfo / 1024 / 1024;
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs
index 7411f232d..912b49faa 100644
--- a/win/C#/frmMain.Designer.cs
+++ b/win/C#/frmMain.Designer.cs
@@ -941,6 +941,7 @@ namespace Handbrake
this.audioPanel.Name = "audioPanel";
this.audioPanel.Size = new System.Drawing.Size(715, 310);
this.audioPanel.TabIndex = 0;
+
//
// AudioMenuRowHeightHack
//
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 3f67f3bc9..33a177a1f 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -301,7 +301,7 @@ namespace Handbrake
}
private void btn_new_preset_Click(object sender, EventArgs e)
{
- Form preset = new frmAddPreset(this, queryGen.GenerateTheQuery(this), presetHandler);
+ Form preset = new frmAddPreset(this, queryGen.generateTheQuery(this), presetHandler);
preset.ShowDialog();
}
#endregion
@@ -549,7 +549,7 @@ namespace Handbrake
// This is used for tracking which file to load in the activity window
lastAction = "encode";
- String query = rtf_query.Text != "" ? rtf_query.Text : queryGen.GenerateTheQuery(this);
+ String query = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateTheQuery(this);
if (encodeQueue.count() == 0)
{
@@ -575,7 +575,7 @@ namespace Handbrake
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
{
- String query = queryGen.GenerateTheQuery(this);
+ String query = queryGen.generateTheQuery(this);
if (rtf_query.Text != "")
query = rtf_query.Text;
@@ -1235,7 +1235,7 @@ namespace Handbrake
// Query Editor Tab
private void btn_generate_Query_Click(object sender, EventArgs e)
{
- rtf_query.Text = queryGen.GenerateTheQuery(this);
+ rtf_query.Text = queryGen.generateTheQuery(this);
}
private void btn_clear_Click(object sender, EventArgs e)
{
@@ -1613,6 +1613,8 @@ namespace Handbrake
}
#endregion
+
+
// This is the END of the road ****************************************
}
} \ No newline at end of file
diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs
index 7ea472772..f38ee5c99 100644
--- a/win/C#/frmPreview.cs
+++ b/win/C#/frmPreview.cs
@@ -4,7 +4,6 @@ using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;
-using AxQTOControlLib;
using Handbrake.EncodeQueue;
using Handbrake.Functions;
using QTOControlLib;
@@ -32,7 +31,7 @@ namespace Handbrake
}
catch (Exception exc)
{
- MessageBox.Show(mw, "It would appear QuickTime 7 is not installed. QuickTime preview functionality will be disabled! \n\n Debug Info:\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show(mw, "It would appear QuickTime 7 is not installed or not accessible. QuickTime preview functionality will be disabled! \n\n Debug Info:\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
btn_playQT.Enabled = false;
noQT = true;
}
@@ -59,7 +58,7 @@ namespace Handbrake
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (VLC) ...";
- String query = hb_common_func.GeneratePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
+ String query = hb_common_func.generatePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
ThreadPool.QueueUserWorkItem(procMonitor, query);
}
private void btn_playQT_Click(object sender, EventArgs e)
@@ -79,7 +78,7 @@ namespace Handbrake
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (QT) ...";
- String query = hb_common_func.GeneratePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
+ String query = hb_common_func.generatePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
ThreadPool.QueueUserWorkItem(procMonitor, query);
}
private void procMonitor(object state)