-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (38 loc) · 1.05 KB
/
Program.cs
File metadata and controls
42 lines (38 loc) · 1.05 KB
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
using System;
using System.IO;
namespace Game3
{
public static class Program
{
private static string logFile = "game_log.txt";
public static void Log(string message)
{
try
{
string timestamp = DateTime.Now.ToString("HH:mm:ss.fff");
File.AppendAllText(logFile, $"[{timestamp}] {message}\n");
}
catch { }
}
[STAThread]
static void Main()
{
// Clear log file on start
try { File.WriteAllText(logFile, $"=== Game started at {DateTime.Now} ===\n"); } catch { }
try
{
Log("Creating Game1...");
using var game = new Game1();
Log("Game1 created, calling Run()...");
game.Run();
Log("Game ended normally.");
}
catch (Exception ex)
{
Log("=== CRASH ===");
Log(ex.ToString());
Log("=============");
}
}
}
}