2024-02-01 23:03:28 +01:00
|
|
|
|
using CShocker.Devices.Abstract;
|
|
|
|
|
using CShocker.Shockers.Abstract;
|
2024-01-29 15:37:19 +01:00
|
|
|
|
|
|
|
|
|
namespace CShocker.Shockers;
|
|
|
|
|
|
2024-02-01 23:03:28 +01:00
|
|
|
|
public class PiShockShocker : Shocker
|
2024-01-29 15:37:19 +01:00
|
|
|
|
{
|
2024-02-12 02:01:31 +01:00
|
|
|
|
public readonly string Code;
|
2024-01-29 17:05:13 +01:00
|
|
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
|
{
|
|
|
|
|
return obj is PiShockShocker pss && Equals(pss);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool Equals(PiShockShocker other)
|
|
|
|
|
{
|
|
|
|
|
return Code == other.Code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return Code.GetHashCode();
|
|
|
|
|
}
|
2024-02-01 23:03:28 +01:00
|
|
|
|
|
|
|
|
|
public PiShockShocker(Api api, string code) : base(api)
|
|
|
|
|
{
|
|
|
|
|
if (api is not PiShockApi)
|
|
|
|
|
throw new Exception($"API-Type {api.GetType().FullName} is not usable with Shocker {this.GetType().FullName}");
|
|
|
|
|
Code = code;
|
|
|
|
|
}
|
2024-01-29 15:37:19 +01:00
|
|
|
|
}
|