12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #ifndef __SVN_PROC__
- #define __SVN_PROC__
- #pragma once
- enum SVNTYPE {
- SVN_EXPORT, // 导出;
- SVN_CHECKOUT, // 检出;
- SVN_ROLLBACK // 回退(up to);
- };
- enum SVNPATH {
- PATH_RES, // 资源路径;
- PATH_SCRIPT, // 脚本路径;
- PATH_TESTER // tester路径;
- };
- typedef struct SVNINFO {
- SVNPATH path;
- std::string strVersion;
- std::string strSVNAddress;
- bool bUpdate;
- std::string strSavePath;
- }SVNInfo, *pSVNInfo;
- class CSVNProc:public CObject
- {
- public:
- CSVNProc(void);
- ~CSVNProc(void);
- CSVNProc& operator=(CSVNProc& obj);
- protected:
- DECLARE_SERIAL(CSVNProc);
- void Serialize(CArchive& ar);
- void SVNProcess(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion, SVNTYPE type);
- public:
- // 导出指定版本号的svn路径;
- void Export(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion);
- // 检出指定版本号的svn路径;
- void Checkout(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion);
- // 回退指定版本号的svn路径;
- void Rollback(std::string strSVNAddress, std::string strSavePath, DWORD dwSVNVersion);
- // 检测版本:有新版本返回TRUE;
- BOOL CheckNewVersion(
- std::string url = "http://192.168.1.103:8580/btc_execute_se/ajaxInteractiveManage!getSvnVersion.action",
- std::string strContent = "");
- public:
- SVNPATH m_svnpath;
- // 是否需要更新;
- BOOL m_bNeedUpdate;
- // SVN地址;
- CString m_strSVNAddress;
- // SVN保存目录:
- CString m_strSVNSavePath;
- // SVN版本号;
- DWORD m_dwSVNVersion;
- };
- typedef CTypedPtrArray<CObArray, CSVNProc*> CSVNArray;
- class CSVNMgr
- {
- CSVNMgr() {};
- CSVNArray m_arySVN;
- public:
- static CSVNMgr* GetInstance()
- {
- static CSVNMgr* pInstance = NULL;
- if (pInstance == NULL) {
- pInstance = new CSVNMgr();
- }
- return pInstance;
- }
- ~CSVNMgr() {};
- private:
- BOOL ParseJson(std::string json);
- BOOL HttpRequest(std::string url, std::string strContent, std::string& data);
- CSVNProc *IsSVNExist(std::string strSVNAddress);
- void UpdatedSVN(CSVNProc *pSVN, DWORD dwVersion);
- BOOL HasNewVersion();
- public:
- void Load(LPCTSTR lpFileName =_T("svn.data"));
- void Store(LPCTSTR lpFileName = _T("svn.data"));
- // 检测版本:有新版本返回TRUE;
- BOOL CheckNewVersion(std::string url, std::string strContent);
- void Update();
- };
- #endif // __SVN_PROC__
|