@@ -9,6 +9,7 @@ using namespace AlibabaCloud::OSS;
99#include < string>
1010#include < Windows.h>
1111#include " ..\..\..\..\cppx\cppx\include\funclib.h"
12+ #include " ..\..\..\..\cppx\cppx\include\KMD5.h"
1213
1314#undef GetObject
1415#undef CreateDirectory
@@ -35,27 +36,27 @@ std::string& replace_str(std::string& str, const std::string& to_replaced, const
3536// int main(int argc, char** argv)
3637int main (int argc, char ** argv)
3738{
38- std::string signid ;
39+ std::string buildid ;
3940 bool input = false ;
4041 std::regex regexStr (" ^[0-9]{8}\\ .[0-9]+$" );
4142 std::smatch matchResult;
4243 for (int i = 1 ; i < argc; i++) {
4344 std::string inputData = argv[i];
4445 if (std::regex_match (inputData, matchResult, regexStr)) {
4546 for (auto ele : matchResult) {
46- signid = ele;
47+ buildid = ele;
4748 input = false ;
4849 }
4950 }
5051 }
51- while (signid .empty ()) {
52- std::cout << " 请输入构建 ID(形如“20230926.7 ”的字符串):" << std::endl;
52+ while (buildid .empty ()) {
53+ std::cout << " 请输入构建 ID(形如“20230927.33 ”的字符串):" << std::endl;
5354 std::string inputData;
5455 std::getline (std::cin, inputData);
5556
5657 if (std::regex_match (inputData, matchResult, regexStr)) {
5758 for (auto ele : matchResult) {
58- signid = ele;
59+ buildid = ele;
5960 input = true ;
6061 }
6162 }
@@ -88,7 +89,7 @@ int main(int argc, char** argv)
8889 }
8990 }
9091
91- std::string targetdir = " install/" + signid + " /" ;
92+ std::string targetdir = " install/" + buildid + " /" ;
9293 if (true ) {
9394 ListObjectsV2Request request (INFOSS_BUCKET);
9495 request.setMaxKeys (1000 ); // 一次拉完。
@@ -99,7 +100,6 @@ int main(int argc, char** argv)
99100 auto count = result.KeyCount ();
100101 auto objs = result.ObjectSummarys ();
101102 for (auto obj : objs) {
102- printf (" 下载文件 %s\r\n " , obj.Key ().c_str ());
103103
104104 std::string fdir = obj.Key ();
105105 int index = -1 ;
@@ -109,6 +109,17 @@ int main(int argc, char** argv)
109109 auto temp = AlibabaCloud::OSS::CreateDirectory (fdir);
110110 assert (temp);
111111 }
112+ if (PathFileExistsA (obj.Key ().c_str ())) {
113+ KMD5 kmd5;
114+ std::wstring md5 = kmd5.GetMD5Str (A2W_ANSI (obj.Key ().c_str ()).c_str ());
115+ std::transform (md5.begin (), md5.end (), md5.begin (), ::toupper); // 将小写的都转换成大写
116+ if (md5 == A2W_ANSI (obj.ETag ().c_str ())) {
117+ printf (" 校验通过 %s\r\n " , obj.Key ().c_str ());
118+ continue ;
119+ }
120+ }
121+
122+ printf (" 下载文件 %s\r\n " , obj.Key ().c_str ());
112123 auto status = client.GetObject (INFOSS_BUCKET, obj.Key (), obj.Key ());
113124 assert (status.isSuccess ());
114125 }
@@ -121,7 +132,7 @@ int main(int argc, char** argv)
121132 printf (" ok(按回车结束)" );
122133 getchar ();
123134
124- std::wstring target = L" /select, install\\ " + A2W_ANSI (signid .c_str ()) + L" \\ " ;
135+ std::wstring target = L" /select, install\\ " + A2W_ANSI (buildid .c_str ()) + L" \\ " ;
125136
126137 SHELLEXECUTEINFO shex = { 0 };
127138 shex.cbSize = sizeof (SHELLEXECUTEINFO);
0 commit comments