blob: 0b745732495611474ababd6779a04da8b6b5db91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Diagnostics;
using System.Threading;
using System.Runtime.InteropServices;
using System.Globalization;
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
}
}
|