Skip to main content

Core

Modio

TypeDescription
Error
ErrorEmbedded
IModioLogHandler
IModioServiceSettings
ModIndex
ModInstallationManagementManages mod downloading, installation, updating & uninstallation.
ModioClient
ModioCommandLineAllows for modio specific command line arguments to be parsed easily
ModioConsoleLog
ModioDebugMenuAttribute
ModioLog
ModioServices
ModioSettings
TermsOfUseThe mod.io Terms of Use links. Each link contains a boolean field for if its required, Users must agree to all linked terms that have a True value for this field. Use Get to get the latest Terms of Use.
TermsOfUseLinkRepresents a url as part of the TOS. The 'required' field can be used to determine whether it is a TOS requirement to be displayed to the end user when viewing the TOS text.
Version

Error

public class Error : IEquatable<Error>
Field

bool StoreStackTraceWhenCreated

bool StoreStackTraceWhenCreated

Error None

Error None = new Error(ErrorCode.NONE)

Error Unknown

Error Unknown = new Error(ErrorCode.UNKNOWN)

ErrorCode Code

ErrorCode Code
Property

bool IsSilent

public bool IsSilent

If an error is silent, don't print an error to the console.

Method

GetMessage

public virtual string GetMessage()

ToString

public override string ToString()

Equals

public bool Equals(Error other)

Equals

public override bool Equals(object obj)

GetHashCode

public override int GetHashCode()

AddMethodContext

public Error AddMethodContext( string message

ErrorEmbedded

public class ErrorEmbedded : Error
Field

string Message

string Message

string Errors

string Errors
Method

GetMessage

public override string GetMessage()

Essentially the same logic as Error.GetMessage, but also includes the Message and validation Errors from the server


IModioLogHandler

public interface IModioLogHandler

IModioServiceSettings

public interface IModioServiceSettings

ModIndex

[System.Serializable] public class ModIndex
Property

bool IsDirty

[JsonIgnore] public bool IsDirty

get set


ModInstallationManagement

public static class ModInstallationManagement

Manages mod downloading, installation, updating & uninstallation.

Property

bool DownloadAndExtractAsSingleJob

public static bool DownloadAndExtractAsSingleJob

get set

If set to true plugin will attempt to download and extract in one step.

Mod CurrentOperationOnMod

public static Mod CurrentOperationOnMod

Returns the current mod that the current operation is running on.

bool IsInitialized

public static bool IsInitialized

Returns if the mod installation management is initialized.

int PendingModOperationCount

public static int PendingModOperationCount

Returns the number of operations in queue does not include the current operation

Method

Activate

public static void Activate()

Begin downloading and installing mods.

Deactivate

public static void Deactivate(bool cancelCurrentJob)

Stop downloading and installing mods.

Remarks

Uninstallations will also be stopped.

IsModSubscribed

public static bool IsModSubscribed(long modId, long userId)

Returns a boolean indicating if a given mod is subscribed by the given user

Parameters

modId The mod id userId The user id

Returns

True if the mod is subscribed by the given user.

GetAllInstalledMods

public static ICollection<Mod> GetAllInstalledMods()

Returns a collection of all installed mods.

Returns

The collection of mods

GetTotalDiskUsage

public static long GetTotalDiskUsage(bool includeQueued)

Returns the total disk usage in bytes

Parameters

includeQueued Wether to include queued (pending) operation, if true will account for file IO changes to be made by the queued operation

Returns

The total disk usage (bytes)

StartTempModSession

public static async Task<Error> StartTempModSession(List<ModioId> tempMods, bool appendCurrentSession

Will start a temporary mod session.

Parameters

tempMods A list of mods to be used for the temp session. appendCurrentSession Whether the new mods should be added to the existing running mod session.

Returns

An asynchronous task that returns Error.Error.None on success.

See Also

EndCurrentTempModSession

EndCurrentTempModSession

[ModioDebugMenu(ShowInSettingsMenu = false)] public static void EndCurrentTempModSession()

Will end the current temp mod session started by StartTempModSession

AddTemporaryMods

public static async Task<Error> AddTemporaryMods(List<ModioId> tempMods, int lifeTimeDaysOverride

Adds the list of mods to mod index

Parameters

tempMods The list of mods to be added lifeTimeDaysOverride The number of days to keep the mods installed

Returns

An asynchronous task that returns Error.Error.None on success.

ClearExpiredTempMods

public static void ClearExpiredTempMods()

RetryInstallingMod

public static async Task<Error> RetryInstallingMod(Mod mod)

Retries installing a given mod.

Parameters

mod The Mod to be installed.

MarkModForUninstallation

public static void MarkModForUninstallation(Mod mod)

Marks a mod for uninstallation.

Parameters

mod The Mod to be uninstalled.

IsThereAvailableSpaceFor

public static async Task<bool> IsThereAvailableSpaceFor(Mod mod)

Returns if there is enough available space to install a Mod, will account for pending jobs.

Parameters

mod The mod check available space for

Returns

An asynchronous task that returns true if there is enough space, false otherwise.

IsThereAvailableSpaceFor

public static async Task<bool> IsThereAvailableSpaceFor(ModCollection collection)

Returns if there is enough available space to install a Mod, will account for pending jobs.

Parameters

collection The mod check available space for

Returns

An asynchronous task that returns true if there is enough space, false otherwise.

IsThereAvailableSpaceFor

public static async Task<bool> IsThereAvailableSpaceFor(IEnumerable<Mod> mods)
Enum
Download
Install
Update
Uninstall
Validate
Scan
Checking
Started
Completed
Cancelled
Failed

ModioClient

public static class ModioClient
Property

IModioDataStorage DataStorage

public static IModioDataStorage DataStorage

The Data Storage implementation being used by the plugin.

Remarks

Prefer resolving the dependency yourself

See Also

ModioServices

IModioAPIInterface Api

public static IModioAPIInterface Api

The API interface being used by the plugin.

Remarks

Prefer resolving the dependency yourself

See Also

ModioServices

IModioAuthService AuthService

public static IModioAuthService AuthService

The Authentication Service being used by the plugin.

Remarks

Prefer resolving the dependency yourself

See Also

ModioServices

ModioSettings Settings

public static ModioSettings Settings

Returns the ModioSettings from the ModioServices

Remarks

Prefer resolving the dependency yourself

See Also

ModioServices

bool IsInitialized

public static bool IsInitialized

get

Returns true if initialized, false otherwise.

Method

Init

public static Task<Error> Init(ModioSettings settings)

Initializes the ModioClient with the given ModioSettings

Parameters

settings The settings to use

Returns

An asynchronous task that returns Error.Error.None on success.

Init

public static async Task<Error> Init()

Initializes the ModioClient.

Returns

A task that returns Error. If successfully initialized returns Error.Error.None

Shutdown

public static async Task Shutdown()

Shuts down the client. Will invoke the shutdown methods on services.


ModioCommandLine

public static class ModioCommandLine

Allows for modio specific command line arguments to be parsed easily

Method

TryGetArgument

public static bool TryGetArgument(string argument, out string value)

Attempt to get a mod.io command line argument and its encoded value from the environment.

Returns

true if the argument was successfully found.

Remarks

All arguments need to be in the format:-modio-arg=value or -modio-arg value

HasFlag

public static bool HasFlag(string flag)

ModioConsoleLog

public class ModioConsoleLog : IModioLogHandler
Method

LogHandler

public void LogHandler(LogLevel logLevel, object message)

ModioDebugMenuAttribute

public class ModioDebugMenuAttribute : Attribute
Field

bool ShowInSettingsMenu

bool ShowInSettingsMenu = true

bool ShowInBrowserMenu

bool ShowInBrowserMenu = true

ModioLog

public class ModioLog
Field

string LOG_PREFIX_DEFAULT

string LOG_PREFIX_DEFAULT = "[mod.io] "
Property

ModioLog? Error

public static ModioLog? Error

get

ModioLog? Warning

public static ModioLog? Warning

get

ModioLog? Message

public static ModioLog? Message

get

ModioLog? Verbose

public static ModioLog? Verbose

get

Method

Log

public void Log(object message)

GetLogLevel

public static ModioLog? GetLogLevel(LogLevel logLevel)

ModioServices

public static class ModioServices
Method

Bind

[Pure] public static IBindType<T> Bind<T>()

Bind a service so that it can be accessed by other systems


ModioServices.Bind&lt;IWebBrowserHandler&gt;()
.FromNew&lt;MyCustomWebBrowserHandler&gt;(ModioServicePriority.DeveloperOverride);

Type Parameters

T:

BindInstance

public static void BindInstance<T>(T instance, ModioServicePriority priority

Convenience wrapper to bind an instance. The same as writing csharpBind&lt;T&gt;().FromInstance(instance, priority);

Parameters

instance The instance to bind priority The priority of the binding

Type Parameters

T:

BindErrorMessage

public static void BindErrorMessage<T>(string message, ModioServicePriority priority

Binds an error message to a type, so that if that type is attempted to be resolved without a proper binding, the error message will be logged and included in the exception.

Parameters

message The error message to log and include in the exception when resolution of the type fails due to missing bindings. priority The priority of the binding

Type Parameters

T:

Exceptions

KeyNotFoundException:

Remarks

This is intended to make it easier for users to understand what they need to do to properly set up the Plugin when they encounter common issues with missing bindings.

Resolve

public static T Resolve<T>()

Resolves an instance of type T using the current bindings.

Type Parameters

T:

Returns

An instance of type T

Remarks

If multiple bindings exist, the one with the highest priority will be used. If multiple bindings of the same priority exist, the last one added will be used.

TryResolve

public static bool TryResolve<T>(out T result)

Resolves an instance of type T using the current bindings, returning true if successful and false if no valid bindings were found.

Parameters

result When the method returns, contains the resolved instance of type T if the resolution was successful, or the default value of T if no valid bindings were found.

Type Parameters

T:

Returns

True if the resolution was successful, false if no valid bindings were found.

GetBindings

public static IResolveType<T> GetBindings<T>(bool createIfMissing

Gets the bindings for type T.

Parameters

createIfMissing If true, the bindings will be created if they don't exist yet. If false, a KeyNotFoundException will be thrown if the bindings don't exist.

Type Parameters

T:

Returns

The bindings for type T

Exceptions

KeyNotFoundException:

Remarks

This can be used to manually inspect or modify the bindings for a type. Consider using AddBindingChangedListener{T} instead if you just want to be notified when the binding changes without needing to manually manage the bindings yourself.

AddBindingChangedListener

public static void AddBindingChangedListener<T>(Action<T> onNewValue, bool fireImmediatelyIfValueBound

Adds a listener that will be invoked whenever a new binding of type T is added.

Parameters

onNewValue The listener to invoke when a new binding is added. fireImmediatelyIfValueBound If true, the listener will be immediately invoked with the current value of the binding (if any) when added. If false, the listener will only be invoked on future changes to the binding.

Type Parameters

T:

RemoveBindingChangedListener

public static void RemoveBindingChangedListener<T>(Action<T> onNewValue)

Removes a listener added with AddBindingChangedListener{T} so that it will no longer be invoked when the binding changes.

Parameters

onNewValue The listener to remove

Type Parameters

T:

Remarks

Note that this will not prevent the listener from being invoked if the binding has already changed and the listener was not yet removed, so consider using RemoveBindingWithPriority{T} if you want to ensure a binding is no longer used at all.

RemoveAllBindingsOfType

public static void RemoveAllBindingsOfType<T>()

Removes all bindings of type T, regardless of priority.

Type Parameters

T:

Remarks

Use with caution, as this may cause issues if done at the wrong time. Consider using RemoveBindingWithPriority{T} instead if you only want to remove specific bindings.

Class

Binding

Condition

Priority

Resolve

TryResolve

Interface

IBindType

IResolveType


ModioSettings

[Serializable] public class ModioSettings
Field

long GameId

long GameId

string APIKey

string APIKey

string ServerURL

string ServerURL

string DefaultLanguage

string DefaultLanguage = "en"

LogLevel LogLevel

LogLevel LogLevel = LogLevel.Warning

IModioServiceSettings PlatformSettings

IModioServiceSettings[] PlatformSettings
Method

GetPlatformSettings

public T GetPlatformSettings<T>() where T : IModioServiceSettings

TryGetPlatformSettings

public bool TryGetPlatformSettings<T>(out T settings) where T : IModioServiceSettings

ShallowClone

public ModioSettings ShallowClone()

InvokeOnChanged

public void InvokeOnChanged()

TermsOfUse

public class TermsOfUse

The mod.io Terms of Use links. Each link contains a boolean field for if its required, Users must agree to all linked terms that have a True value for this field. Use Get to get the latest Terms of Use.

Property

string TermsText

public string TermsText

get

string AgreeText

public string AgreeText

get

string DisagreeText

public string DisagreeText

get

public TermsOfUseLink[] Links

get

Method

Get

public static async Task<(Error error, TermsOfUse result)> Get()

Gets the latest Terms of Use from the mod.io API, or returns a cached one if it's already been received during the session.

Returns

Error.Error.None if successful. Otherwise, it will return the API error.

public TermsOfUseLink GetLink(LinkType type)

Gets a specific link from the received Terms of Use object.


public struct TermsOfUseLink

Represents a url as part of the TOS. The 'required' field can be used to determine whether it is a TOS requirement to be displayed to the end user when viewing the TOS text.

Field

LinkType type

LinkType type

string text

string text

string url

string url

bool required

bool required

Version

public static class Version
Method

AddEnvironmentDetails

public static void AddEnvironmentDetails(string details)

GetCurrent

public static string GetCurrent()

Enums

LinkType
Website
Terms
Privacy
Manage
Refund

This cannot be gotten from this endpoint! This is here to help band-aid CUI

Monetization

LogLevel
None
Error
Warning
Message
Verbose

ModioResourceType
Mod
Collection

ModioServicePriority

Specify the priority of a dependency, which controls which dependency will be used when multiple bindings exist Higher numbers are higher priority. You can modify these priorities if you want to have an even more specific override e.g. var priority = ModioServicePriority.EngineImplementation + 1;

Fallback = 0

Do not bind things to this that should be used in working situations You can bind error messages at this priority to give more information to users when binding fails ModioServices.BindErrorMessage{T}

Default = 10

Most mod.io basic implementations will use this priority

EngineImplementation = 20

e.g. Unity specific

PlatformProvided = 30

e.g. a particular console or storefront

DeveloperOverride = 40

A custom implementation within your own application

UnitTestOverride = 100

Intended for internal usage to support mod.io's unit testing


Modio.Authentication

TypeDescription
IEmailCodePrompter
IGetActiveUserIdentifier
IModioAuthService
IPotentialModioEmailAuthService
ModioEmailAuthServiceUse for authenticating with email
ModioMultiplatformAuthResolver

IEmailCodePrompter

public interface IEmailCodePrompter

IGetActiveUserIdentifier

public interface IGetActiveUserIdentifier
Method

GetActiveUserIdentifier

public Task<string> GetActiveUserIdentifier();

IModioAuthService

public partial interface IModioAuthService
Property

ModioAPI.Portal Portal

public ModioAPI.Portal Portal

get

Method

Authenticate

public Task<Error> Authenticate( bool displayedTerms, string thirdPartyEmail

Authenticates with the required server

Parameters

displayedTerms The terms that were displayed to the user thirdPartyEmail Optional email address used for authentication sync Optional parameter to indicate if the profile should begin syncing with the server immediately after authentication


IPotentialModioEmailAuthService

public interface IPotentialModioEmailAuthService

ModioEmailAuthService

public class ModioEmailAuthService : IModioAuthService, IGetActiveUserIdentifier, IPotentialModioEmailAuthService

Use for authenticating with email


GameObject codeWindow;
void Awake()
{
ModioServices.Bind&lt;IModioAuthService&gt;()
.FromInstance(new ModioEmailAuthPlatform(), 50);
}
async void Authenticate()
{
Error error = await ModioClient.AuthService.Authenticate(true, "some_email@supercoolemail.com");
if (error)
Debug.LogError($"Error authenticating with email");
else
Debug.Log($"Successfully authenticated");
}
Task&lt;string&gt; ShowCodePrompt()
{
codeWindow.Enable;
// Capture security code here
string code = await SomeCodeInputLogic();
return code;
}

Property

bool IsEmailPlatform

public bool IsEmailPlatform

ModioAPI.Portal Portal

public ModioAPI.Portal Portal
Method

Authenticate

public async Task<Error> Authenticate( bool displayedTerms, string thirdPartyEmail

Begins the email authentication process. This will invoke the codePrompter passed either into the constructor of this class or with SetCodePrompter to enter the security code.

Returns

Error.None if the authentication completed successfully.

AuthenticateWithoutEmailRequest

public async Task<Error> AuthenticateWithoutEmailRequest()

Use this to authenticate with a previously acquired, still valid security code.

Returns

Error.None if the authentication completed successfully.

SetCodePrompter

public void SetCodePrompter(IEmailCodePrompter codePrompter)

SetCodePrompter

public void SetCodePrompter(Func<Task<string>> codePrompter)

GetActiveUserIdentifier

public Task<string> GetActiveUserIdentifier()

ModioMultiplatformAuthResolver

public class ModioMultiplatformAuthResolver : IModioAuthService, IGetActiveUserIdentifier, IPotentialModioEmailAuthService
Property

IModioAuthService ServiceOverride

public IModioAuthService ServiceOverride

get set

IReadOnlyList AuthBindings

public IReadOnlyList<IModioAuthService> AuthBindings

get

bool IsEmailPlatform

public bool IsEmailPlatform

ModioAPI.Portal Portal

public ModioAPI.Portal Portal
Method

Authenticate

public Task<Error> Authenticate(bool displayedTerms, string thirdPartyEmail

GetActiveUserIdentifier

public Task<string> GetActiveUserIdentifier()

Modio.Caching

TypeDescription
BaseCacheBase class for caching objects in Modio.

BaseCache

public abstract class BaseCache<TCache, TKey, TCachedObject>  where TCache : BaseCache<TCache, TKey, TCachedObject>, new()

Base class for caching objects in Modio.

Type Parameters

TCache: TKey: TCachedObject:

Property

int SearchesNotInCache

public static int SearchesNotInCache

int SearchesSavedByCache

public static  int SearchesSavedByCache
Method

Clear

public static void Clear()

Clears the cache.

GetCachedSearch

public static bool GetCachedSearch( SearchFilter filter, string searchKey, out TCachedObject[] cached, out long resultTotal )

Gets a cached search result based on the provided filter and search key.

Parameters

filter The filter to apply to the search. searchKey The key used to identify the cached search. cached The cached results of the search, if found. resultTotal The total number of results found for the search.

Returns

Returns true if the search results were found in the cache, otherwise false.

CacheSearch

public static void CacheSearch(string searchKey, TCachedObject[] cached, long pageIndex, long resultTotal)

Stores the search results in the cache.

Parameters

searchKey The key used to identify the cached search. cached The cached results of the search. pageIndex The index of the page of results. resultTotal The total number of results found for the search.

ClearCachedSearchCache

public static void ClearCachedSearchCache()

Clears the cached search results.

ConstructFilterKey

public static string ConstructFilterKey(SearchFilter filter)

Constructs a filter key based on the provided search filter.

Parameters

filter The filter to construct the key from.

Returns

A string representing the constructed filter key.


Modio.Collections

TypeDescription
ModCollection
ModCollectionStats

ModCollection

public class ModCollection : IModioInfo
Property

ModioId Id

public ModioId Id

get The collection id.

UserProfile Creator

public UserProfile Creator

get The user who submitted the collection.

DateTime DateUpdated

public DateTime DateUpdated

get The date the collection was last updated.

DateTime DateLive

public DateTime DateLive

get The date the collection went live.

ModMaturityOptions MaturityOptions

public ModMaturityOptions MaturityOptions

get The maturity options detected within this collection.

long ArchiveFilesize

public long ArchiveFilesize

get The total filesize of all mods in the collection.

long Filesize

public long Filesize

get The total uncompressed filesize of all mods in the collection.

ModTag Tags

public ModTag[] Tags

get The tags associated with the collection.

ModCollectionStats Stats

public ModCollectionStats Stats

get The stats of the collection.

public ModioImageSource<Mod.LogoResolution> Logo

get The logo of the collection.

string Name

public string Name

get The name of the collection.

string NameId

public string NameId

get The name id of the collection.

string Summary

public string Summary

The summary of the collection.

string Description

public string Description

get The description of the collection.

bool IsFollowed

public bool IsFollowed

get Whether the collection is followed by the user.

ModioRating CurrentUserRating

public ModioRating CurrentUserRating

get

Method

AddChangeListener

public static void AddChangeListener( ModCollectionChangeType subscribedChange, Action<ModCollection, ModCollectionChangeType> listener )

Adds an event handler to listen for whenever the ModCollectionChangeType of a collection is changed.

Remarks

ModCollectionChangeType is a bit flag, multiple changes can be listened for with one handler.

RemoveChangeListener

public static void RemoveChangeListener( ModCollectionChangeType subscribedChange, Action<ModCollection, ModCollectionChangeType> listener )

Removes an event handler that listens for changes to the ModCollectionChangeType of a collection.

Parameters

subscribedChange The type of change to unsubscribe from. listener The event handler to remove.

Remarks

This will only remove the handler if it was previously added with AddChangeListener.

GetCollections

public static async Task<(Error error, ModioPage<ModCollection> page)> GetCollections( ModioAPI.Collections.GetModCollectionsFilter filter )

Get

public static ModCollection Get(long id)

GetCollectionMods

public static async Task<(Error error, ModioPage<Mod> page)> GetCollectionMods( long collectionId, ModioAPI.Collections.GetCollectionModsFilter filter )

Gets all mods that qualify the provided ModioAPI.Collections.GetCollectionMods parameters.

Remarks

This will cache searches and results. If a search exists in the cache, this method will return those results. The ModioAPI.Collections.GetCollectionModsFilter is used to filter the results, allowing for pagination, sorting, and other search parameters.

GetMods

public async Task<(Error error, IReadOnlyList<Mod> results)> GetMods()

Gets all mods of the collection.

Returns

An asynchronous task that returns a tuple (Error error, IReadOnlyList{Mod} results), where: error is the error encountered during the task (if any) result is a readonly list of Mod in the collection.

Subscribe

public Task<Error> Subscribe()

Subscribe to all mods in this collection.

Returns

An Error indicating the success or failure of the operation.

Unsubscribe

public Task<Error> Unsubscribe()

Unsubscribe from all mods in this collection.

Returns

An Error indicating the success or failure of the operation.

Follow

public Task<Error> Follow()

Follow this collection.

Returns

An Error indicating the success or failure of the operation.

Unfollow

public Task<Error> Unfollow()

Unfollow this collection.

Returns

An Error indicating the success or failure of the operation.

Rate

public async Task<Error> Rate(ModioRating rating)

Rate this collection.

Parameters

rating The rating to give the collection.

Returns

An Error indicating the success or failure of the operation.

Report

public async Task<Error> Report(ReportType reportType, string contact, string summary)

ModCollectionStats

public class ModCollectionStats
Property

long CollectionId

public long CollectionId

get The collection id.

long ModsTotal

public long ModsTotal

get The total number of mods contained in this collection

long DownloadsToday

public long DownloadsToday

get The number of downloads today.

long UniqueDownloads

public long UniqueDownloads

get The number of unique downloads.

long Downloads

public long Downloads

get The total number of downloads.

long Followers

public long Followers

get The total number of followers.

long RatingsPositive

public long RatingsPositive

get The number of positive ratings in the last 30 days.

long RatingsPositive30Days

public long RatingsPositive30Days

get

long RatingsNegative

public long RatingsNegative

get

long RatingsNegative30Days

public long RatingsNegative30Days

get

float? RatingsPercent

public float? RatingsPercent

get


Enums

ModCollectionChangeType
IsFollowed         = 1 << 0
Rating            = 1 << 1
ModList          = 1 << 2
Everything        = ~0

Modio.Extensions

TypeDescription
DateTimeExtensions
LongExtensions
ModioResourceTypeExtensions
TaskExtensions

DateTimeExtensions

public static class DateTimeExtensions
Method

GetUtcDateTime

public static DateTime GetUtcDateTime(this long timeStamp)

GetLocalDateTime

public static DateTime GetLocalDateTime(this long timeStamp)

LongExtensions

public static class LongExtensions
Method

RoundTimestampToHour

public static long RoundTimestampToHour(this long timeStamp)

RoundTimestampsToHour

public static ICollection<long> RoundTimestampsToHour(this ICollection<long> timeStamps)

ModioResourceTypeExtensions

public static class ModioResourceTypeExtensions
Method

GetStringCode

public static string GetStringCode(this ModioResourceType resourceType)

TaskExtensions

public static class TaskExtensions
Method

ForgetTaskSafely

public static async void ForgetTaskSafely(this Task task)

Modio.FileIO

TypeDescription
BaseDataStorageSystemIO Implementation of IModioDataStorage
CRCComputingStreamWrapper
DefaultRootPathProvider
IModioDataStorageInterface for the platform file IO services
IModioRootPathProvider
LinuxDataStorage
MD5ComputingStreamWrapper
MacDataStorage
ModInstallProgressTracker
ModioDiskTestSettings
ModioZipInputStream
StreamSlice
WindowsRootPathProviderProvides a root path for windows
ZipHelperStreamExtensions

BaseDataStorage

public class BaseDataStorage : IModioDataStorage

SystemIO Implementation of IModioDataStorage

Method

Init

public virtual async Task<Error> Init()

Shutdown

public virtual async Task Shutdown()

DebugDeleteAllGameData

[ModioDebugMenu] public static void DebugDeleteAllGameData()

DeleteAllGameData

public Task<Error> DeleteAllGameData()

ReadGameData

public virtual Task<(Error error, GameData result)> ReadGameData()

WriteGameData

public virtual Task<Error> WriteGameData(GameData gameData)

DeleteGameData

public virtual Task<Error> DeleteGameData()

ReadIndexData

public virtual Task<(Error error, ModIndex index)> ReadIndexData()

WriteIndexData

public virtual Task<Error> WriteIndexData(ModIndex index)

DeleteIndexData

public virtual Task<Error> DeleteIndexData()

ReadUserData

public virtual Task<(Error error, UserSaveObject result)> ReadUserData(string localUserId)

WriteUserData

public virtual Task<Error> WriteUserData(UserSaveObject userObject)

DeleteUserData

public virtual Task<Error> DeleteUserData(string localUserId)

ReadAllSavedUserData

public virtual async Task<(Error error, UserSaveObject[] results)> ReadAllSavedUserData()

DownloadModFileFromStream

public virtual async Task<Error> DownloadModFileFromStream( long modId, long modfileId, Stream downloadStream, string md5Hash, CancellationToken token )

CalculateMd5Hash

public static async Task<byte[]> CalculateMd5Hash(string filePath, byte[] buffer)

Calculate a MD5 Hash

Parameters

filePath buffer

Returns

DeleteModfile

public virtual Task<Error> DeleteModfile(long modId, long modfileId)

ScanForModfiles

public virtual Task<(Error error, List<(long modId, long modfileId)> results)> ScanForModfiles()

InstallMod

public virtual async Task<Error> InstallMod(Mod mod, long modfileId, CancellationToken token)

InstallModFromStream

public virtual async Task<Error> InstallModFromStream( Mod mod, long modfileId, Stream stream, string md5Hash, CancellationToken token )

DeleteInstalledMod

public virtual Task<Error> DeleteInstalledMod(Mod mod, long modfileId)

ScanForInstalledMods

public virtual Task<(Error error, List<(long modId, long modfileId)> results)> ScanForInstalledMods()

ReadCachedImage

public virtual async Task<(Error error, byte[] result)> ReadCachedImage(Uri serverPath)

WriteCachedImage

public virtual async Task<Error> WriteCachedImage(Uri serverPath, byte[] data)

DeleteCachedImage

public virtual Task<Error> DeleteCachedImage(Uri serverPath)

IsThereAvailableFreeSpaceFor

public virtual Task<bool> IsThereAvailableFreeSpaceFor(long tempBytes, long persistentBytes)

IsThereAvailableFreeSpaceForModfile

public virtual Task<bool> IsThereAvailableFreeSpaceForModfile(long bytes)

GetAvailableFreeSpaceForModfile

public virtual Task<long> GetAvailableFreeSpaceForModfile()

IsThereAvailableFreeSpaceForModInstall

public virtual Task<bool> IsThereAvailableFreeSpaceForModInstall(long bytes)

GetAvailableFreeSpaceForModInstall

public virtual Task<long> GetAvailableFreeSpaceForModInstall()

GetModfilePath

public virtual string GetModfilePath(long modId, long modfileId)

GetInstallPath

public virtual string GetInstallPath(long modId, long modfileId) // Match V2 install path. Note that initial V3 versions put mods in an "Installed" directory; see MigrateLegacyModInstalls

DoesModfileExist

public virtual bool DoesModfileExist(long modId, long modfileId)

DoesInstallExist

public virtual bool DoesInstallExist(long modId, long modfileId)

CompressToZip

public virtual async Task<Error> CompressToZip(string filePath, Stream outputTo)

CompressToZipStream

public virtual async Task<(Error, Stream)> CompressToZipStream(string filePath, long modId)

CleanUpCompressToZipStream

public virtual Task CleanUpCompressToZipStream(long modId)

CRCComputingStreamWrapper

public class CRCComputingStreamWrapper : Stream
Property

bool CanRead

public override bool CanRead

bool CanWrite

public override bool CanWrite

bool CanSeek

public override bool CanSeek

long Length

public override long Length

long Position

public override long Position

get set

Method

ReadOnly

public static CRCComputingStreamWrapper ReadOnly(Stream baseStream, bool streamOwner

Creates a new instance of the CRCComputingStreamWrapper that computes CRC32 checksums for read operations.

Parameters

baseStream The base stream to wrap. streamOwner Indicates whether the CRCComputingStreamWrapper owns the base stream and should dispose of it when done.

Returns

The CRCComputingStreamWrapper instance.

Exceptions

ArgumentNullException:

WriteOnly

public static CRCComputingStreamWrapper WriteOnly(Stream baseStream, bool streamOwner

Creates a new instance of the CRCComputingStreamWrapper that computes CRC32 checksums for write operations.

Parameters

baseStream The base stream to wrap. streamOwner Indicates whether the CRCComputingStreamWrapper owns the base stream and should dispose of it when done.

Returns

The CRCComputingStreamWrapper instance.

Exceptions

ArgumentNullException:

Flush

public override void Flush()

GetCrcValue

public long GetCrcValue()

WriteAsync

public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)

Read

public override int Read(byte[] buffer, int offset, int count)

ReadAsync

public override async Task<int> ReadAsync( byte[] buffer, int offset, int count, CancellationToken cancellationToken )

Seek

public override long Seek(long offset, SeekOrigin origin)

SetLength

public override void SetLength(long value)

Write

public override void Write(byte[] buffer, int offset, int count)

DefaultRootPathProvider

public class DefaultRootPathProvider : IModioRootPathProvider
Property

string Path

public virtual string Path
Method

GetUserPath

public Task<string> GetUserPath()

IModioDataStorage

public interface IModioDataStorage

Interface for the platform file IO services


IModioRootPathProvider

public interface IModioRootPathProvider
Property

string Path

public string Path

get

Path of Mod Installs


LinuxDataStorage

public class LinuxDataStorage : BaseDataStorage

MD5ComputingStreamWrapper

public class MD5ComputingStreamWrapper : Stream
Property

int TotalBytesRead

public int TotalBytesRead

get

bool CanRead

public override bool CanRead

bool CanSeek

public override bool CanSeek

bool CanWrite

public override bool CanWrite

long Length

public override long Length

long Position

public override long Position

get set

Method

Flush

public override void Flush()

GetMD5HashAsync

public async Task<string> GetMD5HashAsync()

ReadAsync

public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)

Read

public override int Read(byte[] buffer, int offset, int count)

Seek

public override long Seek(long offset, SeekOrigin origin)

SetLength

public override void SetLength(long value)

Write

public override void Write(byte[] buffer, int offset, int count)

MacDataStorage

public class MacDataStorage : BaseDataStorage

ModInstallProgressTracker

public class ModInstallProgressTracker
Property

Func CurrentBytesGetter

public Func<long> CurrentBytesGetter

get set

Method

Update

public void Update()

SetBytesRead

public void SetBytesRead(long currentBytes)

ModioDiskTestSettings

public class ModioDiskTestSettings : IModioServiceSettings
Field

bool OverrideDiskSpaceRemaining

bool OverrideDiskSpaceRemaining

int BytesRemaining

int BytesRemaining

ModioZipInputStream

public class ModioZipInputStream : ZipInputStream
Property

long CentralDirectoryStreamOffset

public long CentralDirectoryStreamOffset

get

Method

GetNextEntryWithBackTrack

public ZipEntry GetNextEntryWithBackTrack()

ReadUntilEndAsync

public async Task ReadUntilEndAsync(CancellationToken token)

GetEocdEntries

public IReadOnlyList<ZipEntry> GetEocdEntries()

FindEndOfCentralRecordInfo

public void FindEndOfCentralRecordInfo(out long recordCount)

Read

public override int Read(byte[] buffer, int offset, int count)

StreamSlice

public class StreamSlice : Stream
Property

bool CanRead

public override bool CanRead

bool CanSeek

public override bool CanSeek

bool CanWrite

public override bool CanWrite

long Length

public override long Length

long Position

public override long Position

get set

Method

Flush

public override void Flush()

Read

public override int Read(byte[] buffer, int offset, int count)

Seek

public override long Seek(long offset, SeekOrigin origin)

SetLength

public override void SetLength(long value)

Write

public override void Write(byte[] buffer, int offset, int count)

WindowsRootPathProvider

public class WindowsRootPathProvider : IModioRootPathProvider

Provides a root path for windows

Property

string Path

public string Path

Path to the shared public folder;

Typically returns "C:\Users\Public"

Method

IsPublicEnvironmentVariableSet

public static bool IsPublicEnvironmentVariableSet()

Is the required environment variable set.

True if the environment variable "public" is set, false otherwise.

GetUserPath

public Task<string> GetUserPath()

Path to the local user app data folder;

Typically returns "C:\Users&lt;UserName>\AppData\Roaming"


ZipHelperStreamExtensions

public static class ZipHelperStreamExtensions

Modio.Mods

TypeDescription
GameData
GameTagCategory
IModioInfo
IModioResource
ModA mod.io mod. This is a mutable class that will be maintained and updated as more data arrives. See OnModUpdated & AddChangeListener for listening to these changes and updating UI elements accordingly.
ModDependencies
ModPlatform
ModSearchFilter
ModSku
ModStats
ModTag
Modfile
ModfileDownloadReference
ModioId
ModioPage

GameData

public class GameData
Field

GameTagCategory Categories

GameTagCategory[] Categories

string CurrencyName

string CurrencyName

GameCommunityOptions CommunityOptions

GameCommunityOptions CommunityOptions

GameMonetizationOptions MonetizationOptions

GameMonetizationOptions MonetizationOptions
Method

GetGameDataFromDisk

public static async Task<(Error error, GameData gameData)> GetGameDataFromDisk()

GetGameData

public static async Task<(Error error, GameData data)> GetGameData()

SetGameData

public static async Task<Error> SetGameData(GameData data)

Sets the game data, writing it to disk. If a write is already in progress, it will mark the data as dirty and wait for the current write to finish before writing again if necessary. This ensures that we don't have multiple concurrent writes to disk, which could cause issues.

Parameters

data The game data to set. This will be cached in memory and written to disk.

Returns

An error if the write failed, or Error.None if it succeeded.

SetGameTags

public static async Task<Error> SetGameTags(GameTagCategory[] tags)

GameTagCategory

public class GameTagCategory
Field

string Name

string Name

bool MultiSelect

bool MultiSelect

ModTag Tags

ModTag[] Tags

bool Locked

bool Locked
Property

bool Hidden

[JsonIgnore] public bool Hidden

get set

Should this tag category be hidden from users in all UI? Set on the mod.io website when configuring your game

bool TempHidden

[JsonIgnore] public bool TempHidden

set

Should this tag category be hidden for the user temporarily We use this when filtering the entire mods page for a particular search e.g. you want to have separate "maps" and "characters" pages using a tag filter, but don't want the tags to be visible on those pages

Method

GetGameTagOptions

public static async Task<(Error, GameTagCategory[])> GetGameTagOptions()

GetGameTagOptionsInternal

public static async Task<(Error, GameTagCategory[])> GetGameTagOptionsInternal()

GetCollectionTagOptions

public static Task<(Error, GameTagCategory[])> GetCollectionTagOptions()

Get the tags which are usable for collections. These are hardcoded and not changeable per game.


IModioInfo

public interface IModioInfo : IModioResource
Property

string Name

public string Name

get

string Summary

public string Summary

get

string Description

public string Description

get

DateTime DateLive

public DateTime DateLive

get

DateTime DateUpdated

public DateTime DateUpdated

get

ModTag Tags

public ModTag[] Tags

get

ModMaturityOptions MaturityOptions

public ModMaturityOptions MaturityOptions

get

ModioImageSource Logo

public ModioImageSource<Mod.LogoResolution> Logo

get

UserProfile Creator

public UserProfile Creator

get

ModioRating CurrentUserRating

public ModioRating CurrentUserRating

get

bool IsSubscribed

public bool IsSubscribed

get


IModioResource

public interface IModioResource
Property

ModioId Id

public ModioId Id

get


Mod

public class Mod : IModioInfo

A mod.io mod. This is a mutable class that will be maintained and updated as more data arrives. See OnModUpdated & AddChangeListener for listening to these changes and updating UI elements accordingly.

Property

ModioId Id

public ModioId Id

get

string Name

public string Name

get

string Summary

public string Summary

string Description

public string Description

get

DateTime DateLive

public DateTime DateLive

get

DateTime DateUpdated

public DateTime DateUpdated

get

ModTag Tags

public ModTag[] Tags

get

ModSku PortalSku

public ModSku PortalSku

get

string MetadataBlob

public string MetadataBlob

get

Dictionary MetadataKvps

public Dictionary<string,string> MetadataKvps

get

ModCommunityOptions CommunityOptions

public ModCommunityOptions CommunityOptions

get

ModMaturityOptions MaturityOptions

public ModMaturityOptions MaturityOptions

get

Modfile File

public Modfile File

get

ModPlatform SupportedPlatforms

public ModPlatform[] SupportedPlatforms

get

ModStats Stats

public ModStats Stats

get

long Price

public long Price

get

bool IsMonetized

public bool IsMonetized

get

ModioImageSource Logo

public ModioImageSource<LogoResolution> Logo

get

public ModioImageSource<GalleryResolution>[] Gallery

get

UserProfile Creator

public UserProfile Creator

get

ModDependencies Dependencies

public ModDependencies Dependencies

get

ModioRating CurrentUserRating

public ModioRating CurrentUserRating

get

bool IsSubscribed

public bool IsSubscribed

get

bool IsPurchased

public bool IsPurchased

get

bool IsEnabled

public bool IsEnabled

get set

bool IsCreated

public bool IsCreated

get

Is the mod a user creation for the currently authenticated user

string FiatPrice

public string FiatPrice

get set

Method

AddChangeListener

public static void AddChangeListener(ModChangeType subscribedChange, Action<Mod, ModChangeType> listener)

Adds an event handler to listen for whenever the ModChangeType of a mod is changed.

Remarks

ModChangeType is a bit flag, multiple changes can be listened for with one handler.

RemoveChangeListener

public static void RemoveChangeListener(ModChangeType subscribedChange, Action<Mod, ModChangeType> listener)

Create

public static ModBuilder Create()

Constructs a ModBuilder to use to create a new mod.

Remarks

Requires a ChangeFlags.Name, a ChangeFlags.Summary and a ChangeFlags.Logo to publish a new mod.

Edit

public ModBuilder Edit()

Constructs a ModBuilder to use to edit this mod.

Get

public static Mod Get(long id)

Subscribe

public Task<Error> Subscribe(bool includeDependencies

Unsubscribe

public Task<Error> Unsubscribe()

SetIsEnabled

public void SetIsEnabled(bool isEnabled)

GetMods

public static Task<(Error error, ModioPage<Mod> page)> GetMods(ModSearchFilter filter)

Gets all mods that qualify the provided ModSearchFilter parameters.

Remarks

This will cache searches and results. If a search exists in the cache, this method will return those results.

GetMods

public static async Task<(Error error, ModioPage<Mod> page)> GetMods(ModioAPI.Mods.GetModsFilter filter)

Gets all mods that qualify the provided ModioAPI.Mods.GetModsFilter parameters.

Remarks

This will cache searches and results. If a search exists in the cache, this method will return those results. The ModioAPI.Mods.GetModsFilter is more advanced than the ModSearchFilter and will allow more granularity.

GetModDetailsFromServer

public async Task<(Error error, Mod result)> GetModDetailsFromServer()

Gets this mod's details from the mod.io server and applies those details to this mod.

Returns

An Error with an Error Code if there was one.

GetMod

public static async Task<(Error error, Mod result)> GetMod(ModioId modId)

Gets a Mod from the mod.io server. Will check the cache if a concrete object has already been cached. If one has been cached, it will apply the details to the found concrete mod.

GetMods

public static async Task<(Error error, ICollection<Mod>)> GetMods(ICollection<long> neededModIds)

Gets all mods from a collection of IDs. Will intelligently check the cache for any present mods and only get the mods that're missing from the cache.

Parameters

neededModIds A collection of ModioIds or longs to get.

Remarks

This can be considered a method to guarantee that the mods are in the cache by completion of this task. Use this whenever you don't know if you'll have the mod data ready but need to be certain it's available.

Returns

A collection of Mods.

RateMod

public async Task<Error> RateMod(ModioRating rating)

Rate this mod as either a single positive, negative or no rating.

Report

public async Task<Error> Report( ReportType reportType, ModNotWorkingReason reportReason, string contact, string summary )

Reports this mod to mod.io. ReportType & ModNotWorkingReason for report reasons.

Purchase

public async Task<Error> Purchase(bool subscribeOnPurchase)

UninstallOtherUserMod

public void UninstallOtherUserMod()

Will enqueue this mod for uninstallation with ModInstallationManagement.

Remarks

If the mod is subscribed to, this operation will cancel and output a warning.

ToString

public override string ToString()
Enum
X320_Y180
X640_Y360
X1280_Y720
Original
X320_Y180
X1280_Y720
Original

ModDependencies

public class ModDependencies
Property

int Count

public int Count

get

bool HasDependencies

public bool HasDependencies

get

bool IsMapped

public bool IsMapped
Method

GetAllDependencies

public async Task<(Error error, IReadOnlyList<Mod> results)> GetAllDependencies()

Gets all dependencies of the dependent.

Returns

An asynchronous task that returns a tuple (Error error, IReadOnlyList{Mod} results), where: error is the error encountered during the task (if any) result is a readonly list of Mod dependencies.


ModPlatform

public class ModPlatform
Field

ModioAPI.Platform Platform

ModioAPI.Platform Platform

long ModfileLiveId

long ModfileLiveId
Method

GetModfile

public async Task<(Error, Modfile)> GetModfile()

ModSearchFilter

[Serializable] public class ModSearchFilter
Property

int PageIndex

public int PageIndex

get set

int PageSize

public int PageSize

get set

bool ShowMatureContent

public bool ShowMatureContent

get set

SearchFilterPlatformStatus PlatformStatus

public SearchFilterPlatformStatus PlatformStatus

get set

SortModsBy SortBy

public SortModsBy SortBy

get set

bool IsSortAscending

public bool IsSortAscending

get set

RevenueType RevenueType

public RevenueType RevenueType

get set

int TagAndCategoryCount

public int TagAndCategoryCount

int VisibleTagAndCategoryCount

public int VisibleTagAndCategoryCount
Method

AddSearchPhrase

public void AddSearchPhrase(string phrase, Filtering filtering

Adds a phrase into the filter to be used when filtering mods in a request.

Parameters

phrase the string to be added to the filter filtering (Optional) type of filter to be used with the text, defaults to Full text search

AddSearchPhrases

public void AddSearchPhrases(ICollection<string> phrase, Filtering filtering

ClearSearchPhrases

public void ClearSearchPhrases()

ClearSearchPhrases

public void ClearSearchPhrases(Filtering filtering)

GetSearchPhrase

public IList<string> GetSearchPhrase(Filtering filtering)

AddTag

public void AddTag(string tag)

Adds a tag to be used in filtering mods for a request.

Parameters

tag the tag to be added to the filter

See Also

ModTag GameTagCategory

AddTag

public void AddTag(ModTag tag)

Adds a tag to be used in filtering mods for a request.

Parameters

tag the tag to be added to the filter

See Also

ModTag GameTagCategory

AddTags

public void AddTags(IEnumerable<string> tags, ResourceTagType tagType

Adds multiple tags used in filtering mods for a request.

Parameters

tags the tags to be added to the filter tagType

See Also

GameTagCategory

AddTags

public void AddTags(IEnumerable<ModTag> tags)

Adds multiple tags used in filtering mods for a request.

Parameters

tags the tags to be added to the filter

See Also

ModTag GameTagCategory

ClearTags

public void ClearTags()

GetTags

public IReadOnlyList<ModTag> GetTags()

GetTagNames

public IReadOnlyList<string> GetTagNames()

AddCollectionCategory

public void AddCollectionCategory(string category)

GetCollectionCategory

public string GetCollectionCategory()

AddUser

public void AddUser(UserProfile user)

Adds a specific user to the filter, so that mods that were not created by the user (or other users added to the filter) will not be returned.

See Also

UserProfile

GetUsers

public IReadOnlyList<UserProfile> GetUsers()

GetModsFilter

public ModioAPI.Mods.GetModsFilter GetModsFilter()

Clone

public ModSearchFilter Clone()

ModSku

public class ModSku
Property

string Portal

public string Portal

get set

string Sku

public string Sku

get set

long Id

public long Id

get set

Method

Equals

public bool Equals(ModSku other)

Equals

public override bool Equals(object obj)

GetHashCode

public override int GetHashCode()

ModStats

public class ModStats
Property

long Subscribers

public long Subscribers

get

long Downloads

public long Downloads

get

long RatingsPositive

public long RatingsPositive

get

long RatingsNegative

public long RatingsNegative

get

long RatingsPercent

public long RatingsPercent

get


ModTag

public class ModTag
Field

string ApiName

string ApiName
Property

string NameLocalized

public string NameLocalized

get

bool IsVisible

[JsonIgnore] public bool IsVisible

get set

bool TempHidden

[JsonIgnore] public bool TempHidden

set

Should this tag be hidden for the user temporarily We use this when filtering the entire mods page for a particular search e.g. you want to have separate "maps" and "characters" pages using a tag filter, but don't want the tags to be visible on those pages

ResourceTagType TagType

public ResourceTagType TagType

get

int Count

public int Count

get set

Method

Get

public static ModTag Get(string tagName, ResourceTagType tagType

SetLocalizations

public void SetLocalizations(Dictionary<string,string> translations)

Modfile

public class Modfile
Property

long ModId

public long ModId

get

long Id

public long Id

get

long FileSize

public long FileSize

get

long ArchiveFileSize

public long ArchiveFileSize

get

string InstallLocation

public string InstallLocation

get set

string Version

public string Version

get

string MetadataBlob

public string MetadataBlob

get

ModFileState State

public ModFileState State

get set

Error FileStateErrorCause

public Error FileStateErrorCause

get set

float FileStateProgress

public float FileStateProgress

get set

long DownloadingBytesPerSecond

public long DownloadingBytesPerSecond

get set

ModfileDownloadReference Download

public ModfileDownloadReference Download

get

string Md5Hash

public string Md5Hash

get


ModfileDownloadReference

public struct ModfileDownloadReference
Field

string BinaryUrl

string BinaryUrl

DateTime ExpiresAfter

DateTime ExpiresAfter

ModioId

public readonly struct ModioId : IEquatable<ModioId>
Method

IsValid

public bool IsValid()

Equals

public override bool Equals(object obj)

GetHashCode

public override int GetHashCode()

ToString

public override string ToString()

Equals

public bool Equals(ModioId other)

ModioPage

public class ModioPage<T>
Field

T Data

T[] Data

int PageSize

int PageSize

long PageIndex

long PageIndex

long TotalSearchResults

long TotalSearchResults
Method

HasMoreResults

public bool HasMoreResults()

Enums

GameCommunityOptions
None              = 0
EnableComments    = 1
EnablePreviews    = 64
EnablePreviewUrls = 128
AllowNegativeRatings = 256
AllowDependencies = 1024

GameMonetizationOptions
Disabled       = 0
Monetized      = 1
Marketplace    = 2
PartnerProgram = 4
LimitedStock   = 8
ForcedLimited  = 16

ModChangeType
Modfile           = 1 << 0
IsEnabled         = 1 << 1
IsSubscribed      = 1 << 2
ModObject         = 1 << 3
DownloadProgress  = 1 << 4
FileState         = 1 << 5
Rating            = 1 << 6
IsPurchased         = 1 << 7
Generic           = 1 << 8
Dependencies      = 1 << 9
IsUserCreation    = 1 << 10
Everything        = ~0

ModCommunityOptions
None              = 0
EnableComments    = 1
EnablePreviews    = 64
EnablePreviewUrls = 128
AllowDependencies = 1024
AllowCollections = 132096

ModFileState
None

Mod has not been downloaded.

Queued

Mod has been queued for download & install.

Downloading

Mod is being downloaded for the first time.

Downloaded

Mod has been downloaded and is awaiting install.

Installing

Mod is downloaded and being installed.

Installed

Mod is installed.

Updating

Mod is installed and an update is being downloaded.

Uninstalling

Mod is being uninstalled.

FileOperationFailed

An operation failure has occured when installing/uninstalling this mod.


ModMaturityOptions
None     = 0
Alcohol  = 1
Drugs    = 2
Violence = 4
Explicit = 8

ModMonetizationOption
None = 0
Enabled = 1
Live = 2
EnablePartnerProgram = 4
EnableScarcity = 8

ResourceTagType
ModTag
CollectionCategory
CollectionTag

RevenueType
Free = 0
Paid = 1
FreeAndPaid = 2

SearchFilterPlatformStatus
None = 0
PendingOnly = 1
LiveAndPending = 2

SortModsBy

Category to be used in the ModSearchFilter for determining how mods should be filtered in a request.

Name
Price
Rating
Popular
Downloads
Subscribers
DateSubmitted

Modio.Images

TypeDescription
BaseImageCache
BaseImageCache
IExternalAvatarProviderService
ImageCacheBytes
ImageReferenceDownloadReference that contains the URL to download an image with. (DownloadReference is serializable with Unity's JsonUtility)
LazyImage
ModioImageSource

BaseImageCache

public abstract class BaseImageCache
Method

CacheToDisk

public static void CacheToDisk(ImageReference image, bool shouldCache)

BaseImageCache

public abstract class BaseImageCache<T> : BaseImageCache where T : class
Method

GetCachedImage

public T GetCachedImage(ImageReference uri)

DownloadImage

public Task<(Error errror, T image)> DownloadImage(ImageReference uri)

GetFirstCachedImage

public T GetFirstCachedImage(IEnumerable<ImageReference> imageReferences)

IExternalAvatarProviderService

public interface IExternalAvatarProviderService<TImage>

ImageCacheBytes

public class ImageCacheBytes : BaseImageCache<byte[]>
Field

ImageCacheBytes Instance

ImageCacheBytes Instance = new ImageCacheBytes()

ImageReference

[System.Serializable] public struct ImageReference : IEquatable<ImageReference>

DownloadReference that contains the URL to download an image with. (DownloadReference is serializable with Unity's JsonUtility)

Property

bool IsValid

public bool IsValid

Check if there is a valid url for this image. You may want to check this before using

Returns

true if the url isn't null

string Url

public string Url

get

Method

Equals

public bool Equals(ImageReference other)

Equals

public override bool Equals(object obj)

GetHashCode

public override int GetHashCode()

LazyImage

public class LazyImage<TImage> where TImage : class
Method

SetImage

public async void SetImage<T>(ModioImageSource<T> source, T resolution) where T : Enum

ModioImageSource

public class ModioImageSource<TResolution> where TResolution:Enum
Property

string FileName

public string FileName

get

Method

GetUri

public ImageReference GetUri(TResolution resolution)

GetAllReferences

public IEnumerable<ImageReference> GetAllReferences()

CacheLowestResolutionOnDisk

public void CacheLowestResolutionOnDisk(bool shouldCache)

Modio.Monetization

TypeDescription
IModioEntitlementService
IModioStorefrontService
IModioUsdMarketplaceServiceA service interface for handling USD marketplace operations.
IModioVirtualCurrencyProviderServiceUse this interface if the target platform supports purchasing Virtual Currency but requires it to display in UI in-game.
ModioFiatPrice
ModioVirtualCurrencyName
MonetizationSettings
PortalSku
PriceFormatter

IModioEntitlementService

public interface IModioEntitlementService
Method

SyncEntitlements

public Task<Error> SyncEntitlements();

IModioStorefrontService

public interface IModioStorefrontService
Method

OpenPlatformPurchaseFlow

public Task<Error> OpenPlatformPurchaseFlow();

IModioUsdMarketplaceService

public interface IModioUsdMarketplaceService

A service interface for handling USD marketplace operations.

Method

UpdateSkuCache

public Task<Error> UpdateSkuCache();

Update the local cache of SKUs for a portal

Returns

A tuple containing an error if the operation failed, and an array of PortalSku objects representing the updated SKU cache.


IModioVirtualCurrencyProviderService

public interface IModioVirtualCurrencyProviderService

Use this interface if the target platform supports purchasing Virtual Currency but requires it to display in UI in-game.

Method

GetCurrencyPackSkus

public Task<(Error error, PortalSku[] skus)> GetCurrencyPackSkus();

Retrieve a list of UserPortal specific SKUs that can be purchased.

OpenCheckoutFlow

public Task<Error> OpenCheckoutFlow(PortalSku sku);

Opens the target platform's checkout flow. This will open a separate UI window outside the game.

Parameters

sku The SKU being purchased.


ModioFiatPrice

public static class ModioFiatPrice
Method

FetchSkuCache

public static async Task<Error> FetchSkuCache(ModioAPI.Portal portal)

TryGetLocalPrice

public static void TryGetLocalPrice(Mod mod)

ModioVirtualCurrencyName

public class ModioVirtualCurrencyName
Method

GetVirtualCurrencyName

public static async Task<(Error error, string name)> GetVirtualCurrencyName()

MonetizationSettings

[Serializable] public class MonetizationSettings : IModioServiceSettings
Field

string CurrencyFallbackName

string CurrencyFallbackName = "Cogs"

ModioMonetizationType MonetizationType

ModioMonetizationType MonetizationType = ModioMonetizationType.VirtualCurrency

PortalSku

public struct PortalSku
Field

ModioAPI.Portal Portal

ModioAPI.Portal Portal

string Sku

string Sku

string Name

string Name

string FormattedPrice

string FormattedPrice

int Value

int Value

PriceFormatter

public static class PriceFormatter
Method

FormatPrice

[ExcludeFromCodeCoverage] public static string FormatPrice(string currency, double price)

Helps format a price based on currency code.

Parameters

currency The currency code. price The price amount.

Returns

Enums

ModioMonetizationType
VirtualCurrency = 0
UsdMarketplace = 1

Modio.Reports

TypeDescription
ReportResourceTypes

ReportResourceTypes

public static class ReportResourceTypes
Field

string GAMES

string GAMES = "games"

string MODS

string MODS = "mods"

string USERS

string USERS = "users"

string COLLECTIONS

string COLLECTIONS = "collections"

Enums

ModNotWorkingReason
None = 0
CrashesGame = 1
DoesNotLoad = 2
ConflictsWithOtherMods = 3
MissingDependencies = 4
InstallationIssues = 5
BuggyBehaviour = 6
IncompatibleWithGameVersion = 7
FileCorruption = 8

ReportType
Generic = 0
DMCA = 1
NotWorking = 2
RudeContent = 3
IllegalContent = 4
StolenContent = 5
FalseInformation = 6
Other = 7

Modio.Settings

TypeDescription
ModInstallationManagementSettings
ModioHiddenTagOverrideSettings
PortainerSettingsSupports mod.io's internal tests
TempModInstallationSettings

ModInstallationManagementSettings

[Serializable] public class ModInstallationManagementSettings : IModioServiceSettings
Field

bool AutoActivate

bool AutoActivate = true

ModioHiddenTagOverrideSettings

public class ModioHiddenTagOverrideSettings : IModioServiceSettings
Field

string HideTagCategories

string[] HideTagCategories

PortainerSettings

public class PortainerSettings : IModioServiceSettings

Supports mod.io's internal tests

Field

string Stack

string Stack

bool AlwaysReseed

bool AlwaysReseed

TempModInstallationSettings

[Serializable] public class TempModInstallationSettings : IModioServiceSettings
Field

int LifeTimeDays

int LifeTimeDays = 0

Modio.Users

TypeDescription
CachedEntitlement
ModCollectionRepository
ModRepository
User
UserProfileRepresents a particular mod.io user with their username, DownloadReferences for getting their avatar, as well as their language and timezone.
UserSaveObject
Wallet

CachedEntitlement

public struct CachedEntitlement
Field

long EntitlementType

long EntitlementType

string SkuId

string SkuId

ModCollectionRepository

public class ModCollectionRepository : IDisposable
Method

GetFollowed

public IEnumerable<ModCollection> GetFollowed()

IsFollowed

public bool IsFollowed(ModioId modId)

Dispose

public void Dispose()

ModRepository

public class ModRepository : IDisposable
Property

bool HasGotSubscriptions

public bool HasGotSubscriptions

get set

Method

GetCreatedMods

public IEnumerable<Mod> GetCreatedMods()

GetSubscribed

public IEnumerable<Mod> GetSubscribed()

GetPurchased

public IEnumerable<Mod> GetPurchased()

GetDisabled

public IEnumerable<Mod> GetDisabled()

RemoveMod

public void RemoveMod(Mod mod)

IsSubscribed

public bool IsSubscribed(ModioId modId)

IsDisabled

public bool IsDisabled(ModioId modId)

IsPurchased

public bool IsPurchased(ModioId modId)

Dispose

public void Dispose()

User

public class User
Property

User Current

public static User Current

get

string LocalUserId

public string LocalUserId

get

long UserId

public long UserId

bool IsInitialized

public bool IsInitialized

get

bool HasAcceptedTermsOfUse

public bool HasAcceptedTermsOfUse

get

bool IsAuthenticated

public bool IsAuthenticated

get

bool IsUpdating

public bool IsUpdating

get

UserProfile Profile

public UserProfile Profile

get

Wallet Wallet

public Wallet Wallet

get

ModRepository ModRepository

public ModRepository ModRepository

get

ModCollectionRepository ModCollectionRepository

public ModCollectionRepository ModCollectionRepository

get

ModioAPI.Portal AuthenticatedPortal

public ModioAPI.Portal AuthenticatedPortal

get

Method

InitializeNewUser

public static async Task InitializeNewUser()

OnAuthenticated

public void OnAuthenticated(string oAuthToken, long dateExpires, bool sync

ApplyAuthenticationAsync

public async Task ApplyAuthenticationAsync(string oAuthToken, bool sync)

Sync

public async Task<Error> Sync()

Syncs the user profile, subscriptions, purchases, wallet, ratings and entitlements with changes made from the Web Interface.

Returns

An asynchronous task that returns Error.Error.None on success.

SyncProfile

public async Task<Error> SyncProfile()

Syncs the user profile with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

SyncSubscriptions

public async Task<Error> SyncSubscriptions()

Syncs the user subscriptions with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

SyncPurchases

public async Task<Error> SyncPurchases()

Syncs the user purchases with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

SyncCollections

public async Task<Error> SyncCollections()

Syncs the user collections with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

SyncEntitlements

public async Task<Error> SyncEntitlements()

Syncs the user entitlements with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

SyncWallet

public async Task<Error> SyncWallet()

Syncs the user wallet with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

SyncModRatings

public async Task<Error> SyncModRatings()

Syncs the user ratings with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

SyncCollectionRatings

public async Task<Error> SyncCollectionRatings()

Syncs the user ratings with changes made on the WebInterface

Returns

An asynchronous task that returns Error.Error.None on success.

GetMutedUsers

public async Task<(Error error, IReadOnlyList<UserProfile> results)> GetMutedUsers()

Gets all users muted by the currently authenticated User from the API.

Returns

An asynchronous task that returns a tuple (Error error, IReadOnlyList{UserProfile} results), where: error is the error encountered during the task (if any) result is a readonly list of muted users UserProfile.

Remarks

All API requests and Mod requests will already filter out any entries by muted users. This will not cache any data. Please use sparingly.

SyncUserCreations

public async Task<Error> SyncUserCreations()

GetUserCreations

public async Task<(Error error, IReadOnlyList<Mod> mods)> GetUserCreations(bool filterForGame

Gets all mod creations by the User from the API.

Parameters

filterForGame Optionally filter to only receive mods made for the current GameId

Returns

An asynchronous task that returns a tuple (Error error, IReadOnlyList{Mod} results), where: error is the error encountered during the task (if any) result is a readonly list of Mods created by this user.

GetUserCreationsPaged

public Task<(Error error, ModioPage<Mod> page)> GetUserCreationsPaged( ModioAPI.Mods.GetModsFilter modsFilter, bool filterForGame

Get all creations by the user. This does cache results

GetUserCreationsPaged

public async Task<(Error error, ModioPage<Mod> page)> GetUserCreationsPaged(ModioAPI.Me.GetUserModsFilter filter, bool filterForGame

Get all creations by the user. This does cache results

SyncUsersFollowers

public async Task<(Error error, IReadOnlyList<UserProfile> results)> SyncUsersFollowers()

Gets all users following the currently authenticated User from the API.

Returns

An asynchronous task that returns a tuple (Error error, IReadOnlyList{UserProfile} results), where:

SyncUsersFollowing

public async Task<(Error error, IReadOnlyList<UserProfile> results)> SyncUsersFollowing()

Gets all users that the currently authenticated User is following from the API.

Returns

An asynchronous task that returns a tuple (Error error, IReadOnlyList{UserProfile} results), where:

FollowUser

public async Task<Error> FollowUser(UserProfile user)

UnfollowUser

public async Task<Error> UnfollowUser(UserProfile user)

TryGetRating

public bool TryGetRating(ModioId id, ModioResourceType resourceType, out ModioRating rating)

DeleteUserData

[ModioDebugMenu(ShowInBrowserMenu = false, ShowInSettingsMenu = true)] public static void DeleteUserData()

Removes the User and associated authentication and caches from this device.

LogOut

public static void LogOut()

Logs out the current User without deleting any associated data stored on this device.

InvalidateAuthToken

[ModioDebugMenu(ShowInBrowserMenu = true, ShowInSettingsMenu = false)] public static void InvalidateAuthToken()

Sets the current user's auth token to an invalid value Used for testing error handling


UserProfile

[System.Serializable] public class UserProfile : IEquatable<UserProfile>, IModioResource

Represents a particular mod.io user with their username, DownloadReferences for getting their avatar, as well as their language and timezone.

Property

string Username

public string Username

get set

The display name of the user's mod.io account

ModioId UserId

public ModioId UserId

get set

This is the unique Id of the user.

string PortalUsername

public string PortalUsername

get

The display name of the user's account they authenticated with. Eg if they authenticated with Steam it would be their Steam username.

ModioImageSource Avatar

public ModioImageSource<AvatarResolution> Avatar

get

string Timezone

public string Timezone

get

string Language

public string Language

get

bool IsFollowedByLoggedInUser

public bool IsFollowedByLoggedInUser

get

Method

GetHashCode

public override int GetHashCode()

Equals

public bool Equals(UserProfile other)

Equals

public override bool Equals(object obj)

Mute

public async Task<Error> Mute()

UnMute

public async Task<Error> UnMute()

Report

public async Task<Error> Report(ReportType reportType, string contact, string summary)

Follow

public Task<Error> Follow()

Follow this user by the currently logged in user.

Unfollow

public Task<Error> Unfollow()

Unfollow this user by the currently logged in user.

Enum
X50_Y50
X100_Y100
Original

UserSaveObject

[Serializable] public class UserSaveObject
Field

string LocalUserId

string LocalUserId

string Username

string Username

long UserId

long UserId

string AuthToken

string AuthToken

List SubscribedMods

List<long> SubscribedMods

List DisabledMods

List<long> DisabledMods

List PurchasedMods

List<long> PurchasedMods

List FollowedCollections

List<long> FollowedCollections

int UserPortal

int UserPortal

Wallet

public class Wallet
Property

string Type

public string Type

get

string Currency

public string Currency

get

long Balance

public long Balance

get