Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #54 from Turupawn/devel
Browse files Browse the repository at this point in the history
Me endpoints and Download queue control
  • Loading branch information
Turupawn committed Mar 30, 2018
2 parents 8c22a68 + 8b95d40 commit 0f22b38
Show file tree
Hide file tree
Showing 214 changed files with 7,115 additions and 2,389 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*.out
*.app

.vs/
build/

src/modio.so
Expand Down
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ script:
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then CXX=/usr/bin/g++-5 CC=/usr/bin/gcc-5 cmake . ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cmake . ; fi
- cmake --build . -- -j2
- ls

before_deploy:
# Set up git user name and tag this commit
- git config --local user.name "${GH_USER}"
- git config --local user.email "${GH_EMAIL}"
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then git tag "Linux-$(date +'%Y%m%d%H%M%S')" ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "OSX-$(date +'%Y%m%d%H%M%S')" ; fi
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then zip release.zip libmodio.so ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then zip release.zip libmodio.dylib ; fi

deploy:
provider: releases
api_key: "${GH_TOKEN}"
file: "release.zip"
skip_cleanup: true
on:
branch: master
79 changes: 79 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/include/*",
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/atlmfc/include/*",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt",
"${workspaceRoot}",
"${workspaceRoot}/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/include/*",
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/atlmfc/include/*",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
68 changes: 68 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"files.associations": {
"xstring": "cpp",
"xlocale": "cpp",
"algorithm": "cpp",
"array": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"new": "cpp",
"numeric": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xfunctional": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xmemory0": "cpp",
"xstddef": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"filesystem": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"ratio": "cpp",
"modio_c.h": "c"
}
}
27 changes: 27 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "${workspaceRoot}/build.bat",
"args": [
// Ask msbuild to generate full paths for file names.
"/property:GenerateFullPaths=true",
"/t:build"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "silent"
},
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mod.io SDK
Welcome to [mod.io](https://mod.io) SDK, built using C/C++. It allows game developers to host and automatically install user-created mods in their games. It connects to the [mod.io API](https://docs.mod.io), and [documentation for its endpoints](https://github.com/DBolical/modioSDK/wiki) can be viewed here. We have a [test environment](https://test.mod.io) available which offers developers a private sandbox to try the SDK out.
Welcome to [mod.io](https://mod.io) SDK, built using C++. It allows game developers to host and automatically install user-created mods in their games. It connects to the [mod.io API](https://docs.mod.io), and [documentation for its endpoints](https://github.com/DBolical/modioSDK/wiki) can be viewed here.

## Getting started

Expand Down
2 changes: 2 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd build
msbuild modio.sln
14 changes: 5 additions & 9 deletions examples/c++/01_Authentication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ int main()

volatile static bool finished = false;

auto wait = [&]()
{
auto wait = [&]() {
while (!finished)
{
modio_instance.sleep(10);
modioProcess();
modio_instance.process();
}
};

auto finish = [&]()
{
auto finish = [&]() {
finished = true;
};

Expand All @@ -29,8 +27,7 @@ int main()
std::cin >> email;

// Auth works by sending an email with a code. Lets trigger that now
modio_instance.emailRequest(email, [&](const modio::Response& response)
{
modio_instance.emailRequest(email, [&](const modio::Response &response) {
std::cout << "Response code: " << response.code << std::endl;

if (response.code == 200)
Expand All @@ -40,8 +37,7 @@ int main()
std::cin >> securityCode;

// Finish the auth process by entering the security code
modio_instance.emailExchange(securityCode, [&](const modio::Response& response)
{
modio_instance.emailExchange(securityCode, [&](const modio::Response &response) {
std::cout << "Response code: " << response.code << std::endl;
if (response.code == 200)
{
Expand Down
19 changes: 8 additions & 11 deletions examples/c++/02_BrowseMods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ int main(void)

volatile static bool finished = false;

auto wait = [&]()
{
auto wait = [&]() {
while (!finished)
{
modio_instance.sleep(10);
modioProcess();
modio_instance.process();
}
};

auto finish = [&]()
{
auto finish = [&]() {
finished = true;
};

Expand All @@ -25,17 +23,16 @@ int main(void)
filter.setLimit(7);
filter.setCacheMaxAgeSeconds(100);

std::cout <<"Getting mods..." << std::endl;
std::cout << "Getting mods..." << std::endl;

// Now we finished setting up the filters we are ready to request the mods
modio_instance.getMods(filter, [&](const modio::Response& response, const std::vector<modio::Mod> & mods)
{
modio_instance.getMods(filter, [&](const modio::Response &response, const std::vector<modio::Mod> &mods) {
std::cout << "On mod get response: " << response.code << std::endl;
if(response.code == 200)
if (response.code == 200)
{
std::cout << "Listing mods" << std::endl;
std::cout << "============" << std::endl;
for(auto& mod : mods)
for (auto &mod : mods)
{
std::cout << "Id: \t" << mod.id << std::endl;
std::cout << "Name:\t" << mod.name << std::endl;
Expand All @@ -48,7 +45,7 @@ int main(void)
std::cout << "Result limit: " << response.result_limit << std::endl;
std::cout << "Result offset: " << response.result_offset << std::endl;
}
finish();
//finish();
});

wait();
Expand Down
15 changes: 6 additions & 9 deletions examples/c++/03_GetUserMods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ int main(void)

volatile static bool finished = false;

auto wait = [&]()
{
auto wait = [&]() {
while (!finished)
{
modio_instance.sleep(10);
modioProcess();
modio_instance.process();
}
};

auto finish = [&]()
{
auto finish = [&]() {
finished = true;
};

Expand All @@ -26,14 +24,13 @@ int main(void)

// Mods created by the current user can be retreived using the getUserMods function
// This function will return mods even if they are still not acceped or visible
modio_instance.getUserMods(filter, [&](const modio::Response& response, const std::vector<modio::Mod> & mods)
{
modio_instance.getUserMods(filter, [&](const modio::Response &response, const std::vector<modio::Mod> &mods) {
std::cout << "On mod get response: " << response.code << std::endl;
if(response.code == 200)
if (response.code == 200)
{
std::cout << "Listing mods" << std::endl;
std::cout << "============" << std::endl;
for(auto& mod : mods)
for (auto &mod : mods)
{
std::cout << "Id: \t" << mod.id << std::endl;
std::cout << "Name:\t" << mod.name << std::endl;
Expand Down

0 comments on commit 0f22b38

Please sign in to comment.