Base for 4.3 work. Split Nadeko.Common into a separate project

This commit is contained in:
Kwoth
2022-07-11 00:06:19 +02:00
parent 1396d9d55a
commit f41b1fb93c
113 changed files with 271 additions and 255 deletions

View File

@@ -0,0 +1,40 @@
namespace Nadeko.Common;
public readonly struct ShmartNumber : IEquatable<ShmartNumber>
{
public long Value { get; }
public string? Input { get; }
public ShmartNumber(long val, string? input = null)
{
Value = val;
Input = input;
}
public static implicit operator ShmartNumber(long num)
=> new(num);
public static implicit operator long(ShmartNumber num)
=> num.Value;
public static implicit operator ShmartNumber(int num)
=> new(num);
public override string ToString()
=> Value.ToString();
public override bool Equals(object? obj)
=> obj is ShmartNumber sn && Equals(sn);
public bool Equals(ShmartNumber other)
=> other.Value == Value;
public override int GetHashCode()
=> Value.GetHashCode();
public static bool operator ==(ShmartNumber left, ShmartNumber right)
=> left.Equals(right);
public static bool operator !=(ShmartNumber left, ShmartNumber right)
=> !(left == right);
}