mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Profiles - Added workshop installing
This commit is contained in:
1 parent
4143cc2de8
commit
671c587df6
21 files changed
+401
-73
No files matched your search
@@ -76,8 +76,9 @@ public interface IProfileService : IArtemisService
|
||||
/// Creates a new profile category and saves it to persistent storage.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the new profile category, must be unique.</param>
|
||||
/// <param name="addToTop">A boolean indicating whether or not to add the category to the top.</param>
|
||||
/// <returns>The newly created profile category.</returns>
|
||||
ProfileCategory CreateProfileCategory(string name);
|
||||
ProfileCategory CreateProfileCategory(string name, bool addToTop = false);
|
||||
|
||||
/// <summary>
|
||||
/// Permanently deletes the provided profile category.
|
||||
|
||||
@@ -286,12 +286,26 @@ internal class ProfileService : IProfileService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ProfileCategory CreateProfileCategory(string name)
|
||||
public ProfileCategory CreateProfileCategory(string name, bool addToTop = false)
|
||||
{
|
||||
ProfileCategory profileCategory;
|
||||
lock (_profileRepository)
|
||||
{
|
||||
profileCategory = new ProfileCategory(name, _profileCategories.Count + 1);
|
||||
if (addToTop)
|
||||
{
|
||||
profileCategory = new ProfileCategory(name, 1);
|
||||
foreach (ProfileCategory category in _profileCategories)
|
||||
{
|
||||
category.Order++;
|
||||
category.Save();
|
||||
_profileCategoryRepository.Save(category.Entity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
profileCategory = new ProfileCategory(name, _profileCategories.Count + 1);
|
||||
}
|
||||
|
||||
_profileCategories.Add(profileCategory);
|
||||
SaveProfileCategory(profileCategory);
|
||||
}
|
||||
@@ -370,7 +384,7 @@ internal class ProfileService : IProfileService
|
||||
profile.ProfileEntity.IsFreshImport = false;
|
||||
|
||||
_profileRepository.Save(profile.ProfileEntity);
|
||||
|
||||
|
||||
// If the provided profile is external (cloned or from the workshop?) but it is loaded locally too, reload the local instance
|
||||
// A bit dodge but it ensures local instances always represent the latest stored version
|
||||
ProfileConfiguration? localInstance = ProfileConfigurations.FirstOrDefault(p => p.Profile != null && p.Profile != profile && p.ProfileId == profile.ProfileEntity.Id);
|
||||
@@ -450,7 +464,7 @@ internal class ProfileService : IProfileService
|
||||
List<Module> modules = _pluginManagementService.GetFeaturesOfType<Module>();
|
||||
profileConfiguration.LoadModules(modules);
|
||||
SaveProfileCategory(category);
|
||||
|
||||
|
||||
return profileConfiguration;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user