Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- namespace Signature_Mask
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- timer1.Enabled = true;
- }
- private string _text_1, _text_2;
- private char _char_1, _char_2;
- private int _int_1, _int_2;
- private void timer1_Tick(object sender, EventArgs e)
- {
- try
- {
- if (!textBox1.Text.Contains("0x") || !textBox1.Text.Contains(","))
- {
- if (textBox1.Text.Length > 0 && textBox1.Text.Length % 2 != 1)
- {
- textBox2.Enabled = true;
- _text_1 = textBox1.Text.Replace(" ", "");
- for (int i = 0; i < _text_1.Length / 2; i++)
- {
- _int_1 = _int_1 + _int_2;
- _char_1 = _text_1[_int_1];
- _int_2 = 2;
- _char_2 = _text_1[_int_1 + 1];
- _text_2 += "0x" + _char_1 + _char_2 + ", ";
- }
- textBox2.Text = _text_2.Remove(_text_2.Length - 2);
- _int_1 = 0;
- _int_2 = 0;
- _text_2 = "";
- }
- else
- {
- textBox2.Enabled = false;
- textBox2.Text = "";
- }
- }
- else
- {
- string _text;
- _text = textBox1.Text.Replace(",", " ").Replace(" ","");
- textBox2.Text = _text.Replace("0x", " ").Remove(0, 1);
- textBox2.Enabled = true;
- }
- }
- catch(Exception Text_Error)
- {
- timer1.Enabled = false;
- MessageBox.Show(Text_Error.Message,"Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
- textBox1.Text = "";
- textBox2.Text = "";
- _int_1 = 0;
- _int_2 = 0;
- _text_1 = "";
- _text_2 = "";
- timer1.Enabled = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement