Marked all service implementations as internal

Core - Enabled XML docs
Modules - Added DI to module VMs
This commit is contained in:
Robert committed 2020-08-19 19:45:22 +02:00
1 parent ae9bdecef1
commit a06ad8f011
29 files changed
+134 -46

No files matched your search

+5 -1
View File
@@ -16,6 +16,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>x64</PlatformTarget>
<DocumentationFile>bin\AnyCPU\Debug\Artemis.Core.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<NrtRevisionFormat>2.0-{chash:6}</NrtRevisionFormat>
@@ -27,6 +28,9 @@
<NrtRequiredVcs>git</NrtRequiredVcs>
<NrtShowRevision>true</NrtShowRevision>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\AnyCPU\Release\Artemis.Core.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Artemis.Storage\Artemis.Storage.csproj">
<Private>false</Private>
@@ -46,7 +50,7 @@
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.2" />
<PackageReference Include="Stylet" Version="1.3.4" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Reflection.Metadata" Version="1.8.0" />
+4 -2
View File
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Interop;
using Artemis.Core.Plugins.Models;
namespace Artemis.Core
{
/// <summary>
/// A few useful constant values
/// </summary>
public static class Constants
{
/// <summary>
@@ -68,7 +70,7 @@ namespace Artemis.Core
{
typeof(float),
typeof(double),
typeof(decimal)
typeof(decimal)
};
}
}
+4
View File
@@ -24,6 +24,7 @@ namespace Artemis.Core.Ninject
Kernel.Bind(x =>
{
x.FromThisAssembly()
.IncludingNonPublicTypes()
.SelectAllClasses()
.InheritedFrom<IArtemisService>()
.BindAllInterfaces()
@@ -34,6 +35,7 @@ namespace Artemis.Core.Ninject
Kernel.Bind(x =>
{
x.FromThisAssembly()
.IncludingNonPublicTypes()
.SelectAllClasses()
.InheritedFrom<IProtectedArtemisService>()
.BindAllInterfaces()
@@ -68,6 +70,7 @@ namespace Artemis.Core.Ninject
Kernel.Bind(x =>
{
x.FromAssemblyContaining<IStorageMigration>()
.IncludingNonPublicTypes()
.SelectAllClasses()
.InheritedFrom<IStorageMigration>()
.BindAllInterfaces()
@@ -78,6 +81,7 @@ namespace Artemis.Core.Ninject
Kernel.Bind(x =>
{
x.FromAssemblyContaining<IRepository>()
.IncludingNonPublicTypes()
.SelectAllClasses()
.InheritedFrom<IRepository>()
.BindAllInterfaces()
+3 -3
View File
@@ -5,7 +5,7 @@ using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Abstract.DataModels;
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using Artemis.Core.Plugins.Abstract.ViewModels;
using Artemis.Core.Plugins.ModuleActivationRequirements;
using Artemis.Core.Plugins.Modules;
using Artemis.Storage.Entities.Module;
using SkiaSharp;
@@ -134,10 +134,10 @@ namespace Artemis.Core.Plugins.Abstract
public abstract void Render(double deltaTime, ArtemisSurface surface, SKCanvas canvas, SKImageInfo canvasInfo);
/// <summary>
/// Called when the module's view model is being show, return view models here to create tabs for them
/// Called when the module's view model is being show, return a list of module tabs here if you want them to show up in the UI
/// </summary>
/// <returns></returns>
public abstract IEnumerable<ModuleViewModel> GetViewModels();
public abstract IEnumerable<ModuleTab> GetModuleTabs();
/// <summary>
/// Called when the <see cref="ActivationRequirements" /> are met
@@ -0,0 +1,43 @@
using System;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Abstract.ViewModels;
namespace Artemis.Core.Plugins.Modules
{
/// <inheritdoc />
public class ModuleTab<T> : ModuleTab where T : ModuleViewModel
{
/// <summary>
/// Initializes a new instance of the <see cref="ModuleTab{T}" /> class
/// </summary>
/// <param name="title">The title of the tab</param>
public ModuleTab(string title)
{
Title = title;
}
/// <inheritdoc />
public override Type Type => typeof(T);
}
/// <summary>
/// Describes a UI tab for a specific module
/// </summary>
public abstract class ModuleTab
{
/// <summary>
/// The module this tab belongs to
/// </summary>
internal Module Module { get; set; }
/// <summary>
/// The title of the tab
/// </summary>
public string Title { get; protected set; }
/// <summary>
/// The type of view model the tab contains
/// </summary>
public abstract Type Type { get; }
}
}
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Artemis.Core.Extensions;
namespace Artemis.Core.Plugins.ModuleActivationRequirements
namespace Artemis.Core.Plugins.Modules
{
public class ProcessActivationRequirement : IModuleActivationRequirement
{
+8 -4
View File
@@ -27,7 +27,7 @@ namespace Artemis.Core.Services
/// <summary>
/// Provides Artemis's core update loop
/// </summary>
public class CoreService : ICoreService
internal class CoreService : ICoreService
{
private readonly Stopwatch _frameStopWatch;
private readonly ILogger _logger;
@@ -41,7 +41,7 @@ namespace Artemis.Core.Services
private IntroAnimation _introAnimation;
// ReSharper disable once UnusedParameter.Local - Storage migration service is injected early to ensure it runs before anything else
internal CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService,
public CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService,
IRgbService rgbService, ISurfaceService surfaceService, IProfileService profileService, IModuleService moduleService)
{
_logger = logger;
@@ -173,7 +173,10 @@ namespace Artemis.Core.Services
List<Module> modules;
lock (_modules)
{
modules = _modules.Where(m => m.IsActivated).OrderByDescending(m => m.PriorityCategory).ThenByDescending(m => m.Priority).ToList();
modules = _modules.Where(m => m.IsActivated || m.InternalExpandsMainDataModel)
.OrderByDescending(m => m.PriorityCategory)
.ThenByDescending(m => m.Priority)
.ToList();
}
// Update all active modules
@@ -194,7 +197,8 @@ namespace Artemis.Core.Services
canvas.Clear(new SKColor(0, 0, 0));
if (!ModuleRenderingDisabled)
{
foreach (var module in modules)
// While non-activated modules may be updated above if they expand the main data model, they may never render
foreach (var module in modules.Where(m => m.IsActivated))
module.Render(args.DeltaTime, _surfaceService.ActiveSurface, canvas, _rgbService.BitmapBrush.Bitmap.Info);
}
@@ -20,14 +20,14 @@ namespace Artemis.Core.Services
/// <summary>
/// Provides access to the main data model
/// </summary>
public class DataModelService : IDataModelService
internal class DataModelService : IDataModelService
{
private readonly List<DataModel> _dataModelExpansions;
private readonly IPluginService _pluginService;
private readonly ILogger _logger;
private readonly List<DisplayConditionOperator> _registeredConditionOperators;
internal DataModelService(IPluginService pluginService, ILogger logger)
public DataModelService(IPluginService pluginService, ILogger logger)
{
_pluginService = pluginService;
_logger = logger;
+1 -1
View File
@@ -6,7 +6,7 @@ using SkiaSharp;
namespace Artemis.Core.Services
{
public class DeviceService : IDeviceService
internal class DeviceService : IDeviceService
{
private readonly ICoreService _coreService;
+1 -1
View File
@@ -10,7 +10,7 @@ using Serilog;
namespace Artemis.Core.Services
{
public class ModuleService : IModuleService
internal class ModuleService : IModuleService
{
private readonly ILogger _logger;
private readonly IModuleRepository _moduleRepository;
+2 -2
View File
@@ -26,7 +26,7 @@ namespace Artemis.Core.Services
/// <summary>
/// Provides access to plugin loading and unloading
/// </summary>
public class PluginService : IPluginService
internal class PluginService : IPluginService
{
private readonly IKernel _kernel;
private readonly ILogger _logger;
@@ -34,7 +34,7 @@ namespace Artemis.Core.Services
private readonly List<PluginInfo> _plugins;
private IKernel _childKernel;
internal PluginService(IKernel kernel, ILogger logger, IPluginRepository pluginRepository)
public PluginService(IKernel kernel, ILogger logger, IPluginRepository pluginRepository)
{
_kernel = kernel;
_logger = logger;
@@ -15,7 +15,7 @@ using Serilog;
namespace Artemis.Core.Services
{
public class RenderElementService : IRenderElementService
internal class RenderElementService : IRenderElementService
{
private readonly IKernel _kernel;
private readonly ILogger _logger;
+2 -2
View File
@@ -14,7 +14,7 @@ namespace Artemis.Core.Services
/// <summary>
/// Provides wrapped access the RGB.NET
/// </summary>
public class RgbService : IRgbService, IDisposable
internal class RgbService : IRgbService, IDisposable
{
private readonly List<IRGBDevice> _loadedDevices;
private readonly ILogger _logger;
@@ -23,7 +23,7 @@ namespace Artemis.Core.Services
private readonly PluginSetting<int> _targetFrameRateSetting;
private ListLedGroup _surfaceLedGroup;
internal RgbService(ILogger logger, ISettingsService settingsService)
public RgbService(ILogger logger, ISettingsService settingsService)
{
_logger = logger;
_renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.5);
+8 -1
View File
@@ -5,7 +5,7 @@ using Artemis.Storage.Repositories.Interfaces;
namespace Artemis.Core.Services
{
/// <inheritdoc />
public class SettingsService : ISettingsService
internal class SettingsService : ISettingsService
{
private readonly PluginSettings _pluginSettings;
@@ -26,6 +26,13 @@ namespace Artemis.Core.Services
/// </summary>
public interface ISettingsService : IProtectedArtemisService
{
/// <summary>
/// Gets the setting with the provided name. If the setting does not exist yet, it is created.
/// </summary>
/// <typeparam name="T">The type of the setting, can be any serializable type</typeparam>
/// <param name="name">The name of the setting</param>
/// <param name="defaultValue">The default value to use if the setting does not exist yet</param>
/// <returns></returns>
PluginSetting<T> GetSetting<T>(string name, T defaultValue = default);
}
}
@@ -17,7 +17,7 @@ using Serilog;
namespace Artemis.Core.Services.Storage
{
public class ProfileService : IProfileService
internal class ProfileService : IProfileService
{
private readonly ILogger _logger;
private readonly IPluginService _pluginService;
@@ -59,7 +59,8 @@ namespace Artemis.Core.Services.Storage
public void ActivateLastProfile(ProfileModule profileModule)
{
var activeProfile = GetLastActiveProfile(profileModule);
ActivateProfile(activeProfile);
if (activeProfile != null)
ActivateProfile(activeProfile);
}
public Profile ActivateProfile(ProfileDescriptor profileDescriptor)
+2 -1
View File
@@ -6,6 +6,7 @@ using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Abstract.ViewModels;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Storage.Entities.Profile;
using Newtonsoft.Json;
@@ -91,7 +92,7 @@ namespace Artemis.Core.Utilities
throw new NotImplementedException();
}
public override IEnumerable<ModuleViewModel> GetViewModels()
public override IEnumerable<ModuleTab> GetModuleTabs()
{
throw new NotImplementedException();
}