diff options
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/Functions/CLI.cs | 1 | ||||
-rw-r--r-- | win/C#/Installer/Installer.nsi | 139 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 29 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 121 |
4 files changed, 261 insertions, 29 deletions
diff --git a/win/C#/Functions/CLI.cs b/win/C#/Functions/CLI.cs index c1502a462..c98d64f47 100644 --- a/win/C#/Functions/CLI.cs +++ b/win/C#/Functions/CLI.cs @@ -16,7 +16,6 @@ namespace Handbrake.Functions /// </summary>
static readonly public CultureInfo Culture = new CultureInfo("en-US", false);
-
Process hbProc = new Process();
public Process runCli(object s, string query, bool stderr, bool stdout, bool useShellExec, bool noWindow)
diff --git a/win/C#/Installer/Installer.nsi b/win/C#/Installer/Installer.nsi new file mode 100644 index 000000000..66a3f73df --- /dev/null +++ b/win/C#/Installer/Installer.nsi @@ -0,0 +1,139 @@ +; Script generated by the HM NIS Edit Script Wizard.
+
+; HM NIS Edit Wizard helper defines
+!define PRODUCT_NAME "Handbrake"
+!define PRODUCT_VERSION "2.4"
+!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Handbrake.exe"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+
+; MUI 1.67 compatible ------
+!include "MUI.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_ICON "handbrakepineapple.ico"
+!define MUI_UNICON "handbrakepineapple.ico"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+; License page
+!insertmacro MUI_PAGE_LICENSE "doc\COPYING"
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+!define MUI_FINISHPAGE_RUN "$INSTDIR\Handbrake.exe"
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+
+; MUI end ------
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+OutFile "Handbrake-Win.exe"
+
+!include WordFunc.nsh
+!insertmacro VersionCompare
+!include LogicLib.nsh
+
+; Check to see if .NET Framework 2.0 or above is Installed.
+Function .onInit
+ Call GetDotNETVersion
+ Pop $0
+ ${If} $0 == "not found"
+ MessageBox MB_OK|MB_ICONSTOP ".NET runtime library is not installed."
+ Abort
+ ${EndIf}
+
+ StrCpy $0 $0 "" 1 # skip "v"
+
+ ${VersionCompare} $0 "2.0" $1
+ ${If} $1 == 2
+ MessageBox MB_OK|MB_ICONSTOP ".NET runtime library v2.0 or newer is required. You have $0."
+ Abort
+ ${EndIf}
+FunctionEnd
+
+Function GetDotNETVersion
+ Push $0
+ Push $1
+
+ System::Call "mscoree::GetCORVersion(w .r0, i ${NSIS_MAX_STRLEN}, *i) i .r1 ?u"
+ StrCmp $1 "error" 0 +2
+ StrCpy $0 "not found"
+
+ Pop $1
+ Exch $0
+FunctionEnd
+
+
+
+
+
+InstallDir "$PROGRAMFILES\Handbrake"
+InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
+ShowInstDetails show
+ShowUnInstDetails show
+
+Section "Handbrake" SEC01
+ SetOutPath "$INSTDIR"
+ SetOverwrite ifnewer
+ File "Handbrake.exe"
+ CreateDirectory "$SMPROGRAMS\Handbrake"
+ CreateShortCut "$SMPROGRAMS\Handbrake\Handbrake.lnk" "$INSTDIR\Handbrake.exe"
+ CreateShortCut "$DESKTOP\Handbrake.lnk" "$INSTDIR\Handbrake.exe"
+ File "dvdinfo.dat"
+ File "cygwin1.dll"
+ File "hbcli.exe"
+ File "Handbrake.exe.config"
+ File "handbrakepineapple.ico"
+SectionEnd
+
+Section -AdditionalIcons
+ CreateShortCut "$SMPROGRAMS\Handbrake\Uninstall.lnk" "$INSTDIR\uninst.exe"
+SectionEnd
+
+Section -Post
+ WriteUninstaller "$INSTDIR\uninst.exe"
+ WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Handbrake.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Handbrake.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+SectionEnd
+
+
+Function un.onUninstSuccess
+ HideWindow
+ MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
+FunctionEnd
+
+Function un.onInit
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
+ Abort
+FunctionEnd
+
+Section Uninstall
+ Delete "$INSTDIR\uninst.exe"
+ Delete "$INSTDIR\handbrakepineapple.ico"
+ Delete "$INSTDIR\hbcli.exe"
+ Delete "$INSTDIR\cygwin1.dll"
+ Delete "$INSTDIR\dvdinfo.dat"
+ Delete "$INSTDIR\Handbrake.exe"
+ Delete "$INSTDIR\Handbrake.exe.config"
+ Delete "$SMPROGRAMS\Handbrake\Uninstall.lnk"
+ Delete "$DESKTOP\Handbrake.lnk"
+ Delete "$SMPROGRAMS\Handbrake\Handbrake.lnk"
+ RMDir "$SMPROGRAMS\Handbrake"
+ RMDir "$INSTDIR"
+
+ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
+ SetAutoClose true
+SectionEnd
\ No newline at end of file diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 16c3a6555..e537a11de 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -126,6 +126,7 @@ namespace Handbrake this.lbl_encode = new System.Windows.Forms.Label();
this.btn_eCancel = new System.Windows.Forms.Button();
this.TabPage6 = new System.Windows.Forms.TabPage();
+ this.button1 = new System.Windows.Forms.Button();
this.label23 = new System.Windows.Forms.Label();
this.Label7 = new System.Windows.Forms.Label();
this.Label39 = new System.Windows.Forms.Label();
@@ -187,7 +188,6 @@ namespace Handbrake this.text_left = new System.Windows.Forms.TextBox();
this.advancedOptions = new System.Windows.Forms.TabControl();
this.groupBox_dest = new System.Windows.Forms.GroupBox();
- this.button1 = new System.Windows.Forms.Button();
Label38 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();
this.frmMainMenu.SuspendLayout();
@@ -1225,6 +1225,19 @@ namespace Handbrake this.TabPage6.TabIndex = 6;
this.TabPage6.Text = "Query Editor";
//
+ // button1
+ //
+ this.button1.FlatAppearance.BorderColor = System.Drawing.Color.Black;
+ this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.button1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.button1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.button1.Location = new System.Drawing.Point(176, 59);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(134, 23);
+ this.button1.TabIndex = 44;
+ this.button1.Text = "Copy to Clipboard";
+ this.button1.UseVisualStyleBackColor = true;
+ //
// label23
//
this.label23.AutoSize = true;
@@ -1947,19 +1960,6 @@ namespace Handbrake this.groupBox_dest.TabStop = false;
this.groupBox_dest.Text = "Destination";
//
- // button1
- //
- this.button1.FlatAppearance.BorderColor = System.Drawing.Color.Black;
- this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.button1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.button1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.button1.Location = new System.Drawing.Point(176, 59);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(134, 23);
- this.button1.TabIndex = 44;
- this.button1.Text = "Copy to Clipboard";
- this.button1.UseVisualStyleBackColor = true;
- //
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1982,6 +1982,7 @@ namespace Handbrake this.Name = "frmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Handbrake";
+ this.Load += new System.EventHandler(this.frmMain_Load);
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).EndInit();
this.frmMainMenu.ResumeLayout(false);
this.frmMainMenu.PerformLayout();
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 976eb1171..2df32a39f 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -10,13 +10,18 @@ using System.IO; using System.Diagnostics;
using System.Threading;
using System.Runtime.InteropServices;
+using Microsoft.VisualBasic;
namespace Handbrake
{
public partial class frmMain : Form
{
+ // --------------------------------------------------------------
+ // Applicaiton Startup Stuff
+ // --------------------------------------------------------------
+ #region Application Startup
private Process hbProc;
private Parsing.DVD thisDVD;
@@ -24,19 +29,18 @@ namespace Handbrake // Some windows that require only 1 instance.
// --------------------------------------------------------------
private frmQueue queueWindow = new frmQueue();
-
- // --------------------------------------------------------------
- // Stuff that needs doing on startup.
- // - Load users default settings. (if required)
- // - Do an update check (if required)
- // --------------------------------------------------------------
//private frmDvdInfo dvdInfoWindow = new frmDvdInfo();
+
+ /*
+ * Stuff that needs to be done on program launch
+ */
+
public frmMain()
{
ThreadPool.QueueUserWorkItem(showSplash);
- Thread.Sleep(3000);
+ Thread.Sleep(1000);
InitializeComponent();
@@ -45,6 +49,9 @@ namespace Handbrake //dvdInfoWindow.Hide();
// **********************************************************************************************
+ // System Requirements Check
+ systemCheck();
+
// Set the Version number lable to the corect version.
Version.Text = "Version " + Properties.Settings.Default.GuiVersion;
@@ -62,6 +69,8 @@ namespace Handbrake }
+ #region Initializeation Functions
+
private void showSplash(object sender)
{
Form splash = new frmSplashScreen();
@@ -202,6 +211,91 @@ namespace Handbrake }
}
+ #region Memory Check
+
+ public struct MEMORYSTATUS
+ {
+ 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;
+ // Aditional Varibles left in for future usage (JIC)
+ }
+
+ [DllImport("kernel32.dll")]
+ public static extern void GlobalMemoryStatus
+ (
+ ref MEMORYSTATUS lpBuffer
+ );
+
+ public uint CheckMemeory()
+ {
+ // Call the native GlobalMemoryStatus method
+ // with the defined structure.
+ MEMORYSTATUS memStatus = new MEMORYSTATUS();
+ GlobalMemoryStatus(ref memStatus);
+
+ // Use a StringBuilder for the message box string.
+ uint MemoryInfo = memStatus.dwTotalPhys;
+
+ // Return the Ram Information
+ return MemoryInfo;
+
+ }
+
+
+ #endregion
+ Boolean preventLaunch = false;
+ private void systemCheck()
+ {
+ try
+ {
+ // Make sure the screen resolution is not below 1024x768
+ System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.PrimaryScreen;
+ if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 768))
+ {
+ MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Screen resolution is too Low. Must be 1024x768 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ preventLaunch = true;
+ }
+
+ // Make sure the system has enough RAM. 384MB or greater
+ uint memory = CheckMemeory();
+
+ if (memory < 319) // Set to 319 to allow for 64MB dedicated to video Memory and Windows returnig the memory figure slightly out.
+ {
+ MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Insufficient Memory. 384MB or greater required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ preventLaunch = true;
+ }
+ }
+ catch (Exception exc)
+ {
+ if (Properties.Settings.Default.GuiDebug == "Checked")
+ {
+ MessageBox.Show("frmMain.cs - systemCheck() " + exc.ToString());
+ }
+ }
+ }
+
+ #endregion
+
+
+
+ // --------------------------------------------------------------
+ // Close the Application on main window load if required by the system Check
+ // --------------------------------------------------------------
+
+ private void frmMain_Load(object sender, EventArgs e)
+ {
+ if (preventLaunch == true)
+ {
+ Application.Exit();
+ }
+ }
+ #endregion
// --------------------------------------------------------------
// The main Menu bar.
@@ -1290,13 +1384,10 @@ namespace Handbrake #endregion
- /*
- * ---------------------------------------------------
- *
- * The query Generation function.
- *
- * ---------------------------------------------------
- */
+ //---------------------------------------------------
+ // Some Functions
+ // - Query Generation
+ //---------------------------------------------------
#region Program Functions
@@ -1668,6 +1759,8 @@ namespace Handbrake #endregion
+
+
// This is the END of the road ------------------------------------------------------------------------------
}
}
\ No newline at end of file |