-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConfig.cpp
More file actions
35 lines (32 loc) · 1.09 KB
/
Config.cpp
File metadata and controls
35 lines (32 loc) · 1.09 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
#include <stdio.h>
#include <unistd.h>
#include <fstream>
#include <string>
#include "CmdProcessor.h"
#include "Config.h"
void readConfig() {
char wd[256];
getcwd(wd, 255);
printf("Sv: Config: reading build banlist file from %s/s2hooker/buildbanlist.txt\r\n", wd);
int accountID;
std::string nickname;
std::ifstream infile;
infile.open("/tmp/s2hooker/adminlist.txt", std::ifstream::in);
while(infile >> accountID >> nickname) {
CmdProcessor::adminSet.insert(std::pair<unsigned int, unsigned int>(accountID, accountID));
}
infile.close();
infile.open("/tmp/s2hooker/buildbanlist.txt", std::ifstream::in);
while(infile >> accountID >> nickname) {
CmdProcessor::disableBuildAccountIdSet.insert(std::pair<unsigned int, std::string>(accountID, nickname));
}
infile.close();
}
void updateConfig() {
std::ofstream outfile("/tmp/s2hooker/buildbanlist.txt");
std::map<unsigned int, std::string>::iterator it = CmdProcessor::disableBuildAccountIdSet.begin();
for(; it != CmdProcessor::disableBuildAccountIdSet.end(); ++it) {
outfile << it->first << " " << it->second << "\n";
}
outfile.close();
}