using System; using System.Runtime.CompilerServices; namespace ln.objects.catalog { public class ODBInteger : ODBValue { public ODBInteger(int i) : base(0x10, i) { } public override byte[] Serialize() => BitConverter.GetBytes((int)Value); protected override int compare(ODBEntity other) => (int)Value - (int)(other as ODBValue).Value; static ODBInteger() { RegisterDeserializer(0x10, (b, o, l) => new ODBInteger(BitConverter.ToInt32(b, o))); } } public class ODBUInteger : ODBValue { public ODBUInteger(uint i) : base(0x11, i) { } public override byte[] Serialize() => BitConverter.GetBytes((uint)Value); protected override int compare(ODBEntity other) { long d = Convert.ToInt64((uint)Value) - Convert.ToInt64((uint)(other as ODBValue).Value); if (d == 0) return 0; if (d < 0) return -1; return 1; } static ODBUInteger() { RegisterDeserializer(0x11, (b, o, l) => new ODBUInteger(BitConverter.ToUInt32(b, o))); } } }