コード例 #1
0
 private void hff_button2_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string msg = HFF.Decode(hff_textBox_c.Text);
         hff_textBox_d.Text = msg;
     }
     catch
     {
         hff_listBox.Items.Clear();
         hff_textBox1.Clear();
         hff_textBox_c.Clear();
         hff_textBox_d.Clear();
         hff_textBlock.Text = "Huffman";
     }
 }
コード例 #2
0
 private void hff_button1_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string arch = HFF.Encode(this.hff_textBox1.Text);
         this.hff_listBox.Items.Clear();
         for (int i = 0; i < HFF.Table.Count; i++)
         {
             this.hff_listBox.Items.Add("\"" + HFF.Table[i].Key + "\" : " + HFF.Table[i].Value.Weight + " = " + new string((HFF.getCode(HFF.Table[i].Value)).Reverse().ToArray()));
         }
         hff_textBox_c.Text = arch;
     }
     catch
     {
         hff_listBox.Items.Clear();
         hff_textBox1.Clear();
         hff_textBox_c.Clear();
         hff_textBox_d.Clear();
         hff_textBlock.Text = "Huffman";
     }
 }