admin
2025-07-17 6cd92a169cbc0db35042f243a09d976fd3e1445c
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
#pragma once
#include<string>
#include <libconfig.h++>
#include<map>
#include<list>
using namespace std;
 
 
struct ServerInfo {
    string ip;
    int port;
    string userName;
    string pwd;
};
 
struct ProjectBuildInfo {
    string name;
    string dir;
    string scriptFile;
    string outputDir;
    string outputFile;
    ServerInfo targetServer;
    string targetDir;
    string targetAppFile;
    string targetAppRestartFile;
};
 
 
using namespace std;
class ConfigUtil
{
private:
 
    static string getConfigPath();
 
    static void readConfig(libconfig::Config& config);
    static void writeConfig(libconfig::Config& config);
    
    
 
 
public:
    static int readIntConfig(const char* key);
    static string readStringConfig(const char* key);
    static void setIntConfig(const char* key, int val);
    static void setStringConfig(const char* key, string val);
 
    static list<string> getKeys();
    static void delKey(string key);
 
    // ÉèÖù¹½¨·þÎñÆ÷
    static void setBuildServer(ServerInfo* server);
    // »ñÈ¡¹¹½¨·þÎñÆ÷
    static ServerInfo* getBuildServer();
 
    // ÉèÖù¹½¨·þÎñÆ÷
    static void setProjectBuildInfo(ProjectBuildInfo* server, int index);
    // »ñÈ¡¹¹½¨·þÎñÆ÷
    static ProjectBuildInfo* getProjectBuildInfo(int index);
    // ±£´æ±¾µØ»º´æÄ¿Â¼
    static void setLocalCacheDir(string dir);
    // »ñÈ¡±¾µØ»º´æÄ¿Â¼
    static string getLocalCacheDir();
 
 
    
 
 
};