Ejemplo n.º 1
0
 /** 计算方法 */
 private string Hex2ChineseChar_Method(string text)
 {
     byte[] bs = MyTools.HexStringToBytes(Regex.Replace(text, @"\s", ""));
     if (bs == null)
     {
         return("数据不合法,请参照提示重新输入!");
     }
     if (this.radioButton01_01.Checked)
     {
         if (this.radioButton01_03.Checked)
         {
             return(MyTools.addBlank(Encoding.GetEncoding("GBK").GetString(bs), int.Parse(this.textBox01_01.Text), true));
         }
         else
         {
             return(Encoding.GetEncoding("GBK").GetString(bs));
         }
     }
     else
     {
         if (this.radioButton01_03.Checked)
         {
             return(MyTools.addBlank(Encoding.GetEncoding("UTF-8").GetString(bs), int.Parse(this.textBox01_01.Text), true));
         }
         else
         {
             return(Encoding.GetEncoding("UTF-8").GetString(bs));
         }
     }
 }
Ejemplo n.º 2
0
 /** 执行按钮触发 */
 private void btnTransExecute05_Click(object sender, EventArgs e)
 {
     if (radioButton05_01.Checked)
     {
         textTransResult05.Text = MyTools.addBlank(textTransData05.Text, int.Parse(this.textBox05_01.Text), false);
     }
     else
     {
         textTransResult05.Text = Regex.Replace(textTransData05.Text, @"\s", "");
     }
 }
Ejemplo n.º 3
0
 /** 计算方法 */
 private string ChineseCharToHex_Method(string str)
 {
     if (this.radioButton02_01.Checked)
     {
         byte[] bytes = Encoding.GetEncoding("GBK").GetBytes(str);
         if (this.radioButton02_03.Checked)
         {
             return(MyTools.addBlank(MyTools.BytesToHexString(bytes), int.Parse(this.textBox02_01.Text), false));
         }
         return(MyTools.BytesToHexString(bytes));
     }
     else
     {
         byte[] bytes = Encoding.GetEncoding("UTF-8").GetBytes(str);
         if (this.radioButton02_03.Checked)
         {
             return(MyTools.addBlank(MyTools.BytesToHexString(bytes), int.Parse(this.textBox02_01.Text), false));
         }
         return(MyTools.BytesToHexString(bytes));
     }
 }