mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Core - Implemented module priority
Settings UI - Module priority modification UI WIP
This commit is contained in:
1 parent
6a32ecc3a4
commit
04f2162bcd
12 files changed
+416
-63
No files matched your search
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Storage.Entities.Module
|
||||
{
|
||||
public class ModuleSettingsEntity
|
||||
{
|
||||
public Guid PluginGuid { get; set; }
|
||||
public int PriorityCategory { get; set; }
|
||||
public int Priority { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Storage.Entities.Module;
|
||||
|
||||
namespace Artemis.Storage.Repositories.Interfaces
|
||||
{
|
||||
public interface IModuleRepository : IRepository
|
||||
{
|
||||
void Add(ModuleSettingsEntity moduleSettingsEntity);
|
||||
ModuleSettingsEntity GetByPluginGuid(Guid guid);
|
||||
List<ModuleSettingsEntity> GetAll();
|
||||
List<ModuleSettingsEntity> GetByCategory(int category);
|
||||
void Save(ModuleSettingsEntity moduleSettingsEntity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Storage.Entities.Module;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class ModuleRepository : IModuleRepository
|
||||
{
|
||||
private readonly LiteRepository _repository;
|
||||
|
||||
internal ModuleRepository(LiteRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
_repository.Database.GetCollection<ModuleSettingsEntity>().EnsureIndex(s => s.PluginGuid);
|
||||
}
|
||||
|
||||
public void Add(ModuleSettingsEntity moduleSettingsEntity)
|
||||
{
|
||||
_repository.Insert(moduleSettingsEntity);
|
||||
}
|
||||
|
||||
public ModuleSettingsEntity GetByPluginGuid(Guid guid)
|
||||
{
|
||||
return _repository.FirstOrDefault<ModuleSettingsEntity>(s => s.PluginGuid == guid);
|
||||
}
|
||||
|
||||
public List<ModuleSettingsEntity> GetAll()
|
||||
{
|
||||
return _repository.Query<ModuleSettingsEntity>().ToList();
|
||||
}
|
||||
|
||||
public List<ModuleSettingsEntity> GetByCategory(int category)
|
||||
{
|
||||
return _repository.Query<ModuleSettingsEntity>().Where(s => s.PriorityCategory == category).ToList();
|
||||
}
|
||||
|
||||
public void Save(ModuleSettingsEntity moduleSettingsEntity)
|
||||
{
|
||||
_repository.Upsert(moduleSettingsEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user