예제 #1
0
        public static HuffmanTree2 Create(string file)
        {
            var tree = new HuffmanTree2();
            var path = file.Substring(file.Length - 4) + "_huffman.txt";

            if (File.Exists(path))
            {
                tree.LoadTxt(path);
            }
            else
            {
                tree.Encode(HuffmanNodeList.Create(file));
                tree.Save2Txt(file);
            }
            return(tree);
        }
예제 #2
0
 public HuffmanEncoder(HuffmanTree2 tree)
 {
     _dat.Build(tree.table);
     _reDat.Build(tree.reTable);
 }