/
Program.cs
87 lines (79 loc) · 2.26 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using DUIP.Memory;
using DUIP.Net;
using DUIP.UI;
namespace DUIP
{
/// <summary>
/// Contains functions and information related to the program.
/// </summary>
public static class Program
{
/// <summary>
/// Program release version number.
/// </summary>
public const int Version = 1;
/// <summary>
/// Gets the icon for the program.
/// </summary>
public static Icon Icon
{
get
{
Assembly cur = Assembly.GetExecutingAssembly();
try
{
return Icon.ExtractAssociatedIcon(cur.Location);
}
catch
{
return null;
}
}
}
/// <summary>
/// The location of the cache for the program. This folder may store static procedurally created data between
/// program runs. This folder may not exist on the first program run.
/// </summary>
public static Path Cache
{
get
{
return _Cache;
}
}
private static Path _Cache;
/// <summary>
/// Program main entry point.
/// </summary>
[STAThread]
public static void Main(string[] Args)
{
Path work = Path.WorkingDirectory;
_Cache = work["Cache"];
Path data = work["Data"];
DirectoryAllocator alloc = new DirectoryAllocator(data);
Application.EnableVisualStyles();
MainForm mf = new MainForm();
mf.Icon = Icon;
mf.Text = "DUIP";
mf.Show();
DateTime lastupdate = DateTime.Now;
while (mf.Visible)
{
WorldDisplay view = mf.WorldDisplay;
view.Render();
DateTime now = DateTime.Now;
double updatetime = (now - lastupdate).TotalSeconds;
lastupdate = now;
view.Update(updatetime);
Application.DoEvents();
}
}
}
}