-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
95 lines (74 loc) · 2.87 KB
/
Program.cs
File metadata and controls
95 lines (74 loc) · 2.87 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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aldos.Global;
namespace Aldos
{
class Program
{
static DateTime start = DateTime.Now;
static void Main(string[] args)
{
Console.Title = "Aldos rev.2 by Blackrush - emulator for Dofus " + Network.Messages.Version.ToString() + ".";
Console.WindowWidth += 7;
Realm.Server.Instance.Start();
Game.Server.Instance.Start();
Utils.DatabaseManager.Instance.Init();
Utils.MyConsole.WriteLine
(
Global.Account.Load() + " accounts loaded.",
ConsoleType.Info, ConsoleWriter.Unknown
);
Utils.MyConsole.WriteLine
(
Global.Character.Load() + " characters loaded.",
ConsoleType.Info, ConsoleWriter.Unknown
);
Utils.MyConsole.WriteLine
(
"Loading time : " + (DateTime.Now - start).TotalMilliseconds + "ms.",
ConsoleType.Info, ConsoleWriter.Unknown
);
Utils.MyConsole.WriteLine
(
"CTRL + C or \"exit\" command to exit.",
ConsoleType.Info, ConsoleWriter.Unknown
);
Console.CancelKeyPress += delegate { Exit(); };
while (Parse(Console.ReadLine())) ;
Exit();
Console.ReadLine();
}
public static void Exit()
{
Realm.Server.Instance.Stop();
Game.Server.Instance.Stop();
Character.SaveAll();
Account.SaveAll();
Utils.DatabaseManager.Instance.Close();
}
static bool Parse(string command)
{
switch (command)
{
case "database_info":
break;
case "exit":
return false;
case "process_queue":
DateTime started = DateTime.Now;
Console.WriteLine(" : " + Utils.DatabaseManager.Instance.ProcessQueue() + " commands executed in " +
(DateTime.Now - started).TotalMilliseconds + " ms.");
break;
case "save_characters":
Console.WriteLine(" : " + Global.Character.SaveAll() + " characters were saved."); break;
case "save_accounts":
Console.WriteLine(" : " + Global.Account.SaveAll() + " accounts were saved."); break;
default:
Console.WriteLine(" : invalid command."); break;
}
return true;
}
}
}