public string HexStringtoOther(string hexStr, string type) { try { switch (type) { case "float": return(DataTypeTransfer.GetFloat(hexStr).ToString()); case "double": return(DataTypeTransfer.GetDouble(hexStr).ToString()); case "int": return(DataTypeTransfer.GetInt(hexStr).ToString()); case "uint": return(DataTypeTransfer.GetUint(hexStr).ToString()); case "string": return(DataTypeTransfer.GetString(hexStr).ToString()); default: break; } return(null); } catch (Exception) { return(null); } }
private void TextBox_String_TextChanged(object sender, TextChangedEventArgs e) { if (((TextBox)sender).IsFocused == false) { return; } if (TextBox_String.Text == "" || TextBox_String.Text == null) { TextBox_Output4.Text = ""; return; } try { TextBox_Output4.Text = DataTypeTransfer.toHexString(TextBox_String.Text); } catch (Exception) { return; } }
private void TextBox_Uint_TextChanged(object sender, TextChangedEventArgs e) { if (((TextBox)sender).IsFocused == false) { return; } if (TextBox_Uint.Text == "" || TextBox_Uint.Text == null) { TextBox_Output3.Text = ""; return; } try { uint value = Convert.ToUInt32(TextBox_Uint.Text); TextBox_Output3.Text = DataTypeTransfer.toHexString(value); } catch (Exception) { return; } }