private void btnEncode_Click(object sender, EventArgs e) { noBitsForIndex = (int)lbIndex.SelectedItem; if (inputFileName != "") { int action = (chkDisplayTokens.Checked) ? 1 : 0; compresser = new LZW(action, noBitsForIndex); var ok = compresser.compress(inputFileName); if (ok == true) { tbTokens.Text += "\r\nCompression was a great success.\r\n"; } if (chkDisplayTokens.Checked) { Dictionary <int, List <String> > dictionaryFromInput = compresser.getDictionaryElements(); displayTokens(dictionaryFromInput); } } else { throw new Exception("You haven't selecetd any file."); } }
private void btnDecode_Click(object sender, EventArgs e) { if (compressedFileName != "") { compresser = new LZW(); var ok = compresser.decompress(compressedFileName); if (ok == true) { tbTokens.Text += "\r\nDecompression was a great success.\r\n"; } } else { throw new Exception("You haven't selecetd any file."); } }