static void Interactive() { Console.Write("Data [ENTER to exit]: "); string data = Console.ReadLine(); if (String.IsNullOrEmpty(data)) { return; } byte[] byteData = Encoding.UTF8.GetBytes(data); Console.Write("Chunk size: "); int chunkSize = Convert.ToInt32(Console.ReadLine()); Console.Write("Shift size: "); int shiftSize = Convert.ToInt32(Console.ReadLine()); _Bytes = new Bytes(byteData, chunkSize, shiftSize); Console.WriteLine("Input data size : " + byteData.Length); Console.WriteLine("Chunk count : " + _Bytes.ChunkCount()); byte[] bytes = null; bool finalChunk = false; long position = 0; byte[] newData = null; while (true) { Console.Write("Command [next advance q chunksize shiftsize nextstart remaining]: "); string userInput = null; while (String.IsNullOrEmpty(userInput)) { userInput = Console.ReadLine(); } switch (userInput) { case "next": bytes = _Bytes.GetNextChunk(out position, out newData, out finalChunk); if (bytes != null && bytes.Length > 0 && newData != null && newData.Length > 0) { Console.WriteLine("Position : " + position); Console.WriteLine("Chunk data : '" + Encoding.UTF8.GetString(bytes) + "'"); Console.WriteLine("New data : '" + Encoding.UTF8.GetString(newData) + "'"); if (finalChunk) { Console.WriteLine("*** Final chunk ***"); } } else { Console.WriteLine("No data"); } break; case "advance": Console.WriteLine("Advancing to next new chunk"); _Bytes.AdvanceToNewChunk(); break; case "q": return; case "chunksize": Console.WriteLine("Chunk size: " + _Bytes.ChunkSize); break; case "shiftsize": Console.WriteLine("Shift size: " + _Bytes.ShiftSize); break; case "nextstart": Console.WriteLine("Next start position: " + _Bytes.NextStartPosition); break; case "remaining": Console.WriteLine("Remaining bytes: " + _Bytes.BytesRemaining); break; default: break; } } }