Last change
on this file since 430 was 404, checked in by alloc, 22 months ago |
Latest state including reworking to the permissions system
|
File size:
831 bytes
|
Rev | Line | |
---|
[404] | 1 | using System.Reflection;
|
---|
| 2 | using HarmonyLib;
|
---|
[391] | 3 | using JetBrains.Annotations;
|
---|
| 4 | using Webserver.UrlHandlers;
|
---|
| 5 |
|
---|
| 6 | namespace Webserver {
|
---|
| 7 | [UsedImplicitly]
|
---|
| 8 | public class ModApi : IModApi {
|
---|
| 9 | private Web webInstance;
|
---|
| 10 | private Mod modInstance;
|
---|
| 11 |
|
---|
| 12 | public void InitMod (Mod _modInstance) {
|
---|
| 13 | ModEvents.GameStartDone.RegisterHandler (GameStartDone);
|
---|
| 14 | ModEvents.GameShutdown.RegisterHandler (GameShutdown);
|
---|
| 15 | modInstance = _modInstance;
|
---|
[404] | 16 |
|
---|
| 17 | Harmony.CreateAndPatchAll (Assembly.GetExecutingAssembly ());
|
---|
[391] | 18 | }
|
---|
| 19 |
|
---|
| 20 | private void GameStartDone () {
|
---|
| 21 | if (!ConnectionManager.Instance.IsServer) {
|
---|
| 22 | return;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | webInstance = new Web (modInstance.Path);
|
---|
| 26 | LogBuffer.Init ();
|
---|
| 27 |
|
---|
| 28 | if (ItemIconHandler.Instance != null) {
|
---|
| 29 | ItemIconHandler.Instance.LoadIcons ();
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | private void GameShutdown () {
|
---|
| 34 | webInstance?.Shutdown ();
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.