mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-18 02:09:37 -06:00
Merge pull request #10 from rmroc451/2-investigate-settings-instantiation-issues
fix #2
This commit is contained in:
@@ -102,7 +102,6 @@ public class ExpandedConsole_Add_Patch
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, ex.Message);
|
Log.Error(ex, ex.Message);
|
||||||
entry.Text += ex.ToString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ public class Settings
|
|||||||
{
|
{
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{}
|
{
|
||||||
|
WebhookSettingsList = new[] { new WebhookSettings() }.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public Settings(
|
public Settings(
|
||||||
WebhookSettings webhookSettings,
|
|
||||||
List<WebhookSettings> webhookSettingsList,
|
List<WebhookSettings> webhookSettingsList,
|
||||||
bool handBrakeAndAirTagModifiers
|
bool handBrakeAndAirTagModifiers
|
||||||
)
|
)
|
||||||
@@ -29,7 +30,11 @@ public class Settings
|
|||||||
|
|
||||||
internal void AddAnotherRow()
|
internal void AddAnotherRow()
|
||||||
{
|
{
|
||||||
//if (!string.IsNullOrEmpty(WebhookSettingsList.Last().WebhookUrl)) WebhookSettingsList.Add(new());
|
if (!string.IsNullOrEmpty(WebhookSettingsList.Last().WebhookUrl))
|
||||||
|
{
|
||||||
|
WebhookSettingsList.Add(new());
|
||||||
|
Log.Information($"Adding another {nameof(WebhookSettings)} list entry, last one was filled in");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
using GalaSoft.MvvmLight.Messaging;
|
using GalaSoft.MvvmLight.Messaging;
|
||||||
using Game.Messages;
|
|
||||||
using Game.State;
|
using Game.State;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Railloader;
|
using Railloader;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Debugging;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using TweaksAndThings.Commands;
|
|
||||||
using UI.Builder;
|
using UI.Builder;
|
||||||
using UI.CarInspector;
|
|
||||||
|
|
||||||
namespace TweaksAndThings
|
namespace TweaksAndThings
|
||||||
{
|
{
|
||||||
@@ -48,6 +43,11 @@ namespace TweaksAndThings
|
|||||||
//moddingContext.RegisterConsoleCommand(new EchoCommand());
|
//moddingContext.RegisterConsoleCommand(new EchoCommand());
|
||||||
|
|
||||||
settings = moddingContext.LoadSettingsData<Settings>(self.Id);
|
settings = moddingContext.LoadSettingsData<Settings>(self.Id);
|
||||||
|
if (settings.WebhookSettingsList?.Any() ?? false)
|
||||||
|
{
|
||||||
|
settings.WebhookSettingsList = new[] { new WebhookSettings() }.ToList();
|
||||||
|
this.moddingContext.SaveSettingsData(this.modDefinition.Id, settings ?? new());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEnable()
|
public override void OnEnable()
|
||||||
|
|||||||
Reference in New Issue
Block a user