2024-02-12 02:01:31 +01:00
|
|
|
|
using CShocker.Devices.Abstract;
|
2024-01-29 15:37:19 +01:00
|
|
|
|
using CShocker.Shockers.Abstract;
|
|
|
|
|
|
|
|
|
|
namespace CShocker.Shockers;
|
|
|
|
|
|
2024-02-01 23:03:28 +01:00
|
|
|
|
public class OpenShockShocker : Shocker
|
2024-01-29 15:37:19 +01:00
|
|
|
|
{
|
2024-02-12 02:01:31 +01:00
|
|
|
|
// ReSharper disable thrice MemberCanBePrivate.Global -> Exposed
|
|
|
|
|
public readonly string Name, ID;
|
|
|
|
|
public readonly short RfId;
|
|
|
|
|
public readonly OpenShockModel Model;
|
|
|
|
|
public readonly DateTime CreatedOn;
|
|
|
|
|
public readonly bool IsPaused;
|
2024-01-29 15:37:19 +01:00
|
|
|
|
public string name, id;
|
|
|
|
|
public short rfId;
|
|
|
|
|
public OpenShockModel model;
|
|
|
|
|
public DateTime createdOn;
|
|
|
|
|
public bool isPaused;
|
|
|
|
|
|
2024-02-01 23:03:28 +01:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-29 15:37:19 +01:00
|
|
|
|
public enum OpenShockModel : byte
|
|
|
|
|
{
|
|
|
|
|
CaiXianlin = 0,
|
|
|
|
|
Petrainer = 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return $"{GetType().Name}\n" +
|
|
|
|
|
$"Name: {name}\n" +
|
|
|
|
|
$"ID: {id}\n" +
|
|
|
|
|
$"RF-ID: {rfId}\n" +
|
|
|
|
|
$"Model: {Enum.GetName(model)}\n" +
|
|
|
|
|
$"Created On: {createdOn}\n" +
|
|
|
|
|
$"Paused: {isPaused}\n\r";
|
|
|
|
|
}
|
2024-01-29 17:05:13 +01:00
|
|
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
|
{
|
|
|
|
|
return obj is OpenShockShocker oss && Equals(oss);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool Equals(OpenShockShocker other)
|
|
|
|
|
{
|
|
|
|
|
return id == other.id && rfId == other.rfId && model == other.model && createdOn.Equals(other.createdOn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return HashCode.Combine(id, rfId, (int)model, createdOn);
|
|
|
|
|
}
|
2024-01-29 15:37:19 +01:00
|
|
|
|
}
|