public override void Write(LineWriter writer) { writer.WriteLine($"{Tag}({Category}) = {Value}"); { base.Write(writer); var nestedWriter = writer.Nest(); foreach (var keyValue in Values) { nestedWriter.WriteLine(keyValue.Key + " = " + keyValue.Value); } } writer.WriteLine("End" + Tag); }
private void ReadTaskMain() { bool keepOnReading = true; StreamReader reader = null; while (keepOnReading) { // If not already reading, find something to read if (reader == null) { reader = GetStreamReader(); } // Check for data on our current reader if (reader != null) { string line; try { while ((line = reader.ReadLine()) != null) { LineWriter.WriteLine(line); } } catch (IOException ex) { LineWriter.WriteLine(string.Format(">>>> {0} <<<<", ex.Message)); reader = null; continue; } } // Check for file system events WatcherEvent watcherEvent = null; lock (eventQueueLock) { if (eventQueue.Count == 0) { Monitor.Wait(eventQueueLock, FilePollingMs); } if (eventQueue.Count > 0) { watcherEvent = eventQueue.Dequeue(); keepOnReading = watcherEvent != null; } } if (watcherEvent != null) { reader = HandleWatcherEvent(reader, watcherEvent); } } }
private StreamReader GetStreamReader() { StreamReader streamReader = null; var filePath = FindFilePath(); if (filePath != null) { streamReader = FindTailOf(filePath); if (streamReader != null) { LineWriter.WriteLine(string.Format("++++++ File: {0} ++++++", filePath)); OnFileFound(filePath); } } return(streamReader); }
public void WriteLine_ShouldDisplayCorrectText() { using (var sw = new StringWriter()) { // Arrange LineWriter lineWriter = new LineWriter(); Console.SetOut(sw); int hierarchyLevel = 0; EmployeeModel employeeModel = new EmployeeModel(1, 0, "A", "B", "C", "D", "E", "1", "2", "3"); Employee employee = new Employee(employeeModel, hierarchyLevel); string expected = "1, 0, A, B, C, D, E"; // Act lineWriter.WriteLine(employee); var result = sw.ToString().Trim(); // Assert Assert.AreEqual(expected, result, "Employee was not corectly displayed"); } }
public override void Execute(IJobExecutionContext context) => LineWriter.WriteLine($"[Job 1] Execute called at \t{DateTime.Now.TimeOfDay}");
public override void Write(LineWriter writer) { writer.WriteLine(Line.Content); }