mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fix build
This commit is contained in:
parent
fd942dab25
commit
8e04fa1a01
@ -11,8 +11,22 @@ namespace Artemis.Core.Models.Profile
|
|||||||
{
|
{
|
||||||
public class Profile : IProfileElement
|
public class Profile : IProfileElement
|
||||||
{
|
{
|
||||||
|
internal Profile(PluginInfo pluginInfo, string name)
|
||||||
|
{
|
||||||
|
ProfileEntity = new ProfileEntity {RootFolder = new FolderEntity()};
|
||||||
|
Guid = System.Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
PluginInfo = pluginInfo;
|
||||||
|
Name = name;
|
||||||
|
|
||||||
|
Children = new List<IProfileElement>();
|
||||||
|
}
|
||||||
|
|
||||||
internal Profile(PluginInfo pluginInfo, ProfileEntity profileEntity, IPluginService pluginService)
|
internal Profile(PluginInfo pluginInfo, ProfileEntity profileEntity, IPluginService pluginService)
|
||||||
{
|
{
|
||||||
|
ProfileEntity = profileEntity;
|
||||||
|
Guid = profileEntity.Guid;
|
||||||
|
|
||||||
PluginInfo = pluginInfo;
|
PluginInfo = pluginInfo;
|
||||||
Name = profileEntity.Name;
|
Name = profileEntity.Name;
|
||||||
|
|
||||||
@ -20,16 +34,11 @@ namespace Artemis.Core.Models.Profile
|
|||||||
Children = new List<IProfileElement> {Folder.FromFolderEntity(this, profileEntity.RootFolder, pluginService)};
|
Children = new List<IProfileElement> {Folder.FromFolderEntity(this, profileEntity.RootFolder, pluginService)};
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Profile(PluginInfo pluginInfo, string name)
|
|
||||||
{
|
|
||||||
PluginInfo = pluginInfo;
|
|
||||||
Name = name;
|
|
||||||
|
|
||||||
Children = new List<IProfileElement>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PluginInfo PluginInfo { get; }
|
public PluginInfo PluginInfo { get; }
|
||||||
public bool IsActivated { get; private set; }
|
public bool IsActivated { get; private set; }
|
||||||
|
|
||||||
|
internal ProfileEntity ProfileEntity { get; set; }
|
||||||
|
internal string Guid { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<IProfileElement> Children { get; set; }
|
public List<IProfileElement> Children { get; set; }
|
||||||
|
|||||||
@ -23,11 +23,11 @@ namespace Artemis.Core.Models.Surface
|
|||||||
|
|
||||||
internal Surface(RGBSurface rgbSurface, SurfaceEntity surfaceEntity, double scale)
|
internal Surface(RGBSurface rgbSurface, SurfaceEntity surfaceEntity, double scale)
|
||||||
{
|
{
|
||||||
RgbSurface = rgbSurface;
|
|
||||||
SurfaceEntity = surfaceEntity;
|
SurfaceEntity = surfaceEntity;
|
||||||
Scale = scale;
|
|
||||||
Guid = surfaceEntity.Guid;
|
Guid = surfaceEntity.Guid;
|
||||||
|
|
||||||
|
RgbSurface = rgbSurface;
|
||||||
|
Scale = scale;
|
||||||
Name = surfaceEntity.Name;
|
Name = surfaceEntity.Name;
|
||||||
IsActive = surfaceEntity.IsActive;
|
IsActive = surfaceEntity.IsActive;
|
||||||
Devices = new List<Device>();
|
Devices = new List<Device>();
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace Artemis.Core.Services.Storage
|
|||||||
var profileEntities = await _profileRepository.GetByPluginGuidAsync(module.PluginInfo.Guid);
|
var profileEntities = await _profileRepository.GetByPluginGuidAsync(module.PluginInfo.Guid);
|
||||||
var profiles = new List<Profile>();
|
var profiles = new List<Profile>();
|
||||||
foreach (var profileEntity in profileEntities)
|
foreach (var profileEntity in profileEntities)
|
||||||
profiles.Add(Profile.FromProfileEntity(module.PluginInfo, profileEntity, _pluginService));
|
profiles.Add(new Profile(module.PluginInfo, profileEntity, _pluginService));
|
||||||
|
|
||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
@ -38,13 +38,21 @@ namespace Artemis.Core.Services.Storage
|
|||||||
if (profileEntity == null)
|
if (profileEntity == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return Profile.FromProfileEntity(module.PluginInfo, profileEntity, _pluginService);
|
return new Profile(module.PluginInfo, profileEntity, _pluginService);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Profile> CreateProfile(ProfileModule module, string name)
|
||||||
|
{
|
||||||
|
var profile = new Profile(module.PluginInfo, name);
|
||||||
|
await SaveProfile(profile);
|
||||||
|
|
||||||
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SaveProfile(Profile profile)
|
public async Task SaveProfile(Profile profile)
|
||||||
{
|
{
|
||||||
// Find a matching profile entity to update
|
// Find a matching profile entity to update
|
||||||
|
var existing = await _profileRepository.GetByGuidAsync(profile.)
|
||||||
// If not found, create a new one
|
// If not found, create a new one
|
||||||
|
|
||||||
await _profileRepository.SaveAsync();
|
await _profileRepository.SaveAsync();
|
||||||
|
|||||||
@ -74,7 +74,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
|||||||
|
|
||||||
if (!profiles.Any())
|
if (!profiles.Any())
|
||||||
{
|
{
|
||||||
var profile = new Profile();
|
var profile = new Profile(Module.PluginInfo, "Default");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user