private static string DecodeStringRLE(ref string str) { using (RLE inst_rle = new RLE()) { string str_decoded = inst_rle.Decode(ref str); Console.WriteLine("\r\nBase string ({0} chars): {1}\r\nAfter RLE-decoding ({2} chars): {3}", str.Length, str, str_decoded.Length, str_decoded); return(str_decoded); } }
private static String EncodeStringRLE(ref string str) { using (RLE inst_rle = new RLE()) { string str_encoded = inst_rle.Encode(ref str); Console.WriteLine("\r\nBase string ({0} chars): {1}\r\nAfter RLE-encoding ({2} chars): {3}\r\nCompression percentage: %{4}", str.Length, str, str_encoded.Length, str_encoded, inst_rle.GetPercentage((double)str.Length, (double)str_encoded.Length).ToString()); return(str_encoded); } }