示例#1
0
        private void EncodeFileBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            DialogResult   res            = openFileDialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                huffmanResults = GenerateHuffmanEverythingSteps(File.ReadAllBytes(openFileDialog.FileName));
                currentStep    = 0;
                UpdateStepLbl();
                DisplayPic.Refresh();
            }
        }
示例#2
0
 private void PreviousStepBtn_Click(object sender, EventArgs e)
 {
     if (huffmanResults == null)
     {
         return;
     }
     if (currentStep - 1 >= 0)
     {
         currentStep--;
     }
     UpdateStepLbl();
     DisplayPic.Refresh();
 }
示例#3
0
 private void NextStepBtn_Click(object sender, EventArgs e)
 {
     if (huffmanResults == null)
     {
         return;
     }
     if (currentStep + 1 < huffmanResults.steps.Count)
     {
         currentStep++;
     }
     UpdateStepLbl();
     DisplayPic.Refresh();
 }
示例#4
0
        private void EncodeNewFileBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            DialogResult   res            = openFileDialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                huffmanResults.steps.Clear();
                string resultingString = HuffmanEncode(File.ReadAllBytes(openFileDialog.FileName), huffmanResults);
                HuffmanDecode(huffmanResults, resultingString);
                currentStep = 0;
                UpdateStepLbl();
                DisplayPic.Refresh();
            }
        }
示例#5
0
 private void ASCIIChk_CheckedChanged(object sender, EventArgs e)
 {
     useASCII = ASCIIChk.Checked;
     DisplayPic.Refresh();
 }