mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Added a layer of abstraction between RGB.NET and Artemis
This means Artemis can add extra functionality It also avoid having to reference RGB.NET for basic rendering Implemented rendering scaling
This commit is contained in:
1 parent
4126f5622e
commit
f72f145c7e
41 files changed
+725
-494
No files matched your search
+7
-6
@@ -2,16 +2,17 @@
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class SurfacePositionEntity
|
||||
public class DeviceEntity
|
||||
{
|
||||
public DeviceEntity()
|
||||
{
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public int DeviceId { get; set; }
|
||||
public string DeviceName { get; set; }
|
||||
public string DeviceModel { get; set; }
|
||||
public string DeviceManufacturer { get; set; }
|
||||
|
||||
public int DeviceHashCode { get; set; }
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
public double Rotation { get; set; }
|
||||
@@ -5,12 +5,17 @@ namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class SurfaceEntity
|
||||
{
|
||||
public SurfaceEntity()
|
||||
{
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public virtual ICollection<SurfacePositionEntity> SurfacePositions { get; set; }
|
||||
public virtual ICollection<DeviceEntity> DeviceEntities { get; set; }
|
||||
}
|
||||
}
|
||||
+29
-35
@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
[DbContext(typeof(StorageContext))]
|
||||
[Migration("20191013153102_InitialCreate")]
|
||||
[Migration("20191028171528_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -18,6 +18,30 @@ namespace Artemis.Storage.Migrations
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("DeviceHashCode");
|
||||
|
||||
b.Property<double>("Rotation");
|
||||
|
||||
b.Property<string>("SurfaceId");
|
||||
|
||||
b.Property<double>("X");
|
||||
|
||||
b.Property<double>("Y");
|
||||
|
||||
b.Property<int>("ZIndex");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("SurfaceId");
|
||||
|
||||
b.ToTable("DeviceEntity");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
@@ -167,34 +191,11 @@ namespace Artemis.Storage.Migrations
|
||||
b.ToTable("Surfaces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SurfacePositionEntity", b =>
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("DeviceId");
|
||||
|
||||
b.Property<string>("DeviceManufacturer");
|
||||
|
||||
b.Property<string>("DeviceModel");
|
||||
|
||||
b.Property<string>("DeviceName");
|
||||
|
||||
b.Property<double>("Rotation");
|
||||
|
||||
b.Property<string>("SurfaceId");
|
||||
|
||||
b.Property<double>("X");
|
||||
|
||||
b.Property<double>("Y");
|
||||
|
||||
b.Property<int>("ZIndex");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("SurfaceId");
|
||||
|
||||
b.ToTable("SurfacePositionEntity");
|
||||
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
|
||||
.WithMany("DeviceEntities")
|
||||
.HasForeignKey("SurfaceId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
@@ -238,13 +239,6 @@ namespace Artemis.Storage.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SurfacePositionEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
|
||||
.WithMany("SurfacePositions")
|
||||
.HasForeignKey("SurfaceId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
+13
-16
@@ -107,14 +107,11 @@ namespace Artemis.Storage.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SurfacePositionEntity",
|
||||
name: "DeviceEntity",
|
||||
columns: table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
DeviceId = table.Column<int>(nullable: false),
|
||||
DeviceName = table.Column<string>(nullable: true),
|
||||
DeviceModel = table.Column<string>(nullable: true),
|
||||
DeviceManufacturer = table.Column<string>(nullable: true),
|
||||
DeviceHashCode = table.Column<int>(nullable: false),
|
||||
X = table.Column<double>(nullable: false),
|
||||
Y = table.Column<double>(nullable: false),
|
||||
Rotation = table.Column<double>(nullable: false),
|
||||
@@ -123,9 +120,9 @@ namespace Artemis.Storage.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SurfacePositionEntity", x => x.Guid);
|
||||
table.PrimaryKey("PK_DeviceEntity", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
name: "FK_SurfacePositionEntity_Surfaces_SurfaceId",
|
||||
name: "FK_DeviceEntity_Surfaces_SurfaceId",
|
||||
column: x => x.SurfaceId,
|
||||
principalTable: "Surfaces",
|
||||
principalColumn: "Guid",
|
||||
@@ -192,6 +189,11 @@ namespace Artemis.Storage.Migrations
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeviceEntity_SurfaceId",
|
||||
table: "DeviceEntity",
|
||||
column: "SurfaceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Folders_FolderEntityGuid",
|
||||
table: "Folders",
|
||||
@@ -221,15 +223,13 @@ namespace Artemis.Storage.Migrations
|
||||
name: "IX_Profiles_RootFolderGuid",
|
||||
table: "Profiles",
|
||||
column: "RootFolderGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SurfacePositionEntity_SurfaceId",
|
||||
table: "SurfacePositionEntity",
|
||||
column: "SurfaceId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "DeviceEntity");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Keypoints");
|
||||
|
||||
@@ -246,14 +246,11 @@ namespace Artemis.Storage.Migrations
|
||||
name: "Settings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SurfacePositionEntity");
|
||||
name: "Surfaces");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LayerSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Surfaces");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Layers");
|
||||
|
||||
@@ -16,6 +16,30 @@ namespace Artemis.Storage.Migrations
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("DeviceHashCode");
|
||||
|
||||
b.Property<double>("Rotation");
|
||||
|
||||
b.Property<string>("SurfaceId");
|
||||
|
||||
b.Property<double>("X");
|
||||
|
||||
b.Property<double>("Y");
|
||||
|
||||
b.Property<int>("ZIndex");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("SurfaceId");
|
||||
|
||||
b.ToTable("DeviceEntity");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
@@ -165,34 +189,11 @@ namespace Artemis.Storage.Migrations
|
||||
b.ToTable("Surfaces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SurfacePositionEntity", b =>
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("DeviceId");
|
||||
|
||||
b.Property<string>("DeviceManufacturer");
|
||||
|
||||
b.Property<string>("DeviceModel");
|
||||
|
||||
b.Property<string>("DeviceName");
|
||||
|
||||
b.Property<double>("Rotation");
|
||||
|
||||
b.Property<string>("SurfaceId");
|
||||
|
||||
b.Property<double>("X");
|
||||
|
||||
b.Property<double>("Y");
|
||||
|
||||
b.Property<int>("ZIndex");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("SurfaceId");
|
||||
|
||||
b.ToTable("SurfacePositionEntity");
|
||||
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
|
||||
.WithMany("DeviceEntities")
|
||||
.HasForeignKey("SurfaceId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
@@ -236,13 +237,6 @@ namespace Artemis.Storage.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SurfacePositionEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
|
||||
.WithMany("SurfacePositions")
|
||||
.HasForeignKey("SurfaceId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,22 +29,22 @@ namespace Artemis.Storage.Repositories
|
||||
|
||||
public SurfaceEntity Get(string name)
|
||||
{
|
||||
return _dbContext.Surfaces.Include(s => s.SurfacePositions).FirstOrDefault(p => p.Name == name);
|
||||
return _dbContext.Surfaces.Include(s => s.DeviceEntities).FirstOrDefault(p => p.Name == name);
|
||||
}
|
||||
|
||||
public async Task<SurfaceEntity> GetAsync(string name)
|
||||
{
|
||||
return await _dbContext.Surfaces.Include(s => s.SurfacePositions).FirstOrDefaultAsync(p => p.Name == name);
|
||||
return await _dbContext.Surfaces.Include(s => s.DeviceEntities).FirstOrDefaultAsync(p => p.Name == name);
|
||||
}
|
||||
|
||||
public List<SurfaceEntity> GetAll()
|
||||
{
|
||||
return _dbContext.Surfaces.Include(s => s.SurfacePositions).ToList();
|
||||
return _dbContext.Surfaces.Include(s => s.DeviceEntities).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<SurfaceEntity>> GetAllAsync()
|
||||
{
|
||||
return await _dbContext.Surfaces.Include(s => s.SurfacePositions).ToListAsync();
|
||||
return await _dbContext.Surfaces.Include(s => s.DeviceEntities).ToListAsync();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
||||
Reference in new issue
Block a user