Exemple #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();
            }
        }
Exemple #2
0
 private void PreviousStepBtn_Click(object sender, EventArgs e)
 {
     if (huffmanResults == null)
     {
         return;
     }
     if (currentStep - 1 >= 0)
     {
         currentStep--;
     }
     UpdateStepLbl();
     DisplayPic.Refresh();
 }
Exemple #3
0
 private void NextStepBtn_Click(object sender, EventArgs e)
 {
     if (huffmanResults == null)
     {
         return;
     }
     if (currentStep + 1 < huffmanResults.steps.Count)
     {
         currentStep++;
     }
     UpdateStepLbl();
     DisplayPic.Refresh();
 }
Exemple #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();
            }
        }
Exemple #5
0
 private void ASCIIChk_CheckedChanged(object sender, EventArgs e)
 {
     useASCII = ASCIIChk.Checked;
     DisplayPic.Refresh();
 }