Merge branch 'sp-tarkov:main' into main
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@ using Core.DI;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Request;
|
||||
using Core.Models.Eft.Dialog;
|
||||
using Core.Models.Eft.HttpResponse;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Utils;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnUpdateOrder.DialogCallbacks)]
|
||||
public class DialogCallbacks : OnUpdate
|
||||
{
|
||||
protected HashUtil _hashUtil;
|
||||
|
||||
@@ -10,7 +10,7 @@ using Core.Utils;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.GameCallbacks)]
|
||||
public class GameCallbacks : OnLoad
|
||||
{
|
||||
protected HttpResponseUtil _httpResponseUtil;
|
||||
|
||||
@@ -4,7 +4,7 @@ using Core.DI;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.HandbookCallbacks)]
|
||||
public class HandbookCallbacks : OnLoad
|
||||
{
|
||||
protected HandBookController _handBookController;
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using ILogger = Core.Models.Utils.ILogger;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.ModCallbacks)]
|
||||
public class ModCallbacks : OnLoad
|
||||
{
|
||||
protected ILogger _logger;
|
||||
|
||||
@@ -4,7 +4,7 @@ using Core.DI;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.PresetCallbacks)]
|
||||
public class PresetCallbacks : OnLoad
|
||||
{
|
||||
protected PresetController _presetController;
|
||||
|
||||
@@ -13,7 +13,7 @@ using Core.Utils;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.RagfairCallbacks)]
|
||||
public class RagfairCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
protected HttpResponseUtil _httpResponseUtil;
|
||||
|
||||
@@ -7,7 +7,7 @@ using Core.Services;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.SaveCallbacks)]
|
||||
public class SaveCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
protected SaveServer _saveServer;
|
||||
|
||||
@@ -11,7 +11,7 @@ using Core.Utils;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
[Injectable(TypePriority = OnLoadOrder.TraderCallbacks)]
|
||||
public class TraderCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
protected HttpResponseUtil _httpResponseUtil;
|
||||
|
||||
@@ -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