1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Fix build

This commit is contained in:
SpoinkyNL 2019-11-18 21:46:01 +01:00
parent fd942dab25
commit 8e04fa1a01
4 changed files with 31 additions and 14 deletions

View File

@ -11,8 +11,22 @@ namespace Artemis.Core.Models.Profile
{
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)
{
ProfileEntity = profileEntity;
Guid = profileEntity.Guid;
PluginInfo = pluginInfo;
Name = profileEntity.Name;
@ -20,16 +34,11 @@ namespace Artemis.Core.Models.Profile
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 bool IsActivated { get; private set; }
internal ProfileEntity ProfileEntity { get; set; }
internal string Guid { get; set; }
public int Order { get; set; }
public string Name { get; set; }
public List<IProfileElement> Children { get; set; }

View File

@ -23,11 +23,11 @@ namespace Artemis.Core.Models.Surface
internal Surface(RGBSurface rgbSurface, SurfaceEntity surfaceEntity, double scale)
{
RgbSurface = rgbSurface;
SurfaceEntity = surfaceEntity;
Scale = scale;
Guid = surfaceEntity.Guid;
RgbSurface = rgbSurface;
Scale = scale;
Name = surfaceEntity.Name;
IsActive = surfaceEntity.IsActive;
Devices = new List<Device>();

View File

@ -27,7 +27,7 @@ namespace Artemis.Core.Services.Storage
var profileEntities = await _profileRepository.GetByPluginGuidAsync(module.PluginInfo.Guid);
var profiles = new List<Profile>();
foreach (var profileEntity in profileEntities)
profiles.Add(Profile.FromProfileEntity(module.PluginInfo, profileEntity, _pluginService));
profiles.Add(new Profile(module.PluginInfo, profileEntity, _pluginService));
return profiles;
}
@ -38,13 +38,21 @@ namespace Artemis.Core.Services.Storage
if (profileEntity == 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)
{
// Find a matching profile entity to update
var existing = await _profileRepository.GetByGuidAsync(profile.)
// If not found, create a new one
await _profileRepository.SaveAsync();

View File

@ -74,7 +74,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
if (!profiles.Any())
{
var profile = new Profile();
var profile = new Profile(Module.PluginInfo, "Default");
}
}
}