Rewrite Hierachy that shockers now contain the api they use.

This commit is contained in:
2024-02-01 23:03:28 +01:00
parent 9596811ae7
commit 65059f66ed
18 changed files with 171 additions and 168 deletions

View File

@ -1,11 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using CShocker.Devices.Abstract;
using CShocker.Shockers.Abstract;
namespace CShocker.Shockers;
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
[SuppressMessage("ReSharper", "InconsistentNaming")]
public struct OpenShockShocker : IShocker
public class OpenShockShocker : Shocker
{
public string name, id;
public short rfId;
@ -13,6 +14,18 @@ public struct OpenShockShocker : IShocker
public DateTime createdOn;
public bool isPaused;
public OpenShockShocker(Api api, string name, string id, short rfId, OpenShockModel model, DateTime createdOn, bool isPaused) : base (api)
{
if (api is not OpenShockApi)
throw new Exception($"API-Type {api.GetType().FullName} is not usable with Shocker {this.GetType().FullName}");
this.name = name;
this.id = id;
this.rfId = rfId;
this.model = model;
this.createdOn = createdOn;
this.isPaused = isPaused;
}
public enum OpenShockModel : byte
{
CaiXianlin = 0,