forked from knah/VRCMods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
StyletorApi.cs
36 lines (33 loc) · 1.36 KB
/
StyletorApi.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.IO;
namespace Styletor.API
{
/// <summary>
/// Provides an API for other mods to be used
/// Be aware that Styletor is GPLv3 (unlike UI Expansion Kit, which is LGPLv3), so your mod has to be provided under a GPL-compatible license (so [a]GPLv3) to use these in any form
/// Check README for another way to provide styles embedded in a mod without using these
/// </summary>
public static class StyletorApi
{
internal static readonly List<Func<IEnumerable<KeyValuePair<string, Stream>>>> StyleProviders = new();
/// <summary>
/// Registers the given style provider.
/// The provided Func should return an enumerable with named ZIP file streams with styles
/// Streams returned will be closed by Styletor
/// This Func can be called at any time when styles are being reloaded
/// </summary>
public static void RegisterStylesProvider(Func<IEnumerable<KeyValuePair<string, Stream>>> zipStyleStreams)
{
StyleProviders.Add(zipStyleStreams);
ReloadStyles();
}
/// <summary>
/// Reloads all styles, including styles on disk and style providers
/// </summary>
public static void ReloadStyles()
{
StyletorMod.Instance.ReloadStyles();
}
}
}