diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bce07a9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+/.vs/
+*.vcxproj.user
+*.Build.CppClean.log
+/CCEngine/Debug/
+/CCEngine/Release/
+/Debug/
+/libModuleManagerTest/Debug/
+/Release/
diff --git a/CCEngine.sln b/CCEngine.sln
index 677b2ee..db0c499 100644
--- a/CCEngine.sln
+++ b/CCEngine.sln
@@ -5,12 +5,14 @@ VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CCEngine", "CCEngine\CCEngine.vcxproj", "{51637EB3-9942-43AE-9272-9DD85412EFC7}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModuleManagerTest", "libModuleManagerTest\libModuleManagerTest.vcxproj", "{45ECA063-033A-47D0-B8A8-5F7B504C4CE9}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CCEngineLoader", "CCEngineLoader\CCEngineLoader.vcxproj", "{450E76A9-E271-4349-9C06-3C0540F9B00F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libLicenseClient", "..\libLicenseClient\libLicenseClient.vcxproj", "{51345E59-83E5-4389-93A9-0131B40522B7}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libLicenseClientTest", "..\libLicenseClient\test\libLicenseClientTest.vcxproj", "{E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{44063F88-E25A-4C9D-AC11-9868D4CDD704}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -27,14 +29,6 @@ Global
{51637EB3-9942-43AE-9272-9DD85412EFC7}.Release|x64.Build.0 = Release|x64
{51637EB3-9942-43AE-9272-9DD85412EFC7}.Release|x86.ActiveCfg = Release|Win32
{51637EB3-9942-43AE-9272-9DD85412EFC7}.Release|x86.Build.0 = Release|Win32
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Debug|x64.ActiveCfg = Debug|x64
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Debug|x64.Build.0 = Debug|x64
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Debug|x86.ActiveCfg = Debug|Win32
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Debug|x86.Build.0 = Debug|Win32
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Release|x64.ActiveCfg = Release|x64
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Release|x64.Build.0 = Release|x64
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Release|x86.ActiveCfg = Release|Win32
- {45ECA063-033A-47D0-B8A8-5F7B504C4CE9}.Release|x86.Build.0 = Release|Win32
{450E76A9-E271-4349-9C06-3C0540F9B00F}.Debug|x64.ActiveCfg = Debug|x64
{450E76A9-E271-4349-9C06-3C0540F9B00F}.Debug|x64.Build.0 = Debug|x64
{450E76A9-E271-4349-9C06-3C0540F9B00F}.Debug|x86.ActiveCfg = Debug|Win32
@@ -51,10 +45,21 @@ Global
{51345E59-83E5-4389-93A9-0131B40522B7}.Release|x64.Build.0 = Release|x64
{51345E59-83E5-4389-93A9-0131B40522B7}.Release|x86.ActiveCfg = Release|Win32
{51345E59-83E5-4389-93A9-0131B40522B7}.Release|x86.Build.0 = Release|Win32
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Debug|x64.ActiveCfg = Debug|x64
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Debug|x64.Build.0 = Debug|x64
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Debug|x86.ActiveCfg = Debug|Win32
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Debug|x86.Build.0 = Debug|Win32
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Release|x64.ActiveCfg = Release|x64
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Release|x64.Build.0 = Release|x64
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Release|x86.ActiveCfg = Release|Win32
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {E781AE2E-4A02-4D63-9CAC-1AEBACD9CD73} = {44063F88-E25A-4C9D-AC11-9868D4CDD704}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4CBA44D0-8074-48F8-A6DD-5914FE3F0026}
EndGlobalSection
diff --git a/CCEngine/CCEngine.vcxproj b/CCEngine/CCEngine.vcxproj
index b2974ad..6b75436 100644
--- a/CCEngine/CCEngine.vcxproj
+++ b/CCEngine/CCEngine.vcxproj
@@ -18,6 +18,18 @@
x64
+
+
+
+
+
+
+
+
+
+ {51345e59-83e5-4389-93a9-0131b40522b7}
+
+
15.0
{51637EB3-9942-43AE-9272-9DD85412EFC7}
@@ -100,7 +112,7 @@
true
_WIN32_WINNT=0x0501;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
true
- $(ProjectDir)..\..\..\openssl\include\;%(AdditionalIncludeDirectories)
+ $(ProjectDir)..\..\libLicenseClient\api;%(AdditionalIncludeDirectories)
stdcpplatest
@@ -117,7 +129,7 @@
true
_WIN32_WINNT=0x0501;_DEBUG;_LIB;%(PreprocessorDefinitions)
true
- $(ProjectDir)..\..\..\openssl\include\;%(AdditionalIncludeDirectories)
+ $(ProjectDir)..\..\libLicenseClient\api;%(AdditionalIncludeDirectories)
stdcpplatest
@@ -135,7 +147,7 @@
true
_WIN32_WINNT=0x0501;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);BOOST_EXCEPTION_DISABLE
true
- $(ProjectDir)..\..\..\openssl\include\;%(AdditionalIncludeDirectories)
+ $(ProjectDir)..\..\libLicenseClient\api;%(AdditionalIncludeDirectories)
stdcpplatest
false
false
@@ -162,7 +174,7 @@
true
_WIN32_WINNT=0x0501;NDEBUG;_LIB;%(PreprocessorDefinitions)
true
- $(ProjectDir)..\..\..\openssl\include\;%(AdditionalIncludeDirectories)
+ $(ProjectDir)..\..\libLicenseClient\api;%(AdditionalIncludeDirectories)
stdcpplatest
@@ -172,36 +184,6 @@
true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CCEngine/CCEngine.vcxproj.filters b/CCEngine/CCEngine.vcxproj.filters
index e61f1b8..251b858 100644
--- a/CCEngine/CCEngine.vcxproj.filters
+++ b/CCEngine/CCEngine.vcxproj.filters
@@ -9,84 +9,18 @@
{4FC737F1-C7A5-4376-A066-2A32D752A2FF}
cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
- {62810fe9-1f5f-41c9-a552-642d73dbcfcb}
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
+
src
-
+
src
-
- src
-
-
- src
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
- src\updclient
-
-
-
+
src
-
- src\updclient
-
-
- src\updclient
-
-
-
\ No newline at end of file
diff --git a/CCEngine/HTTPClient.cpp b/CCEngine/HTTPClient.cpp
deleted file mode 100644
index 3eee61c..0000000
--- a/CCEngine/HTTPClient.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-#include "HTTPClient.h"
-
-#include
-
-#include
-#include
-#include
-
-namespace
-{
-
- static
- void dump(const char *text,
- FILE *stream, unsigned char *ptr, size_t size)
- {
- size_t i;
- size_t c;
- unsigned int width = 0x10;
-
- fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n",
- text, (long)size, (long)size);
-
- fwrite(ptr, 1, size, stream);
- fputc('\n', stream); // newline
-/* for (i = 0; i= 0x20 && ptr[i + c] < 0x80) ? ptr[i + c] : '.';
- fputc(x, stream);
- }
-
- fputc('\n', stream); // newline
- } */
- }
-
- static
- int my_trace(CURL *handle, curl_infotype type,
- char *data, size_t size,
- void *userp)
- {
- const char *text;
- (void)handle; /* prevent compiler warning */
- (void)userp;
-
- switch (type) {
- case CURLINFO_TEXT:
- fprintf(stderr, "== Info: %s", data);
- default: /* in case a new one is introduced to shock us */
- return 0;
-
- case CURLINFO_HEADER_OUT:
- text = "=> Send header";
- break;
- case CURLINFO_DATA_OUT:
- text = "=> Send data";
- break;
- case CURLINFO_SSL_DATA_OUT:
- text = "=> Send SSL data";
- break;
- case CURLINFO_HEADER_IN:
- text = "<= Recv header";
- break;
- case CURLINFO_DATA_IN:
- text = "<= Recv data";
- break;
- case CURLINFO_SSL_DATA_IN:
- text = "<= Recv SSL data";
- break;
- }
-
- dump(text, stderr, (unsigned char *)data, size);
- return 0;
- }
-
-static size_t reader(char *ptr, size_t size, size_t nmemb, std::istream *is)
-{
- std::streamsize totalRead = 0;
- if (*is)
- {
- is->read(&ptr[totalRead], size * nmemb - totalRead);
-// is->read(&ptr[totalRead], 1);
- totalRead = is->gcount();
- }
-
- return totalRead;
-}
-
-static int writer(char *data, size_t size, size_t nmemb, std::ostream *os)
-{
- if (os == NULL)
- return 0;
-
- os->write(data, size*nmemb);
-
- return size * nmemb;
-}
-
-struct CURLDeleter
-{
- void operator() (CURL* ptr)
- {
- if (ptr)
- {
- curl_easy_cleanup(ptr);
- }
- }
-};
-
-struct curl_slist_deleter
-{
- void operator() (curl_slist* ptr)
- {
- if (ptr)
- {
- curl_slist_free_all(ptr);
- }
- }
-};
-
-struct DownloadSession
-{
- char errorBuffer[CURL_ERROR_SIZE] = { 0 };
- std::unique_ptr conn;
- std::unique_ptr extraHeaders;
-};
-
-DownloadSession initCurlRequest(const std::string& url, std::ostream &os)
-{
- DownloadSession result;
- CURLcode code;
-
- std::unique_ptr conn(curl_easy_init());
-
- if (!conn)
- {
- throw std::runtime_error("Failed to create CURL connection");
- }
-
- code = curl_easy_setopt(conn.get(), CURLOPT_ERRORBUFFER, result.errorBuffer);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set error buffer [" << code << "]";
- throw std::runtime_error(oss.str());
- }
-
- const char* errorBuffer = result.errorBuffer;
- code = curl_easy_setopt(conn.get(), CURLOPT_URL, url.c_str());
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set URL [" << errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- code = curl_easy_setopt(conn.get(), CURLOPT_FOLLOWLOCATION, 1L);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set redirect option [" << errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- code = curl_easy_setopt(conn.get(), CURLOPT_MAXREDIRS, 5L);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set maximum number of redirects [" << errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- code = curl_easy_setopt(conn.get(), CURLOPT_WRITEFUNCTION, writer);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set write function [" << errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- code = curl_easy_setopt(conn.get(), CURLOPT_WRITEDATA, &os);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set write data [" << errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- // DEBUG:
- code = curl_easy_setopt(conn.get(), CURLOPT_DEBUGFUNCTION, my_trace);
- code = curl_easy_setopt(conn.get(), CURLOPT_VERBOSE, 1);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set verbose mode";
- throw std::runtime_error(oss.str());
- }
-
- result.conn = std::move(conn);
-
- return result;
-}
-
-DownloadSession initCurlPostJsonRequest(const std::string& url, std::istream& is, size_t length, std::ostream &os)
-{
- DownloadSession result = initCurlRequest(url, os);
- CURLcode code;
-
- auto contentLengthHeader = std::string("Content-Length: ") + std::to_string(length);
-
- struct curl_slist *headers = NULL;
- headers = curl_slist_append(headers, "Accept: application/json");
- headers = curl_slist_append(headers, "Content-Type: application/json");
- headers = curl_slist_append(headers, contentLengthHeader.c_str());
- headers = curl_slist_append(headers, "Charsets: utf-8");
- result.extraHeaders.reset(headers);
-
- code = curl_easy_setopt(result.conn.get(), CURLOPT_POST, 1L);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set post option [" << result.errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- code = curl_easy_setopt(result.conn.get(), CURLOPT_HTTPHEADER, result.extraHeaders.get());
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set http headers [" << result.errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- code = curl_easy_setopt(result.conn.get(), CURLOPT_READFUNCTION, reader);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set read function [" << result.errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- code = curl_easy_setopt(result.conn.get(), CURLOPT_READDATA, &is);
- if (code != CURLE_OK)
- {
- std::ostringstream oss;
- oss << "Failed to set read data [" << result.errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-
- return result;
-}
-
-} // anonymous namespace
-
-HTTPClient::HTTPClient()
-{
- curl_global_init(CURL_GLOBAL_DEFAULT);
-}
-
-void HTTPClient::get(const std::string& url, std::ostream& dstStream)
-{
- auto session = initCurlRequest(url, dstStream);
-
- auto code = curl_easy_perform(session.conn.get());
- session.conn.release();
-
- if (code != CURLE_OK)
- {
- if (code == CURLE_COULDNT_CONNECT)
- {
- throw CouldNotConnectException();
- }
-
- std::ostringstream oss;
- oss << "Failed to get '" << url << "' [" << session.errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-}
-
-void HTTPClient::postJson(const std::string& url, std::istream& json, size_t length, std::ostream& dstStream)
-{
- auto session = initCurlPostJsonRequest(url, json, length, dstStream);
-
- auto code = curl_easy_perform(session.conn.get());
- session.conn.release();
-
- if (code != CURLE_OK)
- {
- if (code == CURLE_COULDNT_CONNECT)
- {
- throw CouldNotConnectException();
- }
- std::ostringstream oss;
- oss << "Failed to post '" << url << "' [" << session.errorBuffer << "]";
- throw std::runtime_error(oss.str());
- }
-}
-
-void HTTPClient::postJson(const std::string& url, const std::string& json, std::ostream& dstStream)
-{
- std::istringstream is(json);
- return postJson(url, is, json.size(), dstStream);
-}
diff --git a/CCEngine/HTTPClient.h b/CCEngine/HTTPClient.h
deleted file mode 100644
index 7d78bba..0000000
--- a/CCEngine/HTTPClient.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include
-#include
-
-class CouldNotConnectException : public std::exception
-{
-public:
- CouldNotConnectException()
- {}
-
- virtual ~CouldNotConnectException() throw () {}
-};
-
-class HTTPClient
-{
-public:
- HTTPClient();
-
-public:
- void get(const std::string& url, std::ostream& dstStream) throw (CouldNotConnectException);
- void postJson(const std::string& url, std::istream& json, size_t length, std::ostream& dstStream) throw (CouldNotConnectException);
- void postJson(const std::string& url, const std::string& json, std::ostream& dstStream) throw (CouldNotConnectException);
-};
diff --git a/CCEngine/HashUtils.cpp b/CCEngine/HashUtils.cpp
deleted file mode 100644
index 1d8c45f..0000000
--- a/CCEngine/HashUtils.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "HashUtils.h"
-
-#include
-#include
-#include
-
-using CryptoPP::SHA256;
-using CryptoPP::FileSource;
-using CryptoPP::HashFilter;
-using CryptoPP::HexEncoder;
-using CryptoPP::StringSink;
-namespace fs = boost::filesystem;
-
-std::string calcSHA256(const fs::path& file)
-{
- SHA256 hash;
- std::string digest;
-
- FileSource f(file.native().c_str(), true, new HashFilter(hash, new HexEncoder(new StringSink(digest))));
-
- return digest;
-}
diff --git a/CCEngine/HashUtils.h b/CCEngine/HashUtils.h
deleted file mode 100644
index 883950f..0000000
--- a/CCEngine/HashUtils.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-#include
-#include
-
-std::string calcSHA256(const boost::filesystem::path& file);
diff --git a/CCEngine/IModuleDatabase.h b/CCEngine/IModuleDatabase.h
deleted file mode 100644
index 5b234a2..0000000
--- a/CCEngine/IModuleDatabase.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-#include "ModuleVersion.h"
-
-#include
-
-#include