CShock/CShocker/Shockers/PiShockShocker.cs

31 lines
723 B
C#
Raw Normal View History

using CShocker.Devices.Abstract;
using CShocker.Shockers.Abstract;
namespace CShocker.Shockers;
public class PiShockShocker : Shocker
{
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();
}
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;
}
}