예제 #1
0
        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);
            }
        }
예제 #2
0
 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;
     }
 }
예제 #3
0
 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;
     }
 }