mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Storage - Use nullable reference types
Core - Fix build warnings
This commit is contained in:
parent
f0e9581fe1
commit
248d4c8e18
@ -248,8 +248,8 @@ public sealed class Layer : RenderProfileElement
|
|||||||
typeof(PropertyGroupDescriptionAttribute)
|
typeof(PropertyGroupDescriptionAttribute)
|
||||||
)!;
|
)!;
|
||||||
|
|
||||||
LayerEntity.GeneralPropertyGroup ??= new PropertyGroupEntity {Identifier = generalAttribute.Identifier};
|
LayerEntity.GeneralPropertyGroup ??= new PropertyGroupEntity {Identifier = generalAttribute.Identifier!};
|
||||||
LayerEntity.TransformPropertyGroup ??= new PropertyGroupEntity {Identifier = transformAttribute.Identifier};
|
LayerEntity.TransformPropertyGroup ??= new PropertyGroupEntity {Identifier = transformAttribute.Identifier!};
|
||||||
|
|
||||||
General.Initialize(this, null, generalAttribute, LayerEntity.GeneralPropertyGroup);
|
General.Initialize(this, null, generalAttribute, LayerEntity.GeneralPropertyGroup);
|
||||||
Transform.Initialize(this, null, transformAttribute, LayerEntity.TransformPropertyGroup);
|
Transform.Initialize(this, null, transformAttribute, LayerEntity.TransformPropertyGroup);
|
||||||
|
|||||||
@ -240,7 +240,8 @@ public abstract class LayerPropertyGroup : IDisposable
|
|||||||
foreach (LayerPropertyGroup layerPropertyGroup in LayerPropertyGroups)
|
foreach (LayerPropertyGroup layerPropertyGroup in LayerPropertyGroups)
|
||||||
{
|
{
|
||||||
layerPropertyGroup.ApplyToEntity();
|
layerPropertyGroup.ApplyToEntity();
|
||||||
PropertyGroupEntity.PropertyGroups.Add(layerPropertyGroup.PropertyGroupEntity);
|
if (layerPropertyGroup.PropertyGroupEntity != null)
|
||||||
|
PropertyGroupEntity.PropertyGroups.Add(layerPropertyGroup.PropertyGroupEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class ArtemisDevice : CorePropertyChanged
|
|||||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||||
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
||||||
Categories = new HashSet<DeviceCategory>();
|
Categories = new HashSet<DeviceCategory>();
|
||||||
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LayoutType};
|
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
|
||||||
|
|
||||||
RgbDevice.ColorCorrections.Clear();
|
RgbDevice.ColorCorrections.Clear();
|
||||||
RgbDevice.ColorCorrections.Add(new ScaleColorCorrection(this));
|
RgbDevice.ColorCorrections.Add(new ScaleColorCorrection(this));
|
||||||
@ -75,7 +75,7 @@ public class ArtemisDevice : CorePropertyChanged
|
|||||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||||
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
||||||
Categories = new HashSet<DeviceCategory>();
|
Categories = new HashSet<DeviceCategory>();
|
||||||
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LayoutType};
|
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
|
||||||
|
|
||||||
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
|
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
|
||||||
InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier));
|
InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier));
|
||||||
@ -155,6 +155,9 @@ public class ArtemisDevice : CorePropertyChanged
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public HashSet<DeviceCategory> Categories { get; }
|
public HashSet<DeviceCategory> Categories { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the layout selection applied to this device
|
||||||
|
/// </summary>
|
||||||
public LayoutSelection LayoutSelection { get; }
|
public LayoutSelection LayoutSelection { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -57,6 +57,9 @@ public class ArtemisLayout
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public LayoutCustomDeviceData LayoutCustomDeviceData { get; private set; } = null!;
|
public LayoutCustomDeviceData LayoutCustomDeviceData { get; private set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a boolean indicating whether this layout is a default layout or not
|
||||||
|
/// </summary>
|
||||||
public bool IsDefaultLayout { get; private set; }
|
public bool IsDefaultLayout { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class LayerBrushDescriptor
|
|||||||
BaseLayerBrush brush = (BaseLayerBrush) Provider.Plugin.Resolve(LayerBrushType);
|
BaseLayerBrush brush = (BaseLayerBrush) Provider.Plugin.Resolve(LayerBrushType);
|
||||||
brush.Layer = layer;
|
brush.Layer = layer;
|
||||||
brush.Descriptor = this;
|
brush.Descriptor = this;
|
||||||
brush.LayerBrushEntity = entity ?? new LayerBrushEntity {ProviderId = Provider.Id, BrushType = LayerBrushType.FullName};
|
brush.LayerBrushEntity = entity ?? new LayerBrushEntity {ProviderId = Provider.Id, BrushType = LayerBrushType.FullName ?? throw new InvalidOperationException()};
|
||||||
|
|
||||||
brush.Initialize();
|
brush.Initialize();
|
||||||
return brush;
|
return brush;
|
||||||
|
|||||||
@ -231,7 +231,7 @@ public abstract class BaseLayerEffect : BreakableModel, IDisposable, IStorageMod
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
LayerEffectEntity.ProviderId = Descriptor.Provider.Id;
|
LayerEffectEntity.ProviderId = Descriptor.Provider.Id;
|
||||||
LayerEffectEntity.EffectType = GetType().FullName;
|
LayerEffectEntity.EffectType = GetType().FullName ?? throw new InvalidOperationException();
|
||||||
BaseProperties?.ApplyToEntity();
|
BaseProperties?.ApplyToEntity();
|
||||||
LayerEffectEntity.PropertyGroup = BaseProperties?.PropertyGroupEntity;
|
LayerEffectEntity.PropertyGroup = BaseProperties?.PropertyGroupEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public class PluginSettings
|
|||||||
if (_settingEntities.ContainsKey(name))
|
if (_settingEntities.ContainsKey(name))
|
||||||
return (PluginSetting<T>) _settingEntities[name];
|
return (PluginSetting<T>) _settingEntities[name];
|
||||||
// Try to find in database
|
// Try to find in database
|
||||||
PluginSettingEntity settingEntity = _pluginRepository.GetSettingByNameAndGuid(name, Plugin.Guid);
|
PluginSettingEntity? settingEntity = _pluginRepository.GetSettingByNameAndGuid(name, Plugin.Guid);
|
||||||
// If not found, create a new one
|
// If not found, create a new one
|
||||||
if (settingEntity == null)
|
if (settingEntity == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
namespace Artemis.Core.Providers;
|
namespace Artemis.Core.Providers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a layout provider that loads a layout from a custom path.
|
||||||
|
/// </summary>
|
||||||
public class CustomPathLayoutProvider : ILayoutProvider
|
public class CustomPathLayoutProvider : ILayoutProvider
|
||||||
{
|
{
|
||||||
public static string LayoutType = "CustomPath";
|
/// <summary>
|
||||||
|
/// The layout type of this layout provider.
|
||||||
|
/// </summary>
|
||||||
|
public const string LAYOUT_TYPE = "CustomPath";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
||||||
@ -21,7 +27,7 @@ public class CustomPathLayoutProvider : ILayoutProvider
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsMatch(ArtemisDevice device)
|
public bool IsMatch(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
return device.LayoutSelection.Type == LayoutType;
|
return device.LayoutSelection.Type == LAYOUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -31,7 +37,7 @@ public class CustomPathLayoutProvider : ILayoutProvider
|
|||||||
/// <param name="path">The path to the custom layout.</param>
|
/// <param name="path">The path to the custom layout.</param>
|
||||||
public void ConfigureDevice(ArtemisDevice device, string? path)
|
public void ConfigureDevice(ArtemisDevice device, string? path)
|
||||||
{
|
{
|
||||||
device.LayoutSelection.Type = LayoutType;
|
device.LayoutSelection.Type = LAYOUT_TYPE;
|
||||||
device.LayoutSelection.Parameter = path;
|
device.LayoutSelection.Parameter = path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,8 +1,14 @@
|
|||||||
namespace Artemis.Core.Providers;
|
namespace Artemis.Core.Providers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a layout provider that loads a layout from the plugin and falls back to a default layout.
|
||||||
|
/// </summary>
|
||||||
public class DefaultLayoutProvider : ILayoutProvider
|
public class DefaultLayoutProvider : ILayoutProvider
|
||||||
{
|
{
|
||||||
public static string LayoutType = "Default";
|
/// <summary>
|
||||||
|
/// The layout type of this layout provider.
|
||||||
|
/// </summary>
|
||||||
|
public const string LAYOUT_TYPE = "Default";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
||||||
@ -26,7 +32,7 @@ public class DefaultLayoutProvider : ILayoutProvider
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsMatch(ArtemisDevice device)
|
public bool IsMatch(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
return device.LayoutSelection.Type == LayoutType;
|
return device.LayoutSelection.Type == LAYOUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -35,7 +41,7 @@ public class DefaultLayoutProvider : ILayoutProvider
|
|||||||
/// <param name="device">The device to apply the provider to.</param>
|
/// <param name="device">The device to apply the provider to.</param>
|
||||||
public void ConfigureDevice(ArtemisDevice device)
|
public void ConfigureDevice(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
device.LayoutSelection.Type = LayoutType;
|
device.LayoutSelection.Type = LAYOUT_TYPE;
|
||||||
device.LayoutSelection.Parameter = null;
|
device.LayoutSelection.Parameter = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12,6 +12,17 @@ public interface ILayoutProvider
|
|||||||
/// <returns>The resulting layout if one was available; otherwise <see langword="null" />.</returns>
|
/// <returns>The resulting layout if one was available; otherwise <see langword="null" />.</returns>
|
||||||
ArtemisLayout? GetDeviceLayout(ArtemisDevice device);
|
ArtemisLayout? GetDeviceLayout(ArtemisDevice device);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies the layout to the provided device.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="device">The device to apply to.</param>
|
||||||
|
/// <param name="layout">The layout to apply.</param>
|
||||||
void ApplyLayout(ArtemisDevice device, ArtemisLayout layout);
|
void ApplyLayout(ArtemisDevice device, ArtemisLayout layout);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the provided device is configured to use this layout provider.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="device">The device to check.</param>
|
||||||
|
/// <returns>A value indicating whether the provided device is configured to use this layout provider.</returns>
|
||||||
bool IsMatch(ArtemisDevice device);
|
bool IsMatch(ArtemisDevice device);
|
||||||
}
|
}
|
||||||
@ -1,8 +1,14 @@
|
|||||||
namespace Artemis.Core.Providers;
|
namespace Artemis.Core.Providers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a layout provider that does not load a layout.
|
||||||
|
/// </summary>
|
||||||
public class NoneLayoutProvider : ILayoutProvider
|
public class NoneLayoutProvider : ILayoutProvider
|
||||||
{
|
{
|
||||||
public static string LayoutType = "None";
|
/// <summary>
|
||||||
|
/// The layout type of this layout provider.
|
||||||
|
/// </summary>
|
||||||
|
public const string LAYOUT_TYPE = "None";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
||||||
@ -19,7 +25,7 @@ public class NoneLayoutProvider : ILayoutProvider
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsMatch(ArtemisDevice device)
|
public bool IsMatch(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
return device.LayoutSelection.Type == LayoutType;
|
return device.LayoutSelection.Type == LAYOUT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -28,7 +34,7 @@ public class NoneLayoutProvider : ILayoutProvider
|
|||||||
/// <param name="device">The device to apply the provider to.</param>
|
/// <param name="device">The device to apply the provider to.</param>
|
||||||
public void ConfigureDevice(ArtemisDevice device)
|
public void ConfigureDevice(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
device.LayoutSelection.Type = LayoutType;
|
device.LayoutSelection.Type = LAYOUT_TYPE;
|
||||||
device.LayoutSelection.Parameter = null;
|
device.LayoutSelection.Parameter = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,6 +7,9 @@ using System.Threading;
|
|||||||
|
|
||||||
namespace Artemis.Core.Services;
|
namespace Artemis.Core.Services;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a monitor that efficiently keeps track of running processes.
|
||||||
|
/// </summary>
|
||||||
public static partial class ProcessMonitor
|
public static partial class ProcessMonitor
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
@ -15,8 +18,11 @@ public static partial class ProcessMonitor
|
|||||||
|
|
||||||
private static Timer? _timer;
|
private static Timer? _timer;
|
||||||
|
|
||||||
private static Dictionary<int, ProcessInfo> _processes = new();
|
private static readonly Dictionary<int, ProcessInfo> _processes = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets an immutable array of the current processes.
|
||||||
|
/// </summary>
|
||||||
public static ImmutableArray<ProcessInfo> Processes
|
public static ImmutableArray<ProcessInfo> Processes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -25,9 +31,17 @@ public static partial class ProcessMonitor
|
|||||||
return _processes.Values.ToImmutableArray();
|
return _processes.Values.ToImmutableArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the date time at which the last update took place.
|
||||||
|
/// </summary>
|
||||||
public static DateTime LastUpdate { get; private set; }
|
public static DateTime LastUpdate { get; private set; }
|
||||||
|
|
||||||
private static TimeSpan _updateInterval = TimeSpan.FromSeconds(1);
|
private static TimeSpan _updateInterval = TimeSpan.FromSeconds(1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the interval at which to update the list of processes.
|
||||||
|
/// </summary>
|
||||||
public static TimeSpan UpdateInterval
|
public static TimeSpan UpdateInterval
|
||||||
{
|
{
|
||||||
get => _updateInterval;
|
get => _updateInterval;
|
||||||
@ -40,6 +54,9 @@ public static partial class ProcessMonitor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the monitoring has started.
|
||||||
|
/// </summary>
|
||||||
public static bool IsStarted
|
public static bool IsStarted
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -53,7 +70,14 @@ public static partial class ProcessMonitor
|
|||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when a new process is started.
|
||||||
|
/// </summary>
|
||||||
public static event EventHandler<ProcessEventArgs>? ProcessStarted;
|
public static event EventHandler<ProcessEventArgs>? ProcessStarted;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when a process is stopped.
|
||||||
|
/// </summary>
|
||||||
public static event EventHandler<ProcessEventArgs>? ProcessStopped;
|
public static event EventHandler<ProcessEventArgs>? ProcessStopped;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -69,6 +93,9 @@ public static partial class ProcessMonitor
|
|||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts monitoring processes.
|
||||||
|
/// </summary>
|
||||||
public static void Start()
|
public static void Start()
|
||||||
{
|
{
|
||||||
lock (LOCK)
|
lock (LOCK)
|
||||||
@ -87,6 +114,9 @@ public static partial class ProcessMonitor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops monitoring processes.
|
||||||
|
/// </summary>
|
||||||
public static void Stop()
|
public static void Stop()
|
||||||
{
|
{
|
||||||
lock (LOCK)
|
lock (LOCK)
|
||||||
@ -100,7 +130,7 @@ public static partial class ProcessMonitor
|
|||||||
FreeBuffer();
|
FreeBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether the specified process is running
|
/// Returns whether the specified process is running
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -111,7 +141,7 @@ public static partial class ProcessMonitor
|
|||||||
{
|
{
|
||||||
if (!IsStarted || (processName == null && processLocation == null))
|
if (!IsStarted || (processName == null && processLocation == null))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lock (LOCK)
|
lock (LOCK)
|
||||||
{
|
{
|
||||||
return _processes.Values.Any(x => IsProcessRunning(x, processName, processLocation));
|
return _processes.Values.Any(x => IsProcessRunning(x, processName, processLocation));
|
||||||
@ -130,19 +160,19 @@ public static partial class ProcessMonitor
|
|||||||
OnProcessStopped(info);
|
OnProcessStopped(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsProcessRunning(ProcessInfo info, string? processName, string? processLocation)
|
private static bool IsProcessRunning(ProcessInfo info, string? processName, string? processLocation)
|
||||||
{
|
{
|
||||||
if (processName != null && processLocation != null)
|
if (processName != null && processLocation != null)
|
||||||
return string.Equals(info.ProcessName, processName, StringComparison.InvariantCultureIgnoreCase) &&
|
return string.Equals(info.ProcessName, processName, StringComparison.InvariantCultureIgnoreCase) &&
|
||||||
string.Equals(Path.GetDirectoryName(info.Executable), processLocation, StringComparison.InvariantCultureIgnoreCase);
|
string.Equals(Path.GetDirectoryName(info.Executable), processLocation, StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
|
||||||
if (processName != null)
|
if (processName != null)
|
||||||
return string.Equals(info.ProcessName, processName, StringComparison.InvariantCultureIgnoreCase);
|
return string.Equals(info.ProcessName, processName, StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
|
||||||
if (processLocation != null)
|
if (processLocation != null)
|
||||||
return string.Equals(Path.GetDirectoryName(info.Executable), processLocation, StringComparison.InvariantCultureIgnoreCase);
|
return string.Equals(Path.GetDirectoryName(info.Executable), processLocation, StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +182,10 @@ public static partial class ProcessMonitor
|
|||||||
{
|
{
|
||||||
ProcessStarted?.Invoke(null, new ProcessEventArgs(processInfo));
|
ProcessStarted?.Invoke(null, new ProcessEventArgs(processInfo));
|
||||||
}
|
}
|
||||||
catch { /* Subscribers are idiots! */ }
|
catch
|
||||||
|
{
|
||||||
|
/* Subscribers are idiots! */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnProcessStopped(ProcessInfo processInfo)
|
private static void OnProcessStopped(ProcessInfo processInfo)
|
||||||
@ -161,7 +194,10 @@ public static partial class ProcessMonitor
|
|||||||
{
|
{
|
||||||
ProcessStopped?.Invoke(null, new ProcessEventArgs(processInfo));
|
ProcessStopped?.Invoke(null, new ProcessEventArgs(processInfo));
|
||||||
}
|
}
|
||||||
catch { /* Subscribers are idiots! */ }
|
catch
|
||||||
|
{
|
||||||
|
/* Subscribers are idiots! */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -42,6 +42,7 @@ internal class LayerBrushService : ILayerBrushService
|
|||||||
BrushType = "SolidBrush"
|
BrushType = "SolidBrush"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
defaultReference.Value ??= new LayerBrushReference();
|
||||||
defaultReference.Value.LayerBrushProviderId ??= "Artemis.Plugins.LayerBrushes.Color.ColorBrushProvider-92a9d6ba";
|
defaultReference.Value.LayerBrushProviderId ??= "Artemis.Plugins.LayerBrushes.Color.ColorBrushProvider-92a9d6ba";
|
||||||
defaultReference.Value.BrushType ??= "SolidBrush";
|
defaultReference.Value.BrushType ??= "SolidBrush";
|
||||||
return LayerBrushStore.Get(defaultReference.Value.LayerBrushProviderId, defaultReference.Value.BrushType)?.LayerBrushDescriptor;
|
return LayerBrushStore.Get(defaultReference.Value.LayerBrushProviderId, defaultReference.Value.BrushType)?.LayerBrushDescriptor;
|
||||||
|
|||||||
@ -221,7 +221,7 @@ internal class ProfileService : IProfileService
|
|||||||
return profileConfiguration.Profile;
|
return profileConfiguration.Profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileEntity profileEntity;
|
ProfileEntity? profileEntity;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
profileEntity = _profileRepository.Get(profileConfiguration.Entity.ProfileId);
|
profileEntity = _profileRepository.Get(profileConfiguration.Entity.ProfileId);
|
||||||
@ -280,7 +280,7 @@ internal class ProfileService : IProfileService
|
|||||||
{
|
{
|
||||||
DeactivateProfile(profileConfiguration);
|
DeactivateProfile(profileConfiguration);
|
||||||
|
|
||||||
ProfileEntity profileEntity = _profileRepository.Get(profileConfiguration.Entity.ProfileId);
|
ProfileEntity? profileEntity = _profileRepository.Get(profileConfiguration.Entity.ProfileId);
|
||||||
if (profileEntity == null)
|
if (profileEntity == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ internal class ProfileService : IProfileService
|
|||||||
|
|
||||||
DeactivateProfile(profileConfiguration);
|
DeactivateProfile(profileConfiguration);
|
||||||
SaveProfileCategory(profileConfiguration.Category);
|
SaveProfileCategory(profileConfiguration.Category);
|
||||||
ProfileEntity profileEntity = _profileRepository.Get(profileConfiguration.Entity.ProfileId);
|
ProfileEntity? profileEntity = _profileRepository.Get(profileConfiguration.Entity.ProfileId);
|
||||||
if (profileEntity != null)
|
if (profileEntity != null)
|
||||||
_profileRepository.Remove(profileEntity);
|
_profileRepository.Remove(profileEntity);
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ public interface IWebServerService : IArtemisService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes an existing Web API controller and restarts the web server
|
/// Removes an existing Web API controller and restarts the web server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of Web API controller to remove</typeparam>
|
/// <param name="registration">The registration of the controller to remove.</param>
|
||||||
void RemoveController(WebApiControllerRegistration registration);
|
void RemoveController(WebApiControllerRegistration registration);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<PreserveCompilationContext>false</PreserveCompilationContext>
|
<PreserveCompilationContext>false</PreserveCompilationContext>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="LiteDB" Version="5.0.18" />
|
<PackageReference Include="LiteDB" Version="5.0.18" />
|
||||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
<PackageReference Include="Serilog" Version="3.1.1" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -11,7 +11,7 @@ public class QueuedActionEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; } = string.Empty;
|
||||||
public DateTimeOffset CreatedAt { get; set; }
|
public DateTimeOffset CreatedAt { get; set; }
|
||||||
|
|
||||||
public Dictionary<string, object> Parameters { get; set; }
|
public Dictionary<string, object> Parameters { get; set; }
|
||||||
|
|||||||
@ -6,6 +6,6 @@ public class ReleaseEntity
|
|||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public string Version { get; set; }
|
public string Version { get; set; } = string.Empty;
|
||||||
public DateTimeOffset? InstalledAt { get; set; }
|
public DateTimeOffset? InstalledAt { get; set; }
|
||||||
}
|
}
|
||||||
@ -6,7 +6,7 @@ public class ScriptConfigurationEntity
|
|||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public string ScriptingProviderId { get; set; }
|
public string ScriptingProviderId { get; set; } = string.Empty;
|
||||||
public string ScriptContent { get; set; }
|
public string? ScriptContent { get; set; }
|
||||||
}
|
}
|
||||||
@ -24,6 +24,6 @@ public class PluginEntity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PluginFeatureEntity
|
public class PluginFeatureEntity
|
||||||
{
|
{
|
||||||
public string Type { get; set; }
|
public string Type { get; set; } = string.Empty;
|
||||||
public bool IsEnabled { get; set; }
|
public bool IsEnabled { get; set; }
|
||||||
}
|
}
|
||||||
@ -10,6 +10,6 @@ public class PluginSettingEntity
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public Guid PluginGuid { get; set; }
|
public Guid PluginGuid { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Value { get; set; }
|
public string Value { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
@ -1,8 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Artemis.Storage.Entities.Profile.Abstract;
|
|
||||||
|
|
||||||
public abstract class DataModelConditionPartEntity
|
|
||||||
{
|
|
||||||
public List<DataModelConditionPartEntity> Children { get; set; }
|
|
||||||
}
|
|
||||||
@ -8,8 +8,8 @@ public abstract class RenderElementEntity
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public Guid ParentId { get; set; }
|
public Guid ParentId { get; set; }
|
||||||
|
|
||||||
public List<LayerEffectEntity> LayerEffects { get; set; }
|
public List<LayerEffectEntity> LayerEffects { get; set; } = new();
|
||||||
|
|
||||||
public IConditionEntity DisplayCondition { get; set; }
|
public IConditionEntity? DisplayCondition { get; set; }
|
||||||
public TimelineEntity Timeline { get; set; }
|
public TimelineEntity? Timeline { get; set; }
|
||||||
}
|
}
|
||||||
@ -1,5 +1,3 @@
|
|||||||
namespace Artemis.Storage.Entities.Profile.AdaptionHints;
|
namespace Artemis.Storage.Entities.Profile.AdaptionHints;
|
||||||
|
|
||||||
public interface IAdaptionHintEntity
|
public interface IAdaptionHintEntity;
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
namespace Artemis.Storage.Entities.Profile.Conditions;
|
namespace Artemis.Storage.Entities.Profile.Conditions;
|
||||||
|
|
||||||
public class AlwaysOnConditionEntity : IConditionEntity
|
public class AlwaysOnConditionEntity : IConditionEntity;
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -8,6 +8,6 @@ public class EventConditionEntity : IConditionEntity
|
|||||||
public int TriggerMode { get; set; }
|
public int TriggerMode { get; set; }
|
||||||
public int OverlapMode { get; set; }
|
public int OverlapMode { get; set; }
|
||||||
public int ToggleOffMode { get; set; }
|
public int ToggleOffMode { get; set; }
|
||||||
public DataModelPathEntity EventPath { get; set; }
|
public DataModelPathEntity? EventPath { get; set; }
|
||||||
public NodeScriptEntity Script { get; set; }
|
public NodeScriptEntity? Script { get; set; }
|
||||||
}
|
}
|
||||||
@ -1,5 +1,3 @@
|
|||||||
namespace Artemis.Storage.Entities.Profile.Abstract;
|
namespace Artemis.Storage.Entities.Profile.Abstract;
|
||||||
|
|
||||||
public interface IConditionEntity
|
public interface IConditionEntity;
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
namespace Artemis.Storage.Entities.Profile.Conditions;
|
namespace Artemis.Storage.Entities.Profile.Conditions;
|
||||||
|
|
||||||
public class PlayOnceConditionEntity : IConditionEntity
|
public class PlayOnceConditionEntity : IConditionEntity;
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -7,5 +7,5 @@ public class StaticConditionEntity : IConditionEntity
|
|||||||
{
|
{
|
||||||
public int PlayMode { get; set; }
|
public int PlayMode { get; set; }
|
||||||
public int StopMode { get; set; }
|
public int StopMode { get; set; }
|
||||||
public NodeScriptEntity Script { get; set; }
|
public NodeScriptEntity? Script { get; set; }
|
||||||
}
|
}
|
||||||
@ -4,7 +4,6 @@ namespace Artemis.Storage.Entities.Profile.DataBindings;
|
|||||||
|
|
||||||
public class DataBindingEntity
|
public class DataBindingEntity
|
||||||
{
|
{
|
||||||
public string Identifier { get; set; }
|
|
||||||
public bool IsEnabled { get; set; }
|
public bool IsEnabled { get; set; }
|
||||||
public NodeScriptEntity NodeScript { get; set; }
|
public NodeScriptEntity? NodeScript { get; set; }
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
public class DataModelPathEntity
|
public class DataModelPathEntity
|
||||||
{
|
{
|
||||||
public string Path { get; set; }
|
public string Path { get; set; } = string.Empty;
|
||||||
public string DataModelId { get; set; }
|
public string? DataModelId { get; set; }
|
||||||
public string Type { get; set; }
|
public string? Type { get; set; }
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Artemis.Storage.Entities.Profile.Abstract;
|
using Artemis.Storage.Entities.Profile.Abstract;
|
||||||
using LiteDB;
|
using LiteDB;
|
||||||
|
|
||||||
@ -7,18 +6,13 @@ namespace Artemis.Storage.Entities.Profile;
|
|||||||
|
|
||||||
public class FolderEntity : RenderElementEntity
|
public class FolderEntity : RenderElementEntity
|
||||||
{
|
{
|
||||||
public FolderEntity()
|
|
||||||
{
|
|
||||||
LayerEffects = new List<LayerEffectEntity>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public bool IsExpanded { get; set; }
|
public bool IsExpanded { get; set; }
|
||||||
public bool Suspended { get; set; }
|
public bool Suspended { get; set; }
|
||||||
|
|
||||||
[BsonRef("ProfileEntity")]
|
[BsonRef("ProfileEntity")]
|
||||||
public ProfileEntity Profile { get; set; }
|
public ProfileEntity Profile { get; set; } = null!;
|
||||||
|
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
}
|
}
|
||||||
@ -6,6 +6,6 @@ public class KeyframeEntity
|
|||||||
{
|
{
|
||||||
public TimeSpan Position { get; set; }
|
public TimeSpan Position { get; set; }
|
||||||
public int Timeline { get; set; }
|
public int Timeline { get; set; }
|
||||||
public string Value { get; set; }
|
public string Value { get; set; } = string.Empty;
|
||||||
public int EasingFunction { get; set; }
|
public int EasingFunction { get; set; }
|
||||||
}
|
}
|
||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
public class LayerBrushEntity
|
public class LayerBrushEntity
|
||||||
{
|
{
|
||||||
public string ProviderId { get; set; }
|
public string ProviderId { get; set; } = string.Empty;
|
||||||
public string BrushType { get; set; }
|
public string BrushType { get; set; } = string.Empty;
|
||||||
|
|
||||||
public PropertyGroupEntity PropertyGroup { get; set; }
|
public PropertyGroupEntity? PropertyGroup { get; set; }
|
||||||
}
|
}
|
||||||
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
public class LayerEffectEntity
|
public class LayerEffectEntity
|
||||||
{
|
{
|
||||||
public string ProviderId { get; set; }
|
public string ProviderId { get; set; } = string.Empty;
|
||||||
public string EffectType { get; set; }
|
public string EffectType { get; set; } = string.Empty;
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public bool HasBeenRenamed { get; set; }
|
public bool HasBeenRenamed { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
|
|
||||||
public PropertyGroupEntity PropertyGroup { get; set; }
|
public PropertyGroupEntity? PropertyGroup { get; set; }
|
||||||
}
|
}
|
||||||
@ -12,22 +12,21 @@ public class LayerEntity : RenderElementEntity
|
|||||||
{
|
{
|
||||||
Leds = new List<LedEntity>();
|
Leds = new List<LedEntity>();
|
||||||
AdaptionHints = new List<IAdaptionHintEntity>();
|
AdaptionHints = new List<IAdaptionHintEntity>();
|
||||||
LayerEffects = new List<LayerEffectEntity>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public bool Suspended { get; set; }
|
public bool Suspended { get; set; }
|
||||||
|
|
||||||
public List<LedEntity> Leds { get; set; }
|
public List<LedEntity> Leds { get; set; }
|
||||||
public List<IAdaptionHintEntity> AdaptionHints { get; set; }
|
public List<IAdaptionHintEntity> AdaptionHints { get; set; }
|
||||||
|
|
||||||
public PropertyGroupEntity GeneralPropertyGroup { get; set; }
|
public PropertyGroupEntity? GeneralPropertyGroup { get; set; }
|
||||||
public PropertyGroupEntity TransformPropertyGroup { get; set; }
|
public PropertyGroupEntity? TransformPropertyGroup { get; set; }
|
||||||
public LayerBrushEntity LayerBrush { get; set; }
|
public LayerBrushEntity? LayerBrush { get; set; }
|
||||||
|
|
||||||
[BsonRef("ProfileEntity")]
|
[BsonRef("ProfileEntity")]
|
||||||
public ProfileEntity Profile { get; set; }
|
public ProfileEntity Profile { get; set; } = null!;
|
||||||
|
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
}
|
}
|
||||||
@ -5,8 +5,8 @@ namespace Artemis.Storage.Entities.Profile;
|
|||||||
|
|
||||||
public class LedEntity
|
public class LedEntity
|
||||||
{
|
{
|
||||||
public string LedName { get; set; }
|
public string LedName { get; set; } = string.Empty;
|
||||||
public string DeviceIdentifier { get; set; }
|
public string DeviceIdentifier { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int? PhysicalLayout { get; set; }
|
public int? PhysicalLayout { get; set; }
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ public class LedEntity
|
|||||||
|
|
||||||
private sealed class LedEntityEqualityComparer : IEqualityComparer<LedEntity>
|
private sealed class LedEntityEqualityComparer : IEqualityComparer<LedEntity>
|
||||||
{
|
{
|
||||||
public bool Equals(LedEntity x, LedEntity y)
|
public bool Equals(LedEntity? x, LedEntity? y)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(x, y))
|
if (ReferenceEquals(x, y))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -20,12 +20,12 @@ public class NodeConnectionEntity
|
|||||||
TargetPinId = nodeConnectionEntity.TargetPinId;
|
TargetPinId = nodeConnectionEntity.TargetPinId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SourceType { get; set; }
|
public string SourceType { get; set; } = string.Empty;
|
||||||
public Guid SourceNode { get; set; }
|
public Guid SourceNode { get; set; }
|
||||||
public Guid TargetNode { get; set; }
|
public Guid TargetNode { get; set; }
|
||||||
public int SourcePinCollectionId { get; set; }
|
public int SourcePinCollectionId { get; set; }
|
||||||
public int SourcePinId { get; set; }
|
public int SourcePinId { get; set; }
|
||||||
public string TargetType { get; set; }
|
public string TargetType { get; set; } = string.Empty;
|
||||||
public int TargetPinCollectionId { get; set; }
|
public int TargetPinCollectionId { get; set; }
|
||||||
public int TargetPinId { get; set; }
|
public int TargetPinId { get; set; }
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@ -28,15 +28,15 @@ public class NodeEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; } = string.Empty;
|
||||||
public Guid PluginId { get; set; }
|
public Guid PluginId { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Description { get; set; }
|
public string Description { get; set; } = string.Empty;
|
||||||
public bool IsExitNode { get; set; }
|
public bool IsExitNode { get; set; }
|
||||||
public double X { get; set; }
|
public double X { get; set; }
|
||||||
public double Y { get; set; }
|
public double Y { get; set; }
|
||||||
public string Storage { get; set; }
|
public string Storage { get; set; } = string.Empty;
|
||||||
|
|
||||||
public List<NodePinCollectionEntity> PinCollections { get; set; }
|
public List<NodePinCollectionEntity> PinCollections { get; set; }
|
||||||
}
|
}
|
||||||
@ -10,8 +10,8 @@ public class NodeScriptEntity
|
|||||||
Connections = new List<NodeConnectionEntity>();
|
Connections = new List<NodeConnectionEntity>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Description { get; set; }
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
public List<NodeEntity> Nodes { get; set; }
|
public List<NodeEntity> Nodes { get; set; }
|
||||||
public List<NodeConnectionEntity> Connections { get; set; }
|
public List<NodeConnectionEntity> Connections { get; set; }
|
||||||
|
|||||||
@ -7,7 +7,7 @@ public class ProfileCategoryEntity
|
|||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public bool IsCollapsed { get; set; }
|
public bool IsCollapsed { get; set; }
|
||||||
public bool IsSuspended { get; set; }
|
public bool IsSuspended { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
|
|||||||
@ -5,8 +5,8 @@ namespace Artemis.Storage.Entities.Profile;
|
|||||||
|
|
||||||
public class ProfileConfigurationEntity
|
public class ProfileConfigurationEntity
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public string MaterialIcon { get; set; }
|
public string? MaterialIcon { get; set; }
|
||||||
public Guid FileIconId { get; set; }
|
public Guid FileIconId { get; set; }
|
||||||
public int IconType { get; set; }
|
public int IconType { get; set; }
|
||||||
public bool IconFill { get; set; }
|
public bool IconFill { get; set; }
|
||||||
@ -14,13 +14,13 @@ public class ProfileConfigurationEntity
|
|||||||
|
|
||||||
public bool IsSuspended { get; set; }
|
public bool IsSuspended { get; set; }
|
||||||
public int ActivationBehaviour { get; set; }
|
public int ActivationBehaviour { get; set; }
|
||||||
public NodeScriptEntity ActivationCondition { get; set; }
|
public NodeScriptEntity? ActivationCondition { get; set; }
|
||||||
|
|
||||||
public int HotkeyMode { get; set; }
|
public int HotkeyMode { get; set; }
|
||||||
public ProfileConfigurationHotkeyEntity EnableHotkey { get; set; }
|
public ProfileConfigurationHotkeyEntity? EnableHotkey { get; set; }
|
||||||
public ProfileConfigurationHotkeyEntity DisableHotkey { get; set; }
|
public ProfileConfigurationHotkeyEntity? DisableHotkey { get; set; }
|
||||||
|
|
||||||
public string ModuleId { get; set; }
|
public string? ModuleId { get; set; }
|
||||||
|
|
||||||
public Guid ProfileCategoryId { get; set; }
|
public Guid ProfileCategoryId { get; set; }
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class ProfileEntity
|
|||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public bool IsFreshImport { get; set; }
|
public bool IsFreshImport { get; set; }
|
||||||
|
|
||||||
public List<FolderEntity> Folders { get; set; }
|
public List<FolderEntity> Folders { get; set; }
|
||||||
@ -28,7 +28,7 @@ public class ProfileEntity
|
|||||||
Guid oldGuid = Id;
|
Guid oldGuid = Id;
|
||||||
Id = guid;
|
Id = guid;
|
||||||
|
|
||||||
FolderEntity rootFolder = Folders.FirstOrDefault(f => f.ParentId == oldGuid);
|
FolderEntity? rootFolder = Folders.FirstOrDefault(f => f.ParentId == oldGuid);
|
||||||
if (rootFolder != null)
|
if (rootFolder != null)
|
||||||
rootFolder.ParentId = Id;
|
rootFolder.ParentId = Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,10 +5,10 @@ namespace Artemis.Storage.Entities.Profile;
|
|||||||
|
|
||||||
public class PropertyEntity
|
public class PropertyEntity
|
||||||
{
|
{
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; } = string.Empty;
|
||||||
public string Value { get; set; }
|
public string Value { get; set; } = string.Empty;
|
||||||
public bool KeyframesEnabled { get; set; }
|
public bool KeyframesEnabled { get; set; }
|
||||||
|
|
||||||
public DataBindingEntity DataBinding { get; set; }
|
public DataBindingEntity? DataBinding { get; set; }
|
||||||
public List<KeyframeEntity> KeyframeEntities { get; set; } = new();
|
public List<KeyframeEntity> KeyframeEntities { get; set; } = new();
|
||||||
}
|
}
|
||||||
@ -4,7 +4,7 @@ namespace Artemis.Storage.Entities.Profile;
|
|||||||
|
|
||||||
public class PropertyGroupEntity
|
public class PropertyGroupEntity
|
||||||
{
|
{
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; } = string.Empty;
|
||||||
public List<PropertyEntity> Properties { get; set; } = new();
|
public List<PropertyEntity> Properties { get; set; } = new();
|
||||||
public List<PropertyGroupEntity> PropertyGroups { get; set; } = new();
|
public List<PropertyGroupEntity> PropertyGroups { get; set; } = new();
|
||||||
}
|
}
|
||||||
@ -11,8 +11,8 @@ public class DeviceEntity
|
|||||||
Categories = new List<int>();
|
Categories = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Id { get; set; }
|
public string Id { get; set; } = string.Empty;
|
||||||
public string DeviceProvider { get; set; }
|
public string DeviceProvider { get; set; } = string.Empty;
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
public float Y { get; set; }
|
public float Y { get; set; }
|
||||||
public float Rotation { get; set; }
|
public float Rotation { get; set; }
|
||||||
@ -24,9 +24,9 @@ public class DeviceEntity
|
|||||||
public bool IsEnabled { get; set; }
|
public bool IsEnabled { get; set; }
|
||||||
|
|
||||||
public int PhysicalLayout { get; set; }
|
public int PhysicalLayout { get; set; }
|
||||||
public string LogicalLayout { get; set; }
|
public string? LogicalLayout { get; set; }
|
||||||
public string LayoutType { get; set; }
|
public string? LayoutType { get; set; }
|
||||||
public string LayoutParameter { get; set; }
|
public string? LayoutParameter { get; set; }
|
||||||
|
|
||||||
public List<DeviceInputIdentifierEntity> InputIdentifiers { get; set; }
|
public List<DeviceInputIdentifierEntity> InputIdentifiers { get; set; }
|
||||||
public List<InputMappingEntity> InputMappings { get; set; }
|
public List<InputMappingEntity> InputMappings { get; set; }
|
||||||
@ -41,6 +41,6 @@ public class InputMappingEntity
|
|||||||
|
|
||||||
public class DeviceInputIdentifierEntity
|
public class DeviceInputIdentifierEntity
|
||||||
{
|
{
|
||||||
public string InputProvider { get; set; }
|
public string InputProvider { get; set; } = string.Empty;
|
||||||
public object Identifier { get; set; }
|
public object Identifier { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
@ -10,13 +10,12 @@ public class EntryEntity
|
|||||||
public long EntryId { get; set; }
|
public long EntryId { get; set; }
|
||||||
public int EntryType { get; set; }
|
public int EntryType { get; set; }
|
||||||
|
|
||||||
public string Author { get; set; }
|
public string Author { get; set; } = string.Empty;
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Summary { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public long ReleaseId { get; set; }
|
public long ReleaseId { get; set; }
|
||||||
public string ReleaseVersion { get; set; }
|
public string ReleaseVersion { get; set; } = string.Empty;
|
||||||
public DateTimeOffset InstalledAt { get; set; }
|
public DateTimeOffset InstalledAt { get; set; }
|
||||||
|
|
||||||
public Dictionary<string,object> Metadata { get; set; }
|
public Dictionary<string,object>? Metadata { get; set; }
|
||||||
}
|
}
|
||||||
11
src/Artemis.Storage/Migrations/IProfileMigration.cs
Normal file
11
src/Artemis.Storage/Migrations/IProfileMigration.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using LiteDB;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace Artemis.Storage.Migrations;
|
||||||
|
|
||||||
|
internal interface IProfileMigration
|
||||||
|
{
|
||||||
|
int Version { get; }
|
||||||
|
void Migrate(JObject profileJson);
|
||||||
|
void Migrate(BsonDocument profileBson);
|
||||||
|
}
|
||||||
97
src/Artemis.Storage/Migrations/Profile/M0001NodeProviders.cs
Normal file
97
src/Artemis.Storage/Migrations/Profile/M0001NodeProviders.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using LiteDB;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace Artemis.Storage.Migrations.Profile;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Migrates nodes to be provider-based.
|
||||||
|
/// This requires giving them a ProviderId and updating the their namespaces to match the namespace of the new plugin.
|
||||||
|
/// </summary>
|
||||||
|
internal class M0001NodeProviders : IProfileMigration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int Version => 1;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Migrate(JObject profileJson)
|
||||||
|
{
|
||||||
|
JArray? folders = (JArray?) profileJson["Folders"]?["$values"];
|
||||||
|
JArray? layers = (JArray?) profileJson["Layers"]?["$values"];
|
||||||
|
|
||||||
|
if (folders != null)
|
||||||
|
{
|
||||||
|
foreach (JToken folder in folders)
|
||||||
|
{
|
||||||
|
MigrateProfileElement(folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (layers != null)
|
||||||
|
{
|
||||||
|
foreach (JToken layer in layers)
|
||||||
|
{
|
||||||
|
MigrateProfileElement(layer);
|
||||||
|
MigratePropertyGroup(layer["GeneralPropertyGroup"]);
|
||||||
|
MigratePropertyGroup(layer["TransformPropertyGroup"]);
|
||||||
|
MigratePropertyGroup(layer["LayerBrush"]?["PropertyGroup"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Migrate(BsonDocument profileBson)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MigrateProfileElement(JToken profileElement)
|
||||||
|
{
|
||||||
|
JArray? layerEffects = (JArray?) profileElement["LayerEffects"]?["$values"];
|
||||||
|
if (layerEffects != null)
|
||||||
|
{
|
||||||
|
foreach (JToken layerEffect in layerEffects)
|
||||||
|
MigratePropertyGroup(layerEffect["PropertyGroup"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
JToken? displayCondition = profileElement["DisplayCondition"];
|
||||||
|
if (displayCondition != null)
|
||||||
|
MigrateNodeScript(displayCondition["Script"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MigratePropertyGroup(JToken? propertyGroup)
|
||||||
|
{
|
||||||
|
if (propertyGroup == null || !propertyGroup.HasValues)
|
||||||
|
return;
|
||||||
|
|
||||||
|
JArray? properties = (JArray?) propertyGroup["Properties"]?["$values"];
|
||||||
|
JArray? propertyGroups = (JArray?) propertyGroup["PropertyGroups"]?["$values"];
|
||||||
|
|
||||||
|
if (properties != null)
|
||||||
|
{
|
||||||
|
foreach (JToken property in properties)
|
||||||
|
MigrateNodeScript(property["DataBinding"]?["NodeScript"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertyGroups != null)
|
||||||
|
{
|
||||||
|
foreach (JToken childPropertyGroup in propertyGroups)
|
||||||
|
MigratePropertyGroup(childPropertyGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MigrateNodeScript(JToken? nodeScript)
|
||||||
|
{
|
||||||
|
if (nodeScript == null || !nodeScript.HasValues)
|
||||||
|
return;
|
||||||
|
|
||||||
|
JArray? nodes = (JArray?) nodeScript["Nodes"]?["$values"];
|
||||||
|
if (nodes == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (JToken node in nodes)
|
||||||
|
{
|
||||||
|
node["Type"] = node["Type"]?.Value<string>()?.Replace("Artemis.VisualScripting.Nodes", "Artemis.Plugins.Nodes.General.Nodes");
|
||||||
|
node["ProviderId"] = "Artemis.Plugins.Nodes.General.GeneralNodesProvider-d9e1ee78";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,9 +12,9 @@ public class M0021GradientNodes : IStorageMigration
|
|||||||
{
|
{
|
||||||
private void MigrateDataBinding(PropertyEntity property)
|
private void MigrateDataBinding(PropertyEntity property)
|
||||||
{
|
{
|
||||||
NodeScriptEntity script = property.DataBinding.NodeScript;
|
NodeScriptEntity? script = property.DataBinding?.NodeScript;
|
||||||
NodeEntity exitNode = script.Nodes.FirstOrDefault(s => s.IsExitNode);
|
NodeEntity? exitNode = script?.Nodes.FirstOrDefault(s => s.IsExitNode);
|
||||||
if (exitNode == null)
|
if (script == null || exitNode == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Create a new node at the same position of the exit node
|
// Create a new node at the same position of the exit node
|
||||||
@ -59,8 +59,11 @@ public class M0021GradientNodes : IStorageMigration
|
|||||||
exitNode.Y += 30;
|
exitNode.Y += 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MigrateDataBinding(PropertyGroupEntity propertyGroup)
|
private void MigrateDataBinding(PropertyGroupEntity? propertyGroup)
|
||||||
{
|
{
|
||||||
|
if (propertyGroup == null)
|
||||||
|
return;
|
||||||
|
|
||||||
foreach (PropertyGroupEntity propertyGroupPropertyGroup in propertyGroup.PropertyGroups)
|
foreach (PropertyGroupEntity propertyGroupPropertyGroup in propertyGroup.PropertyGroups)
|
||||||
MigrateDataBinding(propertyGroupPropertyGroup);
|
MigrateDataBinding(propertyGroupPropertyGroup);
|
||||||
|
|
||||||
@ -80,7 +83,7 @@ public class M0021GradientNodes : IStorageMigration
|
|||||||
foreach (ProfileEntity profileEntity in profiles)
|
foreach (ProfileEntity profileEntity in profiles)
|
||||||
{
|
{
|
||||||
foreach (LayerEntity layer in profileEntity.Layers.Where(le => le.LayerBrush != null))
|
foreach (LayerEntity layer in profileEntity.Layers.Where(le => le.LayerBrush != null))
|
||||||
MigrateDataBinding(layer.LayerBrush.PropertyGroup);
|
MigrateDataBinding(layer.LayerBrush?.PropertyGroup);
|
||||||
|
|
||||||
repository.Update(profileEntity);
|
repository.Update(profileEntity);
|
||||||
}
|
}
|
||||||
@ -10,7 +10,7 @@ namespace Artemis.Storage.Migrations;
|
|||||||
|
|
||||||
public class M0022TransitionNodes : IStorageMigration
|
public class M0022TransitionNodes : IStorageMigration
|
||||||
{
|
{
|
||||||
private void MigrateNodeScript(NodeScriptEntity nodeScript)
|
private void MigrateNodeScript(NodeScriptEntity? nodeScript)
|
||||||
{
|
{
|
||||||
if (nodeScript == null)
|
if (nodeScript == null)
|
||||||
return;
|
return;
|
||||||
@ -28,7 +28,7 @@ public class M0022TransitionNodes : IStorageMigration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MigratePropertyGroup(PropertyGroupEntity propertyGroup)
|
private void MigratePropertyGroup(PropertyGroupEntity? propertyGroup)
|
||||||
{
|
{
|
||||||
if (propertyGroup == null)
|
if (propertyGroup == null)
|
||||||
return;
|
return;
|
||||||
@ -39,7 +39,7 @@ public class M0022TransitionNodes : IStorageMigration
|
|||||||
MigrateNodeScript(property.DataBinding?.NodeScript);
|
MigrateNodeScript(property.DataBinding?.NodeScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MigrateDisplayCondition(IConditionEntity conditionEntity)
|
private void MigrateDisplayCondition(IConditionEntity? conditionEntity)
|
||||||
{
|
{
|
||||||
if (conditionEntity is EventConditionEntity eventConditionEntity)
|
if (conditionEntity is EventConditionEntity eventConditionEntity)
|
||||||
MigrateNodeScript(eventConditionEntity.Script);
|
MigrateNodeScript(eventConditionEntity.Script);
|
||||||
@ -70,14 +70,14 @@ public class M0022TransitionNodes : IStorageMigration
|
|||||||
MigratePropertyGroup(layer.GeneralPropertyGroup);
|
MigratePropertyGroup(layer.GeneralPropertyGroup);
|
||||||
MigratePropertyGroup(layer.TransformPropertyGroup);
|
MigratePropertyGroup(layer.TransformPropertyGroup);
|
||||||
foreach (LayerEffectEntity layerEffectEntity in layer.LayerEffects)
|
foreach (LayerEffectEntity layerEffectEntity in layer.LayerEffects)
|
||||||
MigratePropertyGroup(layerEffectEntity?.PropertyGroup);
|
MigratePropertyGroup(layerEffectEntity.PropertyGroup);
|
||||||
MigrateDisplayCondition(layer.DisplayCondition);
|
MigrateDisplayCondition(layer.DisplayCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (FolderEntity folder in profileEntity.Folders)
|
foreach (FolderEntity folder in profileEntity.Folders)
|
||||||
{
|
{
|
||||||
foreach (LayerEffectEntity folderLayerEffect in folder.LayerEffects)
|
foreach (LayerEffectEntity folderLayerEffect in folder.LayerEffects)
|
||||||
MigratePropertyGroup(folderLayerEffect?.PropertyGroup);
|
MigratePropertyGroup(folderLayerEffect.PropertyGroup);
|
||||||
MigrateDisplayCondition(folder.DisplayCondition);
|
MigrateDisplayCondition(folder.DisplayCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ internal class DeviceRepository : IDeviceRepository
|
|||||||
_repository.Delete<DeviceEntity>(deviceEntity.Id);
|
_repository.Delete<DeviceEntity>(deviceEntity.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceEntity Get(string id)
|
public DeviceEntity? Get(string id)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<DeviceEntity>(s => s.Id == id);
|
return _repository.FirstOrDefault<DeviceEntity>(s => s.Id == id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,12 +27,12 @@ internal class EntryRepository : IEntryRepository
|
|||||||
_repository.Delete<EntryEntity>(entryEntity.Id);
|
_repository.Delete<EntryEntity>(entryEntity.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntryEntity Get(Guid id)
|
public EntryEntity? Get(Guid id)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<EntryEntity>(s => s.Id == id);
|
return _repository.FirstOrDefault<EntryEntity>(s => s.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntryEntity GetByEntryId(long entryId)
|
public EntryEntity? GetByEntryId(long entryId)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<EntryEntity>(s => s.EntryId == entryId);
|
return _repository.FirstOrDefault<EntryEntity>(s => s.EntryId == entryId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ public interface IDeviceRepository : IRepository
|
|||||||
{
|
{
|
||||||
void Add(DeviceEntity deviceEntity);
|
void Add(DeviceEntity deviceEntity);
|
||||||
void Remove(DeviceEntity deviceEntity);
|
void Remove(DeviceEntity deviceEntity);
|
||||||
DeviceEntity Get(string id);
|
DeviceEntity? Get(string id);
|
||||||
List<DeviceEntity> GetAll();
|
List<DeviceEntity> GetAll();
|
||||||
void Save(DeviceEntity deviceEntity);
|
void Save(DeviceEntity deviceEntity);
|
||||||
void Save(IEnumerable<DeviceEntity> deviceEntities);
|
void Save(IEnumerable<DeviceEntity> deviceEntities);
|
||||||
|
|||||||
@ -8,8 +8,8 @@ public interface IEntryRepository : IRepository
|
|||||||
{
|
{
|
||||||
void Add(EntryEntity entryEntity);
|
void Add(EntryEntity entryEntity);
|
||||||
void Remove(EntryEntity entryEntity);
|
void Remove(EntryEntity entryEntity);
|
||||||
EntryEntity Get(Guid id);
|
EntryEntity? Get(Guid id);
|
||||||
EntryEntity GetByEntryId(long entryId);
|
EntryEntity? GetByEntryId(long entryId);
|
||||||
List<EntryEntity> GetAll();
|
List<EntryEntity> GetAll();
|
||||||
void Save(EntryEntity entryEntity);
|
void Save(EntryEntity entryEntity);
|
||||||
void Save(IEnumerable<EntryEntity> entryEntities);
|
void Save(IEnumerable<EntryEntity> entryEntities);
|
||||||
|
|||||||
@ -6,12 +6,12 @@ namespace Artemis.Storage.Repositories.Interfaces;
|
|||||||
public interface IPluginRepository : IRepository
|
public interface IPluginRepository : IRepository
|
||||||
{
|
{
|
||||||
void AddPlugin(PluginEntity pluginEntity);
|
void AddPlugin(PluginEntity pluginEntity);
|
||||||
PluginEntity GetPluginByGuid(Guid pluginGuid);
|
PluginEntity? GetPluginByGuid(Guid pluginGuid);
|
||||||
void SavePlugin(PluginEntity pluginEntity);
|
void SavePlugin(PluginEntity pluginEntity);
|
||||||
|
|
||||||
void AddSetting(PluginSettingEntity pluginSettingEntity);
|
void AddSetting(PluginSettingEntity pluginSettingEntity);
|
||||||
PluginSettingEntity GetSettingByGuid(Guid pluginGuid);
|
PluginSettingEntity? GetSettingByGuid(Guid pluginGuid);
|
||||||
PluginSettingEntity GetSettingByNameAndGuid(string name, Guid pluginGuid);
|
PluginSettingEntity? GetSettingByNameAndGuid(string name, Guid pluginGuid);
|
||||||
void SaveSetting(PluginSettingEntity pluginSettingEntity);
|
void SaveSetting(PluginSettingEntity pluginSettingEntity);
|
||||||
void RemoveSettings(Guid pluginGuid);
|
void RemoveSettings(Guid pluginGuid);
|
||||||
}
|
}
|
||||||
@ -10,8 +10,8 @@ public interface IProfileCategoryRepository : IRepository
|
|||||||
void Add(ProfileCategoryEntity profileCategoryEntity);
|
void Add(ProfileCategoryEntity profileCategoryEntity);
|
||||||
void Remove(ProfileCategoryEntity profileCategoryEntity);
|
void Remove(ProfileCategoryEntity profileCategoryEntity);
|
||||||
List<ProfileCategoryEntity> GetAll();
|
List<ProfileCategoryEntity> GetAll();
|
||||||
ProfileCategoryEntity Get(Guid id);
|
ProfileCategoryEntity? Get(Guid id);
|
||||||
Stream GetProfileIconStream(Guid id);
|
Stream? GetProfileIconStream(Guid id);
|
||||||
void SaveProfileIconStream(ProfileConfigurationEntity profileConfigurationEntity, Stream stream);
|
void SaveProfileIconStream(ProfileConfigurationEntity profileConfigurationEntity, Stream stream);
|
||||||
ProfileCategoryEntity IsUnique(string name, Guid? id);
|
ProfileCategoryEntity IsUnique(string name, Guid? id);
|
||||||
void Save(ProfileCategoryEntity profileCategoryEntity);
|
void Save(ProfileCategoryEntity profileCategoryEntity);
|
||||||
|
|||||||
@ -9,6 +9,6 @@ public interface IProfileRepository : IRepository
|
|||||||
void Add(ProfileEntity profileEntity);
|
void Add(ProfileEntity profileEntity);
|
||||||
void Remove(ProfileEntity profileEntity);
|
void Remove(ProfileEntity profileEntity);
|
||||||
List<ProfileEntity> GetAll();
|
List<ProfileEntity> GetAll();
|
||||||
ProfileEntity Get(Guid id);
|
ProfileEntity? Get(Guid id);
|
||||||
void Save(ProfileEntity profileEntity);
|
void Save(ProfileEntity profileEntity);
|
||||||
}
|
}
|
||||||
@ -1,5 +1,3 @@
|
|||||||
namespace Artemis.Storage.Repositories.Interfaces;
|
namespace Artemis.Storage.Repositories.Interfaces;
|
||||||
|
|
||||||
public interface IRepository
|
public interface IRepository;
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -21,7 +21,7 @@ internal class PluginRepository : IPluginRepository
|
|||||||
_repository.Insert(pluginEntity);
|
_repository.Insert(pluginEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginEntity GetPluginByGuid(Guid pluginGuid)
|
public PluginEntity? GetPluginByGuid(Guid pluginGuid)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<PluginEntity>(p => p.Id == pluginGuid);
|
return _repository.FirstOrDefault<PluginEntity>(p => p.Id == pluginGuid);
|
||||||
}
|
}
|
||||||
@ -37,12 +37,12 @@ internal class PluginRepository : IPluginRepository
|
|||||||
_repository.Insert(pluginSettingEntity);
|
_repository.Insert(pluginSettingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginSettingEntity GetSettingByGuid(Guid pluginGuid)
|
public PluginSettingEntity? GetSettingByGuid(Guid pluginGuid)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<PluginSettingEntity>(p => p.PluginGuid == pluginGuid);
|
return _repository.FirstOrDefault<PluginSettingEntity>(p => p.PluginGuid == pluginGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginSettingEntity GetSettingByNameAndGuid(string name, Guid pluginGuid)
|
public PluginSettingEntity? GetSettingByNameAndGuid(string name, Guid pluginGuid)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<PluginSettingEntity>(p => p.Name == name && p.PluginGuid == pluginGuid);
|
return _repository.FirstOrDefault<PluginSettingEntity>(p => p.Name == name && p.PluginGuid == pluginGuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ internal class ProfileCategoryRepository : IProfileCategoryRepository
|
|||||||
return _repository.Query<ProfileCategoryEntity>().ToList();
|
return _repository.Query<ProfileCategoryEntity>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileCategoryEntity Get(Guid id)
|
public ProfileCategoryEntity? Get(Guid id)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<ProfileCategoryEntity>(p => p.Id == id);
|
return _repository.FirstOrDefault<ProfileCategoryEntity>(p => p.Id == id);
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ internal class ProfileCategoryRepository : IProfileCategoryRepository
|
|||||||
_repository.Upsert(profileCategoryEntity);
|
_repository.Upsert(profileCategoryEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream GetProfileIconStream(Guid id)
|
public Stream? GetProfileIconStream(Guid id)
|
||||||
{
|
{
|
||||||
if (!_profileIcons.Exists(id))
|
if (!_profileIcons.Exists(id))
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ internal class ProfileRepository : IProfileRepository
|
|||||||
return _repository.Query<ProfileEntity>().ToList();
|
return _repository.Query<ProfileEntity>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileEntity Get(Guid id)
|
public ProfileEntity? Get(Guid id)
|
||||||
{
|
{
|
||||||
return _repository.FirstOrDefault<ProfileEntity>(p => p.Id == id);
|
return _repository.FirstOrDefault<ProfileEntity>(p => p.Id == id);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user