Skip to content

Commit

Permalink
Fix migration logger name in release build
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoooi0 committed Jun 17, 2024
1 parent 74a2972 commit c15562b
Show file tree
Hide file tree
Showing 42 changed files with 7 additions and 84 deletions.
9 changes: 7 additions & 2 deletions Source/MultiFunPlayer/Settings/ISettingsMigration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ internal interface ISettingsMigration
internal abstract class AbstractSettingsMigration : JsonEditor, ISettingsMigration
{
public int TargetVersion { get; }
protected abstract Logger Logger { get; }
protected Logger Logger { get; }

protected AbstractSettingsMigration()
{
TargetVersion = int.Parse(GetType().Name[^4..]);
Logger = LogManager.GetLogger(GetType().FullName);
}

protected AbstractSettingsMigration() => TargetVersion = int.Parse(GetType().Name[^4..]);
protected abstract void InternalMigrate(JObject settings);

protected override void Log(LogLevel level, string message, params object[] args)
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0001.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0001 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
if (TrySelectObject(settings, "$.OutputTarget.Serial", out var serial)
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0002.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0002 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPaths(settings, new Dictionary<string, string>()
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0003.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0003 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
if (!TryGetValue<JObject>(settings, "OutputTarget", out var outputTargets))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0004.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0004 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
var regex = new Regex(@"^(Buttplug\.io|Network|Pipe|Serial)::");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0005.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0005 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
EditPropertiesByPath(settings, "$.Script.VideoPathModifiers[*].$type",
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0006.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0006 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
foreach (var action in SelectObjects(settings, "$.Shortcuts.Bindings[*].Actions[?(@.Descriptor =~ /Axis::SmartLimitEnabled::Set.*/i)]"))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0007.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0007 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPaths(settings, new Dictionary<string, string>()
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0008.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0008 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertyByPath(settings,
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0009.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0009 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
var defaultDevices = DeviceSettings.DefaultDevices.ToList();
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0010.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0010 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
var items = new string[] { "DeoVR", "HereSphere", "Internal", "MPC-HC", "MPV", "Whirligig" };
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0011.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0011 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
var prefixMap = new Dictionary<string, string>();
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0012.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0012 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
SetPropertiesByPath(settings,
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0013.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0013 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPath(settings, "$.Devices[*].Default", "IsDefault");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0014.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0014 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
foreach (var deviceSettings in SelectObjects(settings, "$.OutputTarget.Items[?(@.$type =~ /.*ButtplugOutputTargetViewModel.*/)].DeviceSettings[*]"))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0015.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0015 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
foreach (var axisSettings in SelectObjects(settings, "$.Script.AxisSettings.*"))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0016.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0016 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
foreach (var binding in SelectObjects(settings, "$.Shortcuts.Bindings[*]"))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0017.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0017 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
foreach (var output in SelectObjects(settings, "$.OutputTarget.Items[?(@.$type =~ /.*FileOutputTargetViewModel.*/i)]"))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0018.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0018 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPath(settings, "$.Script.AxisSettings.*.InvertScript", "InvertValue");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0019.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0019 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPath(settings, "$.Shortcuts.Bindings[*].Actions[*].Descriptor", "Name");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0020.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0020 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
ModifyPropertiesByPath(settings, "$.Shortcuts.Bindings[?(@.Gesture.$type =~ /.*GamepadButtonGestureDescriptor.*/i)].Gesture.Button", property =>
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0021.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0021 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
var _replaceMap = new Dictionary<string, string>()
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0022.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0022 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
if (!TrySelectProperty(settings, "$.Script.ScriptLibraries", out var scriptLibraries))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0023.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0023 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
if (!TrySelectObject(settings, "$.Script.Repositories.Local", out var localRepository))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0024.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0024 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
var migrations = new Dictionary<string, string>()
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0025.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0025 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RemovePropertyByPath(settings, "$.LogBlacklist.['MultiFunPlayer.UI.Controls.ViewModels.ShortcutSettingsViewModel']");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0026.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0026 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertyByPath(settings, "$.Script.HeatmapShowStrokeLength", "HeatmapShowRange");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0027.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0027 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertyByName(settings, "Shortcuts", "Shortcut");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0028.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0028 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RemovePropertiesByPaths(settings, [
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0029.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0029 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
var updateContextPropertyMap = new Dictionary<string, string[]>()
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0030.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0030 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
EditPropertiesByPath(settings, "$.Devices[?(@.IsDefault == false)].Axes[?(@.Name == 'L0')].FunscriptNames", v =>
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0031.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0031 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
foreach (var axisSettings in SelectObjects(settings, "$.Devices[?(@.IsDefault == false)].Axes[*]"))
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0032.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0032 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
if (!TryGetValue<JValue>(settings, "SelectedDevice", out var selectedDeviceName)
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0033.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0033 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
SetPropertyByPath(settings, "$.MediaSource.MPV.AutoStartEnabled", true);
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0034.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0034 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPath(settings, "$.Script.AxisSettings.*.MaximumSecondsPerStroke", "SpeedLimitUnitsPerSecond");
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0035.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0035 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
EditPropertiesByPath(settings, "$.Shortcut.Shortcuts[*].Actions[?(@.Name =~ /Axis::Range::.*/i)].Settings[?(@.$type=~ /System\\.Int32.*/i)].$type",
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0036.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0036 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
EditPropertiesByPaths(settings, [
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0037.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0037 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
EditPropertyByPath(settings, "$.Script.AutoSkipToScriptStartOffset", v =>
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0038.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0038 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPaths(settings, new Dictionary<string, string>
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0039.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0039 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RenamePropertiesByPaths(settings, new Dictionary<string, string>
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0040.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0040 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
EditPropertiesByPath(settings, "$.Devices[?(@.IsDefault == false)].Axes[?(@.Name == 'L0')].FunscriptNames", v =>
Expand Down
2 changes: 0 additions & 2 deletions Source/MultiFunPlayer/Settings/Migrations/Migration0041.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace MultiFunPlayer.Settings.Migrations;

internal sealed class Migration0041 : AbstractSettingsMigration
{
protected override Logger Logger { get; } = LogManager.GetCurrentClassLogger();

protected override void InternalMigrate(JObject settings)
{
RemovePropertyByPath(settings, "$.ShowErrorDialogs");
Expand Down

0 comments on commit c15562b

Please sign in to comment.