public void Execute(StringScanner s, Env env) { if (s.Scan("false|off").Length > 0 && _writer != null) { env.Display.TextWriters.Remove(_writer); env.Input.OnWrite = null; _writer.Flush(); _writer.Dispose(); _writer = null; } else if (_writer == null) { if (env.Engine == null) { throw ShellException.NoDatabase(); } var path = Path.GetFullPath(string.Format("LiteDB-spool-{0:yyyy-MM-dd-HH-mm}.txt", DateTime.Now)); _writer = File.CreateText(path); env.Display.TextWriters.Add(_writer); env.Input.OnWrite = (t) => _writer.Write(t); } }
public void Execute(StringScanner s, Env env) { if (env.Engine == null) { throw ShellException.NoDatabase(); } var filename = s.Scan(@".+").Trim(); foreach (var line in File.ReadAllLines(filename)) { env.Input.Queue.Enqueue(line); } }
public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env) { if (engine == null) { throw ShellException.NoDatabase(); } var filename = s.Scan(@".+").Trim(); foreach (var line in File.ReadAllLines(filename)) { input.Queue.Enqueue(line); } }