diff --git a/CShocker/CShocker.csproj b/CShocker/CShocker.csproj
index dc50416..97dca06 100644
--- a/CShocker/CShocker.csproj
+++ b/CShocker/CShocker.csproj
@@ -7,7 +7,7 @@
Glax
https://github.com/C9Glax/CShocker
git
- 2.0.1
+ 2.0.2
diff --git a/CShocker/Ranges/DurationRange.cs b/CShocker/Ranges/DurationRange.cs
index 59481c6..42a5e5b 100644
--- a/CShocker/Ranges/DurationRange.cs
+++ b/CShocker/Ranges/DurationRange.cs
@@ -11,4 +11,9 @@ public class DurationRange : RandomIntegerRange
{
return obj is IntensityRange && base.Equals(obj);
}
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine("DR", base.GetHashCode());
+ }
}
\ No newline at end of file
diff --git a/CShocker/Ranges/IntensityRange.cs b/CShocker/Ranges/IntensityRange.cs
index 9b57e5e..11c36d1 100644
--- a/CShocker/Ranges/IntensityRange.cs
+++ b/CShocker/Ranges/IntensityRange.cs
@@ -11,4 +11,9 @@ public class IntensityRange : RandomIntegerRange
{
return obj is IntensityRange && base.Equals(obj);
}
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine("IR", base.GetHashCode());
+ }
}
\ No newline at end of file
diff --git a/CShocker/Ranges/RandomIntegerRange.cs b/CShocker/Ranges/RandomIntegerRange.cs
index eb618b3..78e2a82 100644
--- a/CShocker/Ranges/RandomIntegerRange.cs
+++ b/CShocker/Ranges/RandomIntegerRange.cs
@@ -2,7 +2,7 @@
public abstract class RandomIntegerRange
{
- public short Min, Max;
+ public readonly short Min, Max;
internal RandomIntegerRange(short min, short max, short minLimit, short maxLimit)
{
if (max - min < 0)
@@ -27,8 +27,16 @@ public abstract class RandomIntegerRange
public override bool Equals(object? obj)
{
- return obj is RandomIntegerRange rir &&
- this.Min == rir.Min &&
- this.Max == rir.Max;
+ return obj is RandomIntegerRange rir && Equals(rir);
+ }
+
+ private bool Equals(RandomIntegerRange other)
+ {
+ return Min == other.Min && Max == other.Max;
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(Min, Max);
}
}
\ No newline at end of file