Actually respect remember state flag

This commit is contained in:
goaaats 2025-04-26 12:17:27 +02:00
parent 0bddf30577
commit a925e37ceb
2 changed files with 21 additions and 5 deletions

View file

@ -64,16 +64,28 @@ internal class Profile
this.IsEnabled = false; this.IsEnabled = false;
Log.Verbose("{Guid} set disabled because always disable", this.modelV1.Guid); Log.Verbose("{Guid} set disabled because always disable", this.modelV1.Guid);
} }
} else if (this.modelV1.StartupPolicy == ProfileModelV1.ProfileStartupPolicy.RememberState)
else if (this.modelV1.IsEnabled) {
{ this.IsEnabled = this.modelV1.IsEnabled;
this.IsEnabled = true; Log.Verbose("{Guid} set enabled because remember", this.modelV1.Guid);
Log.Verbose("{Guid} set enabled because remember", this.modelV1.Guid); }
else
{
throw new ArgumentOutOfRangeException(nameof(this.modelV1.StartupPolicy));
}
} }
else else
{ {
Log.Verbose("{Guid} not enabled", this.modelV1.Guid); Log.Verbose("{Guid} not enabled", this.modelV1.Guid);
} }
Log.Verbose("Init profile {Guid} ({Name}) enabled:{Enabled} policy:{Policy} plugins:{NumPlugins} will be enabled:{Status}",
this.modelV1.Guid,
this.modelV1.Name,
this.modelV1.IsEnabled,
this.modelV1.StartupPolicy,
this.modelV1.Plugins.Count,
this.IsEnabled);
} }
/// <summary> /// <summary>

View file

@ -193,6 +193,10 @@ internal class ProfileManager : IServiceType
} }
} }
} }
else
{
throw new InvalidOperationException("Unsupported profile model version");
}
this.config.SavedProfiles!.Add(newModel); this.config.SavedProfiles!.Add(newModel);
this.config.QueueSave(); this.config.QueueSave();