public void Serialize(object value, Type sourceType, MaxSerializationAttribute maxSerializationAttribute, ByteWriter byteWriter)
		{
			if (value == null)
				return;

			var timeSpan = sourceType == typeof(TimeSpan?) ? ((TimeSpan?)value).Value : (TimeSpan)value;

			var round = (int)Math.Round(timeSpan.TotalHours * 2);
			byteWriter.Write((byte)round, maxSerializationAttribute.BytePos);
		}
		public void Serialize(object value, Type sourceType, MaxSerializationAttribute maxSerializationAttribute, ByteWriter byteWriter)
		{
			var maxRfAddress = value as MaxRfAddress;
			if (maxRfAddress != null)
			{
				for (var index = 0; index < maxRfAddress.Bytes.Length; index++)
				{
					var b = maxRfAddress.Bytes[index];
					byteWriter.Write(b, maxSerializationAttribute.BytePos + index);
				}
			}
		}
		public void Serialize(object value, Type sourceType, MaxSerializationAttribute maxSerializationAttribute, ByteWriter byteWriter)
		{
			if (value == null)
				return;

			var dateTime = sourceType == typeof(DateTime?) ? ((DateTime?)value).Value : (DateTime)value;

			var leftMonth = (dateTime.Month & 0xe) << 4;
			var rightMonth = (dateTime.Month & 0x1) << 6;
			var day = dateTime.Day & 0x1f;
			var year = (dateTime.Year - 2000) & 0x1f;

			var firstByte = (byte)(leftMonth | day);
			var secondByte = (byte)(rightMonth | year);

			byteWriter.Write(firstByte, maxSerializationAttribute.BytePos);
			byteWriter.Write(secondByte, maxSerializationAttribute.BytePos + 1);
		}
		public void Serialize(object value, Type sourceType, MaxSerializationAttribute maxSerializationAttribute, ByteWriter byteWriter)
		{
			byte[] bytes;
			var baseType = sourceType.GetTypeInfo().IsEnum ? sourceType.GetTypeInfo().DeclaredFields.First().FieldType : sourceType;
			if (baseType == typeof(int))
			{
				var intValue = (int)value;
				bytes = BitConverter.GetBytes(intValue);
			}
			else if (baseType == typeof(long))
			{
				var longValue = (long)value;
				bytes = BitConverter.GetBytes(longValue);
			}
			else if (baseType == typeof(short))
			{
				var longValue = (short)value;
				bytes = BitConverter.GetBytes(longValue);
			}
			else
			{
				throw new Exception();
			}

			bytes = bytes.Take(maxSerializationAttribute.ByteSpan).Reverse().ToArray();

			for (var index = 0; index < bytes.Length && index < maxSerializationAttribute.ByteSpan; index++)
			{
				var b = bytes[index];

				var bitSpan = maxSerializationAttribute.ByteSpan > 1
					? maxSerializationAttribute.ByteSpan*8
					: maxSerializationAttribute.BitSpan;

				var mask = (1 << bitSpan) - 1;
				var value2 = (b & mask) << maxSerializationAttribute.BitPos;
				// 0x00 0x04 0x40 0x00 0x00 0x00
				byteWriter.Write((byte)value2, maxSerializationAttribute.BytePos + index);
			}
		}
		public object Deserialize(byte[] payload, Type targetType, MaxSerializationAttribute maxSerializationAttribute)
		{
			throw new NotImplementedException();
		}