improve parsing of entered data in conversion text boxes

This commit is contained in:
Michael Becker 2021-03-23 14:55:00 -04:00
parent c655e4baab
commit b06e3628f0
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C

View File

@ -513,8 +513,14 @@ namespace UniversalEditor.Editors.Binary
return sb.ToString();
}, delegate(string input)
{
long b = Int64.Parse(input);
return BitConverter.GetBytes(b);
string[] pieces = input.Split(new char[] { ' ' });
byte[] bytes = new byte[pieces.Length];
for (int i = 0; i < pieces.Length; i++)
{
bytes[i] = Byte.Parse(pieces[i]);
}
return bytes;
}, 4),
new CONVERSION_DATA(null, "Octal", delegate(byte[] input)
{
@ -780,6 +786,11 @@ namespace UniversalEditor.Editors.Binary
sb.AppendLine(String.Format("Value for {0} must be between {1} and {2}", converter.DataType.Name, minValue, maxValue));
}
}
else
{
// byte array
}
MessageDialog.ShowDialog(sb.ToString(), "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
}