blob: 87fad342deda7c18444c5e1af909d65fd6779956 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
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;
namespace Handbrake
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
/* Some Code to allow development builds to expire.
*
* long start = DateTime.Now.Ticks;
* 633286573227430160 today was long end = DateTime.Now.AddDays(31).Ticks;
* if (start > 633286573227430160) { MessageBox.Show("Sorry, this Handbrake has expired"); return; }
*
*/
// Check the system meets the system requirements.
Boolean launch = true;
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);
launch = false;
}
// Make sure the system has enough RAM. 384MB or greater
uint memory = MemoryCheck.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);
launch = false;
}
}
catch (Exception exc)
{
if (Properties.Settings.Default.GuiDebug == "Checked")
{
MessageBox.Show("frmMain.cs - systemCheck() " + exc.ToString());
}
}
// Either Launch or Close the Application
if (launch == true)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
else
{
Application.Exit();
}
}
}
class MemoryCheck
{
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 static uint CheckMemeory()
{
// Call the native GlobalMemoryStatus method
// with the defined structure.
MEMORYSTATUS memStatus = new MEMORYSTATUS();
GlobalMemoryStatus(ref memStatus);
uint MemoryInfo = memStatus.dwTotalPhys;
return MemoryInfo;
}
}
}
|