Esempio n. 1
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         var N    = int.Parse(this.textBox3.Text);
         var eles = new ECElement[this.listBox3.Items.Count];
         for (var i = 0; i < this.listBox3.Items.Count; i++)
         {
             eles[i] = this.listBox3.Items[i] as ECElement;
         }
         var bytes  = ECSplit.JoinDataWithBFTN(eles, N);
         var endpos = bytes.Length;
         for (var i = 0; i < bytes.Length; i++)
         {
             if (bytes[i] == 0)
             {
                 endpos = i;
                 break;
             }
         }
         var base64str = System.Text.Encoding.UTF8.GetString(bytes, 0, endpos);
         var srcbyte   = Convert.FromBase64String(base64str);
         var info      = System.Text.Encoding.UTF8.GetString(srcbyte);
         this.label2.Text = info;
     }
     catch (Exception err)
     {
         MessageBox.Show("join fail:" + err.ToString());
     }
 }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {//Split
            var txtbin    = System.Text.Encoding.UTF8.GetBytes(this.textBox1.Text);
            var base64str = Convert.ToBase64String(txtbin);
            var srcdata   = System.Text.Encoding.UTF8.GetBytes(base64str);
            var N         = int.Parse(this.textBox2.Text);
            var eles      = ECSplit.SplitDataWithBFTN(srcdata, N);

            this.listBox2.Items.Clear();
            for (var i = 0; i < eles.Length; i++)
            {
                this.listBox2.Items.Add(eles[i]);
            }
        }