private void Decode(string name) { Reader io = new Reader(name); LZWAS decoder = new LZWAS(io); FileStream outfile = File.Open(userOutName != null ? userOutName : name.Replace(".lzwas", ""), FileMode.Create); while (!io.IsEndOfStream()) { outfile.WriteByte(decoder.Decode()); } Console.Write("done"); }
private void Encode(string name) { FileStream file = File.Open(name, FileMode.Open); String outName = userOutName != null ? userOutName : (name + ".lzwas"); Writer writerIo = new Writer(outName); LZWAS encoder = new LZWAS(writerIo); while (file.Position != file.Length) { Byte input = (Byte)file.ReadByte(); encoder.Encode(input); } encoder.EncoderFinalize(); file.Close(); writerIo.CloseStream(); }