Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            byte[] test     = new byte[12];
            byte[] resultEn = new byte[0];
            byte[] resultDc = new byte[0];
            test[0]  = 0x45;
            test[1]  = 0x00;
            test[2]  = 0x00;
            test[3]  = 0x2c;
            test[4]  = 0x4c;
            test[5]  = 0x79;
            test[6]  = 0x00;
            test[7]  = 0x00;
            test[8]  = 0x40;
            test[9]  = 0x06;
            test[10] = 0x4f;
            test[11] = 0x37;


            resultEn = COBSCodec.encode(test);
            resultDc = COBSCodec.decode(resultEn);

            //resultEn = COBSCodecC.  COBSCodec.encode(test);
            //resultDc = COBSCodec.decode(resultEn);
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            byte[] hexDataIn = new byte[0];
            hexDataIn = StringToByteArrayFastest(textEncoded.Text);

            string hex = BitConverter.ToString(COBSCodec.decode(hexDataIn)).Replace("-", string.Empty);

            textDecode.Text = hex;
        }