public void Encode() { try { int newByteCode = 0; if (Type == Types.Register) { newByteCode = RegisterMap.EncodeRegister(LocalDecodeText); } else // if (Type == Types.Number) { newByteCode = Convert.ToInt32(LocalDecodeText, 16); if (newByteCode > NumericType.MaximumValue) { throw new Exception(""); } } if (newByteCode < 0) { throw new Exception(""); } LocalByteCode = newByteCode; Erroneous = false; } catch (Exception e) { Erroneous = true; } }
public void Decode() { Erroneous = false; if (Type == Types.Register) { int mapEntry = BitExtract(); LocalDecodeText = RegisterMap.DecodeRegister(RegisterType.RegisterMapEntry, mapEntry); } else // if (Type == Types.Number) { LocalDecodeText = Convert.ToString(BitExtract(), 16); } }