smol stuff
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace Core.Annotations;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public class Injectable(InjectionType injectionType = InjectionType.Scoped, Type? type = null, int typePriority = int.MaxValue) : Attribute
|
||||
{
|
||||
public InjectionType InjectionType { get; set; } = injectionType;
|
||||
@@ -13,4 +13,4 @@ public enum InjectionType
|
||||
Singleton,
|
||||
Transient,
|
||||
Scoped
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Dialog;
|
||||
@@ -7,6 +8,7 @@ using Core.Models.Eft.Profile;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(TypePriority = OnUpdateOrder.DialogCallbacks)]
|
||||
public class DialogCallbacks : OnUpdate
|
||||
{
|
||||
public DialogCallbacks()
|
||||
@@ -304,4 +306,4 @@ public class DialogCallbacks : OnUpdate
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Game;
|
||||
@@ -6,6 +7,7 @@ using Core.Models.Eft.HttpResponse;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(TypePriority = OnLoadOrder.GameCallbacks)]
|
||||
public class GameCallbacks : OnLoad
|
||||
{
|
||||
public GameCallbacks()
|
||||
@@ -202,4 +204,4 @@ public class GameCallbacks : OnLoad
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(TypePriority = OnLoadOrder.HandbookCallbacks)]
|
||||
public class HandbookCallbacks : OnLoad
|
||||
{
|
||||
public HandbookCallbacks()
|
||||
@@ -17,4 +19,4 @@ public class HandbookCallbacks : OnLoad
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using Core.Servers;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectionType.Singleton, typePriority: 1)]
|
||||
[Injectable(InjectionType.Singleton, typePriority: OnLoadOrder.HttpCallbacks)]
|
||||
public class HttpCallbacks : OnLoad
|
||||
{
|
||||
private readonly HttpServer _httpServer;
|
||||
@@ -31,4 +31,4 @@ public class HttpCallbacks : OnLoad
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(TypePriority = OnLoadOrder.ModCallbacks)]
|
||||
public class ModCallbacks : OnLoad
|
||||
{
|
||||
public ModCallbacks()
|
||||
@@ -17,4 +19,4 @@ public class ModCallbacks : OnLoad
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(TypePriority = OnLoadOrder.PresetCallbacks)]
|
||||
public class PresetCallbacks : OnLoad
|
||||
{
|
||||
public PresetCallbacks()
|
||||
@@ -17,4 +19,4 @@ public class PresetCallbacks : OnLoad
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.HttpResponse;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
@@ -7,6 +8,7 @@ using Core.Models.Spt.Config;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(TypePriority = OnLoadOrder.RagfairCallbacks)]
|
||||
public class RagfairCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
private RagfairConfig _ragfairConfig;
|
||||
@@ -140,4 +142,4 @@ public class RagfairCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using Core.Services;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.SaveCallbacks)]
|
||||
public class SaveCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
protected SaveServer _saveServer;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Eft.HttpResponse;
|
||||
@@ -6,6 +7,7 @@ using Core.Models.Spt.Config;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(TypePriority = OnLoadOrder.TraderCallbacks)]
|
||||
public class TraderCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
public TraderCallbacks()
|
||||
@@ -78,4 +80,4 @@ public class TraderCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,5 +17,6 @@ public enum ContextVariableType
|
||||
|
||||
/** Data returned from client request object from endLocalRaid() */
|
||||
TRANSIT_INFO = 5,
|
||||
APP_BUILDER = 6
|
||||
}
|
||||
APP_BUILDER = 6,
|
||||
LOADED_MOD_ASSEMBLIES = 6
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Core.DI;
|
||||
|
||||
public static class OnLoadOrder
|
||||
{
|
||||
public const int Database = 0;
|
||||
public const int PostDBModLoader = 1;
|
||||
public const int HandbookCallbacks = 2;
|
||||
public const int HttpCallbacks = 3;
|
||||
public const int PresetCallbacks = 4;
|
||||
public const int SaveCallbacks = 5;
|
||||
public const int TraderCallbacks = 6;
|
||||
public const int RagfairPriceService = 7;
|
||||
public const int RagfairCallbacks = 8;
|
||||
public const int ModCallbacks = 9;
|
||||
public const int GameCallbacks = 10;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Core.DI;
|
||||
|
||||
public static class OnUpdateOrder
|
||||
{
|
||||
public const int DialogCallbacks = 0;
|
||||
public const int PostDBModLoader = 1;
|
||||
public const int HandbookCallbacks = 2;
|
||||
public const int HttpCallbacks = 3;
|
||||
public const int PresetCallbacks = 4;
|
||||
public const int SaveCallbacks = 5;
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace Core.Models.External;
|
||||
|
||||
public interface IPostDBLoadMod
|
||||
{
|
||||
void PostDBLoad();
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace Core.Models.External;
|
||||
|
||||
public interface IPostSptLoadMod
|
||||
{
|
||||
void PostSptLoad();
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace Core.Models.External;
|
||||
|
||||
public interface IPreSptLoadMod
|
||||
{
|
||||
void PreSptLoad();
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using ILogger = Core.Models.Utils.ILogger;
|
||||
|
||||
namespace Core.Utils;
|
||||
|
||||
[Injectable(InjectionType.Singleton, typePriority: 0)]
|
||||
[Injectable(InjectionType.Singleton, TypePriority = OnLoadOrder.Database)]
|
||||
public class DatabaseImporter : OnLoad
|
||||
{
|
||||
private object hashedFile;
|
||||
|
||||
+1
-1
@@ -18,13 +18,13 @@ public static class Program
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var serviceProvider = builder.Services.BuildServiceProvider();
|
||||
var watermark = serviceProvider.GetService<Watermark>();
|
||||
watermark.Initialize();
|
||||
// TODO: var preSptModLoader = serviceProvider.GetService<PreSptModLoader>();
|
||||
var app = serviceProvider.GetService<App>();
|
||||
var appContext = serviceProvider.GetService<ApplicationContext>();
|
||||
appContext.AddValue(ContextVariableType.LOADED_MOD_ASSEMBLIES, assemblies);
|
||||
appContext.AddValue(ContextVariableType.APP_BUILDER, builder);
|
||||
app.Load().Wait();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user