You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
63 lines
2.0 KiB
1 year ago
|
namespace StabilityMatrix.Core.Models.Settings;
|
||
2 years ago
|
|
||
|
public class Settings
|
||
|
{
|
||
1 year ago
|
public int? Version { get; set; } = 1;
|
||
1 year ago
|
public bool FirstLaunchSetupComplete { get; set; }
|
||
1 year ago
|
public string? Theme { get; set; } = "Dark";
|
||
|
|
||
2 years ago
|
public List<InstalledPackage> InstalledPackages { get; set; } = new();
|
||
2 years ago
|
public Guid? ActiveInstalledPackage { get; set; }
|
||
1 year ago
|
public bool HasSeenWelcomeNotification { get; set; }
|
||
1 year ago
|
public List<string>? PathExtensions { get; set; }
|
||
1 year ago
|
public string? WebApiHost { get; set; }
|
||
|
public string? WebApiPort { get; set; }
|
||
1 year ago
|
|
||
|
// UI states
|
||
1 year ago
|
public bool ModelBrowserNsfwEnabled { get; set; }
|
||
1 year ago
|
public bool IsNavExpanded { get; set; }
|
||
|
public bool IsImportAsConnected { get; set; }
|
||
1 year ago
|
public SharedFolderType? SharedFolderVisibleCategories { get; set; } =
|
||
|
SharedFolderType.StableDiffusion |
|
||
|
SharedFolderType.Lora |
|
||
|
SharedFolderType.LyCORIS;
|
||
|
|
||
1 year ago
|
public string? Placement { get; set; }
|
||
1 year ago
|
|
||
1 year ago
|
public ModelSearchOptions? ModelSearchOptions { get; set; }
|
||
1 year ago
|
|
||
|
public bool KeepFolderLinksOnShutdown { get; set; }
|
||
1 year ago
|
|
||
1 year ago
|
public InstalledPackage? GetActiveInstalledPackage()
|
||
|
{
|
||
|
return InstalledPackages.FirstOrDefault(x => x.Id == ActiveInstalledPackage);
|
||
|
}
|
||
1 year ago
|
|
||
|
public void RemoveInstalledPackageAndUpdateActive(InstalledPackage package)
|
||
|
{
|
||
|
RemoveInstalledPackageAndUpdateActive(package.Id);
|
||
|
}
|
||
|
|
||
|
public void RemoveInstalledPackageAndUpdateActive(Guid id)
|
||
|
{
|
||
|
InstalledPackages.RemoveAll(x => x.Id == id);
|
||
|
UpdateActiveInstalledPackage();
|
||
|
}
|
||
|
|
||
|
// Update ActiveInstalledPackage if not valid
|
||
|
// uses first package or null if no packages
|
||
|
private void UpdateActiveInstalledPackage()
|
||
|
{
|
||
|
// Empty packages - set to null
|
||
|
if (InstalledPackages.Count == 0)
|
||
|
{
|
||
|
ActiveInstalledPackage = null;
|
||
|
}
|
||
|
// Active package is not in package - set to first package
|
||
|
else if (InstalledPackages.All(x => x.Id != ActiveInstalledPackage))
|
||
|
{
|
||
|
ActiveInstalledPackage = InstalledPackages[0].Id;
|
||
|
}
|
||
|
}
|
||
2 years ago
|
}
|