From 758491931ce62ed371250763fc39497363c28aa6 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 28 Jun 2017 22:17:04 +1000 Subject: [PATCH] Forgot to commit ConfigByteAttribute oops --- MCGalaxy/Config/OtherAttributes.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MCGalaxy/Config/OtherAttributes.cs b/MCGalaxy/Config/OtherAttributes.cs index 5b8671b8a..1ca800646 100644 --- a/MCGalaxy/Config/OtherAttributes.cs +++ b/MCGalaxy/Config/OtherAttributes.cs @@ -52,6 +52,20 @@ namespace MCGalaxy.Config { } } + + public class ConfigByteAttribute : ConfigIntAttribute { + + public ConfigByteAttribute(string name, string section, string desc, int defValue, + int min = byte.MinValue, int max = byte.MaxValue) + : base(name, section, desc, defValue, min, max) { + } + + public override object Parse(string value) { + int intValue = (int)base.Parse(value); + return (byte)intValue; // Can't directly unbox object to byte - must unbox to int, then cast to byte + } + } + public sealed class ConfigBoolAttribute : ConfigAttribute { public ConfigBoolAttribute(string name, string section, string desc, bool defValue)