-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviolet.d
39 lines (31 loc) · 897 Bytes
/
violet.d
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
import std.stdio : writeln, write, readln;
import database.database : Database;
import misc.stringTools : chomp;
import network.server : startServer;
import std.file : exists;
import misc.out2 : prettyStr;
string versionStr = "0.0.1 (Working Hard)";
string serviceName = "Violet";
void main()
{
//Display welcome message
welcome();
write("Before we can start, enter the database file to use: ");
string filename = chomp(readln());
if (exists(filename))
{
ushort port = 25515; //use std.conv to ask user for this
Database db = new Database(filename);
db.addKey("nasme","string"); //testing code
writeln(prettyStr(serviceName,"Starting server component..."));
startServer(db, port, "0.0.0.0");
}
else
{
writeln(prettyStr(serviceName,"File '" ~ filename ~ "' not found."));
}
}
void welcome()
{
writeln(prettyStr(serviceName,"Welcome to VioletDB v"~versionStr~"!"));
}