-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.cpp
More file actions
50 lines (44 loc) · 1.63 KB
/
Server.cpp
File metadata and controls
50 lines (44 loc) · 1.63 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
#include <bits/stdc++.h>
int main(int argc, char* argv[]) {
// ERROR HANDALING
if (argc < 2) {
printf("ERROR: No Arguments provided\n");
return 0;
}
if (std::string(argv[1]) == "-NoDelay") {
printf("ERROR: Incorrect usage\nCorrect Usage:\nServer <OS> < -NoDelay (optional)>");
return 0;
}
// WIN SCENARIO
if (std::string(argv[1]) == "Windows" || std::string(argv[1]) == "Win") {
if (argc >= 3 && std::string(argv[2]) == "-NoDelay") {
int result = system("powershell -ExecutionPolicy Bypass ./src/WinServerPerformanceNoDelay.ps1");
if (result != 0) {
printf("ERROR: Failed to execute script.\n");
}
return 0;
}
int result = system("powershell -ExecutionPolicy Bypass ./src/WinServerPerformance.ps1");
if (result != 0) {
printf("ERROR: Failed to execute script.\n");
}
return 0;
}
// LINUX SCENARIO
if (std::string(argv[1]) == "Linux" || std::string(argv[1]) == "Lin") {
if (argc >= 3 && std::string(argv[2]) == "-NoDelay") {
int result = system("./src/LinuxServerPerformanceNoDelay.sh");
if (result != 0) {
printf("ERROR: Failed to execute script.\n");
}
return 0;
}
int result = system("./src/LinuxServerPerformance.sh");
if (result != 0) {
printf("ERROR: Failed to execute script.\n");
}
return 0;
}
printf("ERROR: Invalid OS provided.\nCorrect Usage:\nServer <Windows/Unix> < -NoDelay (optional)>\n");
return 0;
}