@@ -850,116 +850,6 @@ VersionData::TLoadResult VersionData::Load(bool official)
850
850
}
851
851
}
852
852
853
- VersionData::TLoadResult VersionData::LoadNightly ()
854
- {
855
- Clear ();
856
-
857
- auto buf = DownloadUrl (L" https://ci.appveyor.com/api/projects/passionate-coder/open-shell-menu/branch/master" );
858
- if (buf.empty ())
859
- return LOAD_ERROR;
860
-
861
- try
862
- {
863
- auto data = json::parse (buf.begin (), buf.end ());
864
- auto build = data[" build" ];
865
-
866
- // get version
867
- auto version = build[" version" ].get <std::string>();
868
- if (version.empty ())
869
- return LOAD_BAD_FILE;
870
-
871
- {
872
- int v1, v2, v3;
873
- if (sscanf_s (version.c_str (), " %d.%d.%d" , &v1, &v2, &v3) != 3 )
874
- return LOAD_BAD_FILE;
875
-
876
- newVersion = (v1 << 24 ) | (v2 << 16 ) | v3;
877
-
878
- if (newVersion <= GetVersionEx (g_Instance))
879
- return LOAD_OK;
880
- }
881
-
882
- // artifact url
883
- {
884
- auto jobId = build[" jobs" ][0 ][" jobId" ].get <std::string>();
885
- if (jobId.empty ())
886
- return LOAD_BAD_FILE;
887
-
888
- std::wstring jobUrl (L" https://ci.appveyor.com/api/buildjobs/" );
889
- jobUrl += std::wstring (jobId.begin (), jobId.end ());
890
- jobUrl += L" /artifacts" ;
891
-
892
- buf = DownloadUrl (jobUrl.c_str ());
893
- if (buf.empty ())
894
- return LOAD_ERROR;
895
-
896
- auto artifacts = json::parse (buf.begin (), buf.end ());
897
-
898
- std::string fileName;
899
- for (const auto & artifact : artifacts)
900
- {
901
- auto name = artifact[" fileName" ].get <std::string>();
902
- if (name.find (" OpenShellSetup" ) == 0 )
903
- {
904
- fileName = name;
905
- break ;
906
- }
907
- }
908
-
909
- if (fileName.empty ())
910
- return LOAD_BAD_FILE;
911
-
912
- auto artifactUrl (jobUrl);
913
- artifactUrl += L' /' ;
914
- artifactUrl += std::wstring (fileName.begin (), fileName.end ());
915
-
916
- downloadUrl = artifactUrl.c_str ();
917
- }
918
-
919
- // changelog
920
- news.Append (CA2T (version.c_str ()));
921
- news.Append (L" \r\n\r\n " );
922
- try
923
- {
924
- // use Github API to compare commit that actual version was built from (APPVEYOR_REPO_COMMIT)
925
- // and commit that AppVeyor version was built from (commitId)
926
- auto commitId = build[" commitId" ].get <std::string>();
927
-
928
- std::wstring compareUrl (L" https://api.github.com/repos/Open-Shell/Open-Shell-Menu/compare/" );
929
- compareUrl += _T (APPVEYOR_REPO_COMMIT);
930
- compareUrl += L" ..." ;
931
- compareUrl += std::wstring (commitId.begin (), commitId.end ());
932
-
933
- buf = DownloadUrl (compareUrl.c_str ());
934
- auto compare = json::parse (buf.begin (), buf.end ());
935
-
936
- // then use first lines (subjects) of commit messages as changelog
937
- auto commits = compare[" commits" ];
938
- for (const auto & commit : commits)
939
- {
940
- auto message = commit[" commit" ][" message" ].get <std::string>();
941
-
942
- auto pos = message.find (' \n ' );
943
- if (pos != message.npos )
944
- message.resize (pos);
945
-
946
- news.Append (L" - " );
947
- news.Append (CA2T (message.c_str ()));
948
- news.Append (L" \r\n " );
949
- }
950
- }
951
- catch (...)
952
- {
953
- }
954
- }
955
- catch (...)
956
- {
957
- return LOAD_BAD_FILE;
958
- }
959
-
960
- return LOAD_OK;
961
- }
962
-
963
853
VersionData::TLoadResult VersionData::Load ( const wchar_t *fname, bool bLoadFlags )
964
854
{
965
855
Clear ();
0 commit comments