AUDataManage.h
1.99 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
#pragma once
#include "afxinet.h"
#define WM_UPDATEPROCESS WM_USER + 1
#define WM_CRASH_CLOSE WM_USER + 2
#define PROCESS_KILLCLIENT 1
#define PROCESS_DOWNLOADFILE 2
#define PROCESS_DELETEOLDFILE 3
#define PROCESS_UNZIP 4
#define PROCESS_COMPLETE 5
typedef struct STU_CONFIG
{
CString sAppName;
CString sSelfName;
CString sVersion;
CString sAppDir;
CString sUpdateDir;
CString sTempDir;
CString sZipName;
CString sServerIP;
CString sUserName;
CString sPassWord;
STU_CONFIG operator= (STU_CONFIG& stuConfig)
{
sAppName = stuConfig.sAppName;
sSelfName = stuConfig.sSelfName;
sVersion = stuConfig.sVersion;
sAppDir = stuConfig.sAppDir;
sUpdateDir = stuConfig.sUpdateDir;
sTempDir = stuConfig.sTempDir;
sZipName = stuConfig.sZipName;
sServerIP = stuConfig.sServerIP;
sUserName = stuConfig.sUserName;
sPassWord = stuConfig.sPassWord;
return *this;
}
}APPConfig;
extern void Log(CString sLog);
//class Lock
//{
//private:
// CCriticalSection m_cs;
//public:
// Lock(CCriticalSection cs) : m_cs(cs)
// {
// m_cs.Lock();
// }
// ~Lock()
// {
// m_cs.Unlock();
// }
//};
class CAUDataManage
{
public:
static CAUDataManage *Instantialize();
static void DestoryInstance();
~CAUDataManage();
public:
BOOL CheckVersion();
void Update();
void RestartClient();
private:
CAUDataManage();
CAUDataManage(const CAUDataManage &);
CAUDataManage& operator = (const CAUDataManage &);
BOOL KillCilent(CString sClientName);
BOOL DownloadClientFile();
void CreateTempFolder();
void DeleteDirectory(CString sDirectory);
CString GetModulePath();
void ReplaceClientFile(CString sAppDir);
APPConfig ReadConfig(CString sConfigName);
void CopyClientFile(CString sSrcFile, CString sDstFile);
void DownloadFile(CString sSrcFile, CString sDstFile, CFtpConnection *pFtpConnection);
private:
static CAUDataManage *m_pInstance;
static CCriticalSection m_csLocker;
APPConfig m_stuConfigData;
CString m_sConfigFilePath;
CString m_sConfigFileName;
BOOL Unzip(CString sSrcDir, CString sDstDir);
};