summaryrefslogtreecommitdiffstats
path: root/win/C#/frmActivityWindow.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-11-27 14:39:02 +0000
committersr55 <[email protected]>2008-11-27 14:39:02 +0000
commit1944002dcb084dae133c19ca977c733ace018dfe (patch)
tree8cd484a7638e74e37bdf631a9d344eacff0ca2f9 /win/C#/frmActivityWindow.cs
parent25e3446f3159e1bb0d56e3881bcc16e63bc17fe3 (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#/frmActivityWindow.cs')
-rw-r--r--win/C#/frmActivityWindow.cs74
1 files changed, 67 insertions, 7 deletions
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs
index 5508d0b93..d21eecd51 100644
--- a/win/C#/frmActivityWindow.cs
+++ b/win/C#/frmActivityWindow.cs
@@ -16,6 +16,7 @@ using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;
+using Microsoft.Win32;
namespace Handbrake
@@ -62,15 +63,12 @@ namespace Handbrake
/// </summary>
private void displayLogHeader()
{
- // System Information
- Functions.SystemInfo info = new Functions.SystemInfo();
-
// Add a header to the log file indicating that it's from the Windows GUI and display the windows version
rtf_actLog.AppendText(String.Format("### Windows GUI {1} {0} \n", Properties.Settings.Default.hb_build, Properties.Settings.Default.hb_version));
rtf_actLog.AppendText(String.Format("### Running: {0} \n###\n", Environment.OSVersion.ToString()));
- rtf_actLog.AppendText(String.Format("### CPU: {0} \n", info.getCpuCount()));
- rtf_actLog.AppendText(String.Format("### Ram: {0} MB \n", info.TotalPhysicalMemory()));
- rtf_actLog.AppendText(String.Format("### Screen: {0}x{1} \n", info.screenBounds().Bounds.Width, info.screenBounds().Bounds.Height));
+ rtf_actLog.AppendText(String.Format("### CPU: {0} \n", getCpuCount()));
+ rtf_actLog.AppendText(String.Format("### Ram: {0} MB \n", TotalPhysicalMemory()));
+ rtf_actLog.AppendText(String.Format("### Screen: {0}x{1} \n", screenBounds().Bounds.Width, screenBounds().Bounds.Height));
rtf_actLog.AppendText(String.Format("### Temp Dir: {0} \n", Path.GetTempPath()));
rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath));
rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));
@@ -306,12 +304,74 @@ namespace Handbrake
this.Close();
}
- private void copyToolStripMenuItem_Click(object sender, EventArgs e)
+ /// <summary>
+ /// Copy Log Menu Item on the right click menu for the log rtf box
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void mnu_copy_log_Click(object sender, EventArgs e)
{
if (rtf_actLog.SelectedText != "")
Clipboard.SetDataObject(rtf_actLog.SelectedText, true);
else
Clipboard.SetDataObject(rtf_actLog.Text, true);
}
+
+ #region System Information
+ 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;
+ }
+
+ /// <summary>
+ /// Get the number of CPU Cores
+ /// </summary>
+ /// <returns>Object</returns>
+ public Object getCpuCount()
+ {
+ RegistryKey RegKey = Registry.LocalMachine;
+ RegKey = RegKey.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
+ return RegKey.GetValue("ProcessorNameString");
+ }
+
+ /// <summary>
+ /// Get the System screen size information.
+ /// </summary>
+ /// <returns>System.Windows.Forms.Scree</returns>
+ public System.Windows.Forms.Screen screenBounds()
+ {
+ return System.Windows.Forms.Screen.PrimaryScreen;
+ }
+
+ #endregion
+
}
} \ No newline at end of file