private void DecodeBT_Click(object sender, RoutedEventArgs e)
        {
            DecodeLB.Text = "";
            string[] decode = DecodeTB.Text.Split(' ');

            LZ78 lz = new LZ78();

            List <Tuple <byte, byte> > resultd = new List <Tuple <byte, byte> >();

            for (int i = 0; i < decode.Length - 1; i += 2)
            {
                resultd.Add(new Tuple <byte, byte>(Convert.ToByte(decode[i]), Convert.ToByte(decode[i + 1])));
            }

            List <string> decoderesult = lz.Decode(resultd);

            List <string> r = new List <string>();

            for (int i = 0; i < decoderesult.Count; i++)
            {
                string[] val = decoderesult[i].Split(' ');
                foreach (var item in val)
                {
                    r.Add(item);
                }
            }
            for (int i = 0; i < r.Count; i++)
            {
                if (r[i] != "")
                {
                    int n = Convert.ToInt32(r[i]);
                    DecodeLB.Text += (char)n;
                }
            }
        }
        private void DecodeFileBT_Click(object sender, RoutedEventArgs e)
        {
            byte[] byt = File.ReadAllBytes(@"..\LZ78Encode.bin");

            List <Tuple <byte, byte> > resultbin = new List <Tuple <byte, byte> >();



            for (int i = 0; i < byt.Length / 2; i++)
            {
                resultbin.Add(new Tuple <byte, byte>(byt[2 * i], byt[2 * i + 1]));
            }


            for (int j = 0; j < resultbin.Count; j += 256)
            {
                List <Tuple <byte, byte> > resultdec = resultbin.Skip(j).Take(256).ToList();

                LZ78          lz           = new LZ78();
                List <string> decoderesult = lz.Decode(resultdec);
                List <string> r            = new List <string>();
                for (int i = 0; i < decoderesult.Count; i++)
                {
                    string[] val = decoderesult[i].Split(' ');
                    foreach (var item in val)
                    {
                        r.Add(item);
                    }
                }
                TextWriter ws = new StreamWriter(@"..\LZ78DecodeBin.txt", true);
                for (int i = 0; i < r.Count; i++)
                {
                    if (r[i] != "")
                    {
                        int n = Convert.ToInt32(r[i]);
                        ws.Write((char)n);
                    }
                }
                ws.Close();
            }
        }