mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
bugfixes
- fix race condition on SetProduct - properly create ModdingService singleton on startup - remove debug print
This commit is contained in:
parent
08b5239880
commit
d8b996c6d7
@ -69,7 +69,7 @@ public class ContentController : Controller {
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
//[Produces("application/xml")]
|
//[Produces("application/xml")]
|
||||||
[Route("ContentWebService.asmx/SetProduct")] // used by World Of Jumpstart
|
[Route("ContentWebService.asmx/SetProduct")] // used by World Of Jumpstart
|
||||||
[VikingSession]
|
[VikingSession(UseLock=true)]
|
||||||
public bool SetProduct(Viking viking, [FromForm] string contentXml, [FromForm] string apiKey) {
|
public bool SetProduct(Viking viking, [FromForm] string contentXml, [FromForm] string apiKey) {
|
||||||
Util.SavedData.Set(
|
Util.SavedData.Set(
|
||||||
viking,
|
viking,
|
||||||
|
@ -21,7 +21,9 @@ builder.Services.AddControllers(options => {
|
|||||||
});
|
});
|
||||||
builder.Services.AddDbContext<DBContext>();
|
builder.Services.AddDbContext<DBContext>();
|
||||||
|
|
||||||
builder.Services.AddSingleton<ModdingService>();
|
// create Modding Service singleton here ... do this before start http server to avoid serve invalid assets list
|
||||||
|
builder.Services.AddSingleton<ModdingService>(new ModdingService());
|
||||||
|
// other singletons will be created at first use ...
|
||||||
builder.Services.AddSingleton<MissionStoreSingleton>();
|
builder.Services.AddSingleton<MissionStoreSingleton>();
|
||||||
builder.Services.AddSingleton<AchievementStoreSingleton>();
|
builder.Services.AddSingleton<AchievementStoreSingleton>();
|
||||||
builder.Services.AddSingleton<ItemService>();
|
builder.Services.AddSingleton<ItemService>();
|
||||||
@ -53,10 +55,6 @@ using var scope = app.Services.CreateScope();
|
|||||||
|
|
||||||
scope.ServiceProvider.GetRequiredService<DBContext>().Database.EnsureCreated();
|
scope.ServiceProvider.GetRequiredService<DBContext>().Database.EnsureCreated();
|
||||||
|
|
||||||
// create Modding Service singleton ... do this before start http server to avoid serve invalid assets list
|
|
||||||
|
|
||||||
new ModdingService();
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|
||||||
if (assetServer)
|
if (assetServer)
|
||||||
|
@ -7,7 +7,6 @@ public class SavedData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void Set(Viking viking, uint saveId, string? contentXml) {
|
public static void Set(Viking viking, uint saveId, string? contentXml) {
|
||||||
Console.WriteLine($"\n\n{saveId} {contentXml}\n");
|
|
||||||
Model.SavedData? savedData = viking.SavedData.FirstOrDefault(s => s.SaveId == saveId);
|
Model.SavedData? savedData = viking.SavedData.FirstOrDefault(s => s.SaveId == saveId);
|
||||||
if (savedData is null) {
|
if (savedData is null) {
|
||||||
savedData = new() {
|
savedData = new() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user