Commit cf34f91180380d95132b4043dff3e3c08389f302

Authored by liuye
1 parent 8745d8d4

bugfix<central-clearing-system&card-client&auto-updata>调整自动升级模块

1、支持客户端程序中文命名;
2、增加读取本地配置文件失败后异常处理;
3、统一升级模块为autoupdata;
central_clearing_system/ETradeClient/mfc_ui/LoginDialog.cpp
... ... @@ -149,7 +149,7 @@ void CLoginDialog::DoDataExchange(CDataExchange* pDX)
149 149 BOOL CLoginDialog::OnInitDialog()
150 150 {
151 151 //Æô¶¯×Ô¶¯Éý¼¶³ÌÐò add by liuye
152   - ShellExecute(NULL, L"open", L".\\CardAutoUpdate.exe", NULL, NULL, SW_SHOW);
  152 + ShellExecute(NULL, L"open", L".\\AutoUpdate.exe", NULL, NULL, SW_SHOW);
153 153 //
154 154  
155 155 ModifyStyleEx(0, WS_EX_APPWINDOW); // This enables minimizing the dialog into taskbar instead of bottom left corner.
... ...
central_clearing_system/out/Win32/综合业务管理系统.zip deleted 100644 → 0
No preview for this file type
client_auto_updata/AutoUpdate/AUDataManage.cpp
... ... @@ -5,6 +5,7 @@
5 5 #include "tinyxml.h"
6 6 #include ".\zlib\zip.h"
7 7 #include ".\zlib\unzip.h"
  8 +#include "CNTranslate.h"
8 9  
9 10 CAUDataManage* CAUDataManage::m_pInstance = NULL;
10 11  
... ... @@ -12,7 +13,7 @@ void Log(CString sLog)
12 13 {
13 14 CStdioFile fileLog;
14 15 CString sPath;
15   - TCHAR szPath[MAX_PATH];
  16 + TCHAR szPath[MAX_PATH] = {0};
16 17 GetModuleFileName(NULL, szPath, MAX_PATH);
17 18 CString sMudolePath = szPath;
18 19 CString sMudoleName = AfxGetAppName();
... ... @@ -75,9 +76,6 @@ BOOL CAUDataManage::CheckVersion()
75 76 pFtpConnection = pInternetSession->GetFtpConnection(m_stuConfigData.sServerIP, m_stuConfigData.sUserName, m_stuConfigData.sPassWord);
76 77 CString sFilePath;
77 78 pFtpConnection->GetCurrentDirectory(sFilePath);
78   - //add for test by liuye 2017.7.17
79   - Log("for test 获取到的路径是: " + sFilePath);
80   - //
81 79 sFilePath += m_stuConfigData.sUpdateDir + "/" + m_sConfigFileName;
82 80 CString sTempConfigPath = m_stuConfigData.sTempDir + "\\" + m_sConfigFileName;
83 81 if (pFtpConnection)
... ... @@ -155,10 +153,13 @@ void CAUDataManage::Update()
155 153 PostMessage(hMainWnd, WM_UPDATEPROCESS, 0, PROCESS_COMPLETE);
156 154 }
157 155  
158   -BOOL CAUDataManage::KillCilent(CString sClientName)
  156 +BOOL CAUDataManage::KillCilent(CString sName)
159 157 {
160 158 BOOL bResult = FALSE;
161 159 Log("关闭进程。");
  160 +
  161 + CString sClientName = W(sName);
  162 +
162 163 PROCESSENTRY32 stuClient;
163 164 HANDLE hAllProcess = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
164 165 if (hAllProcess != INVALID_HANDLE_VALUE)
... ... @@ -201,7 +202,8 @@ BOOL CAUDataManage::KillCilent(CString sClientName)
201 202  
202 203 void CAUDataManage::RestartClient()
203 204 {
204   - ShellExecute(NULL, "open", m_stuConfigData.sAppDir + CString("\\") + m_stuConfigData.sAppName, NULL, m_stuConfigData.sAppDir, SW_SHOW);
  205 + CString sRealAppName = W(m_stuConfigData.sAppName);
  206 + ShellExecute(NULL, "open", m_stuConfigData.sAppDir + CString("\\") + sRealAppName, NULL, m_stuConfigData.sAppDir, SW_SHOW);
205 207 }
206 208  
207 209 BOOL CAUDataManage::DownloadClientFile()
... ... @@ -328,7 +330,7 @@ CString CAUDataManage::GetModulePath()
328 330 {
329 331 CString sPath;
330 332  
331   - TCHAR szPath[MAX_PATH];
  333 + TCHAR szPath[MAX_PATH] = {0};
332 334 GetModuleFileName(NULL, szPath, MAX_PATH);
333 335 CString sMudolePath = szPath;
334 336 CString sMudoleName = AfxGetAppName();
... ...
client_auto_updata/AutoUpdate/AUDataManage.h
... ... @@ -42,22 +42,6 @@ typedef struct STU_CONFIG
42 42  
43 43 extern void Log(CString sLog);
44 44  
45   -
46   -//class Lock
47   -//{
48   -//private:
49   -// CCriticalSection m_cs;
50   -//public:
51   -// Lock(CCriticalSection cs) : m_cs(cs)
52   -// {
53   -// m_cs.Lock();
54   -// }
55   -// ~Lock()
56   -// {
57   -// m_cs.Unlock();
58   -// }
59   -//};
60   -
61 45 class CAUDataManage
62 46 {
63 47 public:
... ... @@ -75,7 +59,7 @@ private:
75 59 CAUDataManage(const CAUDataManage &);
76 60 CAUDataManage& operator = (const CAUDataManage &);
77 61  
78   - BOOL KillCilent(CString sClientName);
  62 + BOOL KillCilent(CString sName);
79 63 BOOL DownloadClientFile();
80 64 void CreateTempFolder();
81 65 void DeleteDirectory(CString sDirectory);
... ... @@ -89,9 +73,11 @@ private:
89 73 static CAUDataManage *m_pInstance;
90 74 static CCriticalSection m_csLocker;
91 75  
92   - APPConfig m_stuConfigData;
93 76 CString m_sConfigFilePath;
94 77 CString m_sConfigFileName;
95 78 BOOL Unzip(CString sSrcDir, CString sDstDir);
  79 +
  80 +public:
  81 + APPConfig m_stuConfigData;
96 82 };
97 83  
... ...
client_auto_updata/AutoUpdate/AutoUpdate.cpp
... ... @@ -102,21 +102,28 @@ BOOL CAUAutoUpdateApp::InitInstance()
102 102 CAUAutoUpdateDlg dlgUpdate;
103 103 m_pMainWnd = &dlgUpdate;
104 104  
105   - INT_PTR nResponse = dlgUpdate.DoModal();
106   - if (nResponse == IDOK)
  105 + if (!dlgUpdate.m_pDataManage->m_stuConfigData.sAppName.IsEmpty())
107 106 {
108   - // TODO: 在此放置处理何时用
109   - // “确定”来关闭对话框的代码
  107 + INT_PTR nResponse = dlgUpdate.DoModal();
  108 + if (nResponse == IDOK)
  109 + {
  110 + // TODO: 在此放置处理何时用
  111 + // “确定”来关闭对话框的代码
  112 + }
  113 + else if (nResponse == IDCANCEL)
  114 + {
  115 + // TODO: 在此放置处理何时用
  116 + // “取消”来关闭对话框的代码
  117 + }
  118 + else if (nResponse == -1)
  119 + {
  120 + TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
  121 + TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
  122 + }
110 123 }
111   - else if (nResponse == IDCANCEL)
112   - {
113   - // TODO: 在此放置处理何时用
114   - // “取消”来关闭对话框的代码
115   - }
116   - else if (nResponse == -1)
  124 + else
117 125 {
118   - TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
119   - TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
  126 + AfxMessageBox("读取本地配置文件失败!");
120 127 }
121 128  
122 129 CAUDataManage::Instantialize()->DestoryInstance();
... ...
client_auto_updata/AutoUpdate/AutoUpdate.vcxproj
... ... @@ -113,6 +113,7 @@
113 113 <ClInclude Include="AUDataManage.h" />
114 114 <ClInclude Include="AutoUpdate.h" />
115 115 <ClInclude Include="AutoUpdateDlg.h" />
  116 + <ClInclude Include="CNTranslate.h" />
116 117 <ClInclude Include="Resource.h" />
117 118 <ClInclude Include="stdafx.h" />
118 119 <ClInclude Include="targetver.h" />
... ...
client_auto_updata/AutoUpdate/AutoUpdate.vcxproj.filters
... ... @@ -48,6 +48,9 @@
48 48 <ClInclude Include="zlib\zip.h">
49 49 <Filter>头文件</Filter>
50 50 </ClInclude>
  51 + <ClInclude Include="CNTranslate.h">
  52 + <Filter>头文件</Filter>
  53 + </ClInclude>
51 54 </ItemGroup>
52 55 <ItemGroup>
53 56 <ClCompile Include="AutoUpdate.cpp">
... ...
client_auto_updata/AutoUpdate/AutoUpdateDlg.h
... ... @@ -32,9 +32,10 @@ protected:
32 32 afx_msg HCURSOR OnQueryDragIcon();
33 33 DECLARE_MESSAGE_MAP()
34 34  
35   -private:
36   - //CAUDataManage m_cDataManage;
  35 +public:
37 36 CAUDataManage* m_pDataManage;
  37 +
  38 +private:
38 39 CEdit m_editNotice;
39 40 CProgressCtrl m_progressUpdate;
40 41  
... ...
client_auto_updata/AutoUpdate/CNTranslate.h 0 → 100644
  1 +#include <Windows.h>
  2 +
  3 +#define U (CUtf8String)
  4 +#define W (CGb2312String)
  5 +
  6 +class CUtf8String
  7 +{
  8 +public:
  9 + inline CUtf8String(const char* gb2312)
  10 + {
  11 + m_bIsConst = true;
  12 +#ifdef TEST_TYPE_MAP
  13 + if (m[gb2312])
  14 + {
  15 + m_utf8 = m[gb2312];
  16 + return;
  17 + }
  18 +#endif
  19 + int buffLen = 0;
  20 + WCHAR wbuff[5120];
  21 + MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wbuff, 5120);
  22 + buffLen = WideCharToMultiByte(CP_UTF8, 0, wbuff, -1, NULL, 0, 0, 0);
  23 + m_utf8 = new char[buffLen + 1];
  24 + WideCharToMultiByte(CP_UTF8, 0, wbuff, -1, (LPSTR)m_utf8, buffLen, 0, 0);
  25 +#ifdef TEST_TYPE_MAP
  26 + m[gb2312] = m_utf8;
  27 +#endif
  28 + }
  29 +
  30 + inline CUtf8String(char* gb2312)
  31 + {
  32 + m_bIsConst = false;
  33 + int buffLen = 0;
  34 + WCHAR wbuff[5120];
  35 + MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wbuff, 5120);
  36 + buffLen = WideCharToMultiByte(CP_UTF8, 0, wbuff, -1, NULL, 0, 0, 0);
  37 + m_utf8 = new char[buffLen + 1];
  38 + WideCharToMultiByte(CP_UTF8, 0, wbuff, -1, (LPSTR)m_utf8, buffLen, 0, 0);
  39 + }
  40 +
  41 + inline ~CUtf8String()
  42 + {
  43 +#ifndef TEST_TYPE_MAP
  44 + if (m_utf8)
  45 + {
  46 + delete m_utf8;
  47 + m_utf8 = 0;
  48 + }
  49 +#else
  50 + if (!m_bIsConst)
  51 + {
  52 + if (m_utf8)
  53 + {
  54 + delete m_utf8;
  55 + m_utf8 = 0;
  56 + }
  57 + }
  58 +#endif
  59 + }
  60 +
  61 + inline operator char*()
  62 + {
  63 + return (char*)m_utf8;
  64 + }
  65 +private:
  66 + const char* m_utf8;
  67 + bool m_bIsConst;
  68 +#ifdef TEST_TYPE_MAP
  69 + static strmap m;
  70 +#endif
  71 +};
  72 +
  73 +class CGb2312String
  74 +{
  75 +public:
  76 + inline CGb2312String(const char* utf8)
  77 + {
  78 +#ifdef TEST_TYPE_MAP
  79 + if (m[utf8])
  80 + {
  81 + m_gb2312 = 0;
  82 + m_gb2312 = m[utf8];
  83 + }
  84 +#endif
  85 + int buffLen = 0;
  86 + WCHAR wbuff[5120];
  87 + MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wbuff, 5120);
  88 + buffLen = WideCharToMultiByte(CP_ACP, 0, wbuff, -1, NULL, 0, 0, 0);
  89 + m_gb2312 = new char[buffLen + 1];
  90 + WideCharToMultiByte(CP_ACP, 0, wbuff, -1, (LPSTR)m_gb2312, buffLen, 0, 0);
  91 +#ifdef TEST_TYPE_MAP
  92 + m[utf8] = m_gb2312;
  93 +#endif
  94 + }
  95 +
  96 + inline CGb2312String(char* utf8)
  97 + {
  98 +#ifdef TEST_TYPE_MAP
  99 + if (m[utf8])
  100 + {
  101 + m_gb2312 = 0;
  102 + m_gb2312 = m[utf8];
  103 + }
  104 +#endif
  105 + int buffLen = 0;
  106 + WCHAR wbuff[5120];
  107 + MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wbuff, 5120);
  108 + buffLen = WideCharToMultiByte(CP_ACP, 0, wbuff, -1, NULL, 0, 0, 0);
  109 + m_gb2312 = new char[buffLen + 1];
  110 + WideCharToMultiByte(CP_ACP, 0, wbuff, -1, (LPSTR)m_gb2312, buffLen, 0, 0);
  111 +#ifdef TEST_TYPE_MAP
  112 + m[utf8] = m_gb2312;
  113 +#endif
  114 + }
  115 +
  116 + inline ~CGb2312String()
  117 + {
  118 +#ifndef TEST_TYPE_MAP
  119 + if (m_gb2312)
  120 + {
  121 + delete m_gb2312;
  122 + m_gb2312 = 0;
  123 + }
  124 +#endif
  125 + }
  126 +
  127 + inline operator char*()
  128 + {
  129 + return (char*)m_gb2312;
  130 + }
  131 +private:
  132 + const char* m_gb2312;
  133 +#ifdef TEST_TYPE_MAP
  134 + static strmap m;
  135 +#endif
  136 +};
... ...
doc/各市场版本/市场升级ftp账户IP-.xlsx
No preview for this file type
etrade_card_client/ETradeClient/mfc_ui/LoginDialog.cpp
... ... @@ -147,7 +147,7 @@ void CLoginDialog::DoDataExchange(CDataExchange* pDX)
147 147 BOOL CLoginDialog::OnInitDialog()
148 148 {
149 149 //Æô¶¯×Ô¶¯Éý¼¶³ÌÐò add by liuye
150   - ShellExecute(NULL, L"open", L".\\CardAutoUpdate.exe", NULL, NULL, SW_SHOW);
  150 + ShellExecute(NULL, L"open", L".\\AutoUpdate.exe", NULL, NULL, SW_SHOW);
151 151 //
152 152  
153 153 ModifyStyleEx(0, WS_EX_APPWINDOW); // This enables minimizing the dialog into taskbar instead of bottom left corner.
... ...