diff options
author | sr55 <[email protected]> | 2008-11-27 14:39:02 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2008-11-27 14:39:02 +0000 |
commit | 1944002dcb084dae133c19ca977c733ace018dfe (patch) | |
tree | 8cd484a7638e74e37bdf631a9d344eacff0ca2f9 /win/C#/Functions | |
parent | 25e3446f3159e1bb0d56e3881bcc16e63bc17fe3 (diff) |
WinGui:
- Removed RAM limitation code on startup.
- Gets rid of the SystemInfo Class. It's no longer required. Since the ram limitation code has been remove, only the activity window needs access to the information, so, the code has been moved to frmActivityWindow.cs
- Removed some redundant code from frmMain.cs. Cleaned the startup code block up a bit.
- Re-structured frmMain.cs. Moved the code around into more logical regions.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1964 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r-- | win/C#/Functions/Main.cs | 44 | ||||
-rw-r--r-- | win/C#/Functions/SystemInfo.cs | 57 |
2 files changed, 27 insertions, 74 deletions
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 0a202b15d..4018ea896 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -323,9 +323,10 @@ namespace Handbrake.Functions public ArrayList getCliVersionData()
{
ArrayList cliVersionData = new ArrayList();
+ String line;
+
// 0 = SVN Build / Version
// 1 = Build Date
-
Process cliProcess = new Process();
ProcessStartInfo handBrakeCLI = new ProcessStartInfo("HandBrakeCLI.exe", " -u");
handBrakeCLI.UseShellExecute = false;
@@ -333,28 +334,37 @@ namespace Handbrake.Functions handBrakeCLI.RedirectStandardOutput = true;
handBrakeCLI.CreateNoWindow = true;
cliProcess.StartInfo = handBrakeCLI;
- cliProcess.Start();
- // Retrieve standard output and report back to parent thread until the process is complete
- String line;
- TextReader stdOutput = cliProcess.StandardError;
-
- while (!cliProcess.HasExited)
+ try
{
- line = stdOutput.ReadLine();
- if (line == null) line = "";
- Match m = Regex.Match(line, @"HandBrake ([0-9\.]*)*(svn[0-9]*[M]*)* \([0-9]*\)");
+ cliProcess.Start();
+ // Retrieve standard output and report back to parent thread until the process is complete
+ TextReader stdOutput = cliProcess.StandardError;
- if (m.Success != false)
+ while (!cliProcess.HasExited)
{
- string data = line.Replace("(", "").Replace(")", "").Replace("HandBrake ", "");
- string[] arr = data.Split(' ');
- cliVersionData.Add(arr[0]);
- cliVersionData.Add(arr[1]);
- return cliVersionData;
+ line = stdOutput.ReadLine();
+ if (line == null) line = "";
+ Match m = Regex.Match(line, @"HandBrake ([0-9\.]*)*(svn[0-9]*[M]*)* \([0-9]*\)");
+
+ if (m.Success != false)
+ {
+ string data = line.Replace("(", "").Replace(")", "").Replace("HandBrake ", "");
+ string[] arr = data.Split(' ');
+ cliVersionData.Add(arr[0]);
+ cliVersionData.Add(arr[1]);
+ return cliVersionData;
+ }
}
}
- return null;
+ catch (Exception e)
+ {
+ MessageBox.Show("Unable to retrieve version information from the CLI. \nError:\n" + e);
+ }
+
+ cliVersionData.Add(0);
+ cliVersionData.Add("0");
+ return cliVersionData;
}
/// <summary>
diff --git a/win/C#/Functions/SystemInfo.cs b/win/C#/Functions/SystemInfo.cs deleted file mode 100644 index 535bda6d3..000000000 --- a/win/C#/Functions/SystemInfo.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System;
-using System.Runtime.InteropServices;
-using Microsoft.Win32;
-
-namespace Handbrake.Functions
-{
- class SystemInfo
- {
- #region CheckRam
- private 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;
- }
-
- [DllImport("kernel32.dll")]
- private static extern void GlobalMemoryStatus
- (
- ref MEMORYSTATUS lpBuffer
- );
-
-
- /// <summary>
- /// Returns the total physical ram in a system
- /// </summary>
- /// <returns></returns>
- public uint TotalPhysicalMemory()
- {
- MEMORYSTATUS memStatus = new MEMORYSTATUS();
- GlobalMemoryStatus(ref memStatus);
-
- uint MemoryInfo = memStatus.dwTotalPhys;
- MemoryInfo = MemoryInfo / 1024 / 1024;
-
- return MemoryInfo;
- }
- #endregion
-
- public Object getCpuCount()
- {
- RegistryKey RegKey = Registry.LocalMachine;
- RegKey = RegKey.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
- return RegKey.GetValue("ProcessorNameString");
- }
-
- public System.Windows.Forms.Screen screenBounds()
- {
- return System.Windows.Forms.Screen.PrimaryScreen;
- }
- }
-}
|