static void ReadStream() { string key = InputString("Object key:", null, false); if (!_Dedupe.Exists(key)) { Console.WriteLine("Object does not exist"); return; } DedupeStream stream = _Dedupe.GetStream(key); if (stream == null) { Console.WriteLine("Unable to retrieve stream"); return; } bool exiting = false; string userInput = null; byte[] buffer = null; int count = 0; int bytesRead = 0; while (!exiting) { Console.Write("Stream :: " + key + " [? for help] > "); userInput = Console.ReadLine(); if (String.IsNullOrEmpty(userInput)) { continue; } switch (userInput) { case "?": Console.WriteLine("Available stream commands:"); Console.WriteLine(" q exit stream menu"); Console.WriteLine(" cls clear the screen"); Console.WriteLine(" pos display stream position"); Console.WriteLine(" jump jump to specific position"); Console.WriteLine(" begin move to beginning of stream"); Console.WriteLine(" end move to end of stream"); Console.WriteLine(" read read a specified number of bytes"); Console.WriteLine(""); break; case "q": exiting = true; break; case "c": case "cls": Console.Clear(); break; case "pos": Console.WriteLine(stream.Position); break; case "jump": Console.Write("Position: "); stream.Position = Convert.ToInt64(Console.ReadLine()); break; case "begin": stream.Seek(0, SeekOrigin.Begin); break; case "end": stream.Seek(0, SeekOrigin.End); break; case "read": Console.Write("Count: "); count = Convert.ToInt32(Console.ReadLine()); buffer = new byte[count]; bytesRead = stream.Read(buffer, 0, count); if (bytesRead > 0) { Console.WriteLine(bytesRead + " bytes: " + Encoding.UTF8.GetString(buffer)); } else { Console.WriteLine("0 bytes read"); } break; } } }