This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Modfiles
Ahmed Castro edited this page Dec 3, 2017
·
31 revisions
void addModfile(u32 mod_id, modio::ModfileHandler& modfile_handler, const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& callback)
API endpoint used: Add Mod File
Uploads a file to a corresponding mod.
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's unique identifier. |
modfile_handler | modio::ModfileHandler& |
ModioModfileHandler object containing the data that will be added. |
callback | const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& |
Function called once the process finished. |
Name | Type | Description |
---|---|---|
response | const modio::Response& response |
ModioResponse object that contains the mod.io response status. |
modfile | const modio::Modfile& |
Resulting ModioModfile object. |
modio::ModfileHandler modfile_handler;
modfile_handler.setModfilePath("ModExample/modfile/");
modfile_handler.setModfileVersion("v1.1.0");
modfile_handler.setModfileChangelog("This is a change log, this is a changelog , this is a changelog , this is a changelog , this is a changelog , this is a changelog, this is a changelog , this is a changelog , this is a changelog");
mod.addModfile(requested_mod.id, modfile_handler, [&](const modio::Response& response, const modio::Modfile& modfile)
{
if(response.code == 201)
{
//Modfile successfully added
}
});
void editModfile(u32 mod_id, u32 modfile_id, modio::ModfileHandler& modfile_handler, const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& callback)
API endpoint used: Edit Mod File
Updates the details of a corresponding modfile. Only the changelog
and active
fields are editable. If you want to update another field, you should add a new modfile instead.
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's uinique identifier. |
modfile_id | u32 |
Modfile's unique identifier. |
modfile_handler | modio::ModfileHandler& |
ModioModfileHandler object containing the data that will be edited. |
callback | const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& |
Function called once the process finished. |
Name | Type | Description |
---|---|---|
response | const modio::Response& |
ModioResponse object that contains the mod.io response status. |
modfile | const modio::Modfile& |
Resulting ModioModfile object. |
modio::ModfileHandler modfile_handler;
modfile_handler.setModfileActive(true);
modfile_handler.setModfileChangelog("Stuff was changed on this mod via the examples.");
mod.editModfile(requested_mod.id, requested_mod.modfile.id, modfile_handler, [&](const modio::Response& response, const modio::Modfile& modfile)
{
if(response.code == 200)
{
//Modfile successfully edited
}
});
void modioInstallModfile(ModioModfile *modfile, char* destination_path, void (*callback)(ModioResponse* response, char* path))
void installModfile(modio::Modfile modfile, const std::string& destination_path, const std::function<void(const modio::Response& response, const std::string& path)>& callback)
Downloads and decompress a mod file into a provided directory.
Name | Type | Description |
---|---|---|
modfile | modio::Modfile modfile |
ModioModfile object to be downloaded. |
destination_path | const std::string& destination_path |
Directory where the modfile will be installed. |
callback | const std::function<void(const modio::Response& response, const std::string& path)>& |
Function called once the process finished. |
Name | Type | Description |
---|---|---|
response | const modio::Response& |
ModioResponse object that contains the mod.io response status. |
path | const std::string& |
Path where the modfile was installed. |
mod.installModfile(requested_mod.modfile, "mods_dir/modfile", [&](const modio::Response& response, const std::string& path)
{
if(response.code == 200)
{
//Modfile successfully installed
}
});
u32 getModfileState(u32 modfile_id)
Returns the current state of the downloads.
Name | Type | Description |
---|---|---|
modfile_id | u32 | Modfile unique identifier. |
Name | Value | Description |
---|---|---|
MODIO_MODFILE_NOT_INSTALLED |
0 | The modfile is not installed. |
MODIO_MODFILE_INSTALLED |
1 | The modfile is installed. |
MODIO_MODFILE_INSTALLING |
2 | The modfile is being installed. |
double getModfileDownloadPercentage(u32 modfile_id)
Returns the current percentage of the modfile downloaded. Returns -1 if the modfile is not being currently downloaded.
Name | Type | Description |
---|---|---|
modfile_id | u32 | Modfile unique identifier. |
- Home
- Table of Contents
- Getting Started
- SDK Methods
- Creators
- Editors
- Schemas
- modio::Avatar
- modio::Comment
- modio::Dependency
- modio::Download
- modio::Error
- modio::Filehash
- modio::Game
- modio::GameTagOption
- modio::Header
- modio::Icon
- modio::Image
- modio::InstalledMod
- modio::Logo
- modio::Media
- modio::MetadataKVP
- modio::Mod
- modio::ModEvent
- modio::Modfile
- modio::QueuedModDownload
- modio::QueuedModfileUpload
- modio::Rating
- modio::Response
- modio::Stats
- modio::Tag
- modio::User
- Debugging
- Constants
-
C Compatibility
- Methods
- Initialization, Process and Shutdown (C compatible)
- User Authentication (C compatible)
- Mods (C compatible)
- Modfiles (C compatible)
- Media (C compatible)
- Subscriptions (C compatible)
- Events (C compatible)
- Stats (C compatible)
- Tags (C compatible)
- Ratings (C compatible)
- Metadata KVP (C compatible)
- Dependencies (C compatible)
- Comments (C compatible)
- Reports (C compatible)
- Me (C compatible)
- Downloads (C compatible)
- Uploads (C compatible)
- Logs (C compatible)
- External Auth (C compatible)
- Configuration (C compatible)
- Creators
- Editors
- Schemas
- ModioAvatar
- ModioComment
- ModioDependency
- ModioDownload
- ModioError
- ModioFilehash
- ModioGame
- ModioGameTagOption
- ModioHeader
- ModioIcon
- ModioImage
- ModioInstalledMod
- ModioListNode
- ModioLogo
- ModioMedia
- ModioMetadataKVP
- ModioMod
- ModioModEvent
- ModioModfile
- ModioQueuedModDownload
- ModioQueuedModfileUpload
- ModioRating
- ModioResponse
- ModioStats
- ModioTag
- ModioUser
- Methods
- Building