Rewrite Hierachy that shockers now contain the api they use.
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user