Repository navigation
Expand file tree
/
Copy pathJsonConfigHelp.h
More file actions
103 lines (92 loc) · 1.75 KB
/
Copy pathJsonConfigHelp.h
File metadata and controls
103 lines (92 loc) · 1.75 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
96
97
98
99
100
101
102
#pragma once
#include "CommonStruct.h"
class CMainCfg
{
public:
CMainCfg()
{
bStartServer = false;
IntIsChinese = -1;
}
bool bStartServer;
int IntIsChinese;
string strServerCfgName;
};
class CDarkTxCfg
{
public:
string strBinPath;
string strBuyID;
string strSellID;
int nMoney;
int nHeight;
int nFee;
};
class CAnonmyCfg
{
public:
string strBinPath;
string strSendID;
string strRecvID1;
string strRecvID2;
int nMoney;
int nHeight;
int nFee;
};
class CSesureTradeCfg
{
public:
string strBinPath;
string strAddr;
string strBuyerID;
string strSellerID;
string strArID;
int nTxFee;
int nHeight;
int nDeposite;
int nPay;
int nMaxFine;
int nFine;
int nArFee;
};
class CP2PBetCfg
{
private:
static const int DATA_SIZE = 5;
public:
int nFee;
int nMoney;
int nHeight;
string strBinPath;
string strHashA;
string strHashB;
string strSendID;
string strAcceptID;
unsigned char szDataA[DATA_SIZE];
unsigned char szDataB[DATA_SIZE];
};
class CJsonConfigHelp
{
DEFINE_SINGLETON(CJsonConfigHelp)
public:
void Init();
void ReadJsonConfig(const string& strFilePath);
void GetMainCfgData(CMainCfg& mainCfg);
void GetDarkCfgData(CDarkTxCfg& darkCfg);
void GetAnonymCfgData(CAnonmyCfg& anonymCfg);
void GetSesureTradeCfgData(CSesureTradeCfg& sesureCfg);
void GetP2PBetCfgData(CP2PBetCfg& p2pCfg);
private:
void ReadMainCfgData(const Json::Value& root);
void ReadSesureTradeCfgData(const Json::Value& root);
void ReadDarkCoinCfgData(const Json::Value& root);
void ReadP2PCfgData(const Json::Value& root);
void ReadAnonymCfgData(const Json::Value& root);
private:
BOOL m_bInvalid;
CMainCfg m_MainCfg;
CDarkTxCfg m_DarkCfg;
CAnonmyCfg m_AnonymCfg;
CP2PBetCfg m_P2PBetCfg;
CSesureTradeCfg m_SesureTradeCfg;
};