substring - How to read from lineX to lineY C# -


I am trying to parse a .log file and found it in one section that looks like this GetCompressedLogResponse Received: GetCompressedLogResponse: Id = GetCompressedLog, LoggerType = LoadProfileLogger, NumberOfRegisters = 5, NewLogId = 3281, info = HeadOfLoggerIncluded LogID RealTimeClock Logger_Status Logger_Data_Quality EnergyA14 EnergyA23 [KamDatTimeStatus] [No Unit] [No Unit] [KWH] [KWH] ------ -------------------- - ------- ------ ------------------- --------- ------- - 3264 02 2014-03-31 T 0 08: 00 00 00 000000000000 0.17 0.00 3265 02 2014-03-31 TT8: 15: 00 0000 00000000 0.17 0.00 3266 02 2014-03-31 TT 08: 30: 00 0000 00000000 0.17 0.00 3267 02 2014-03-31 TT 08: 45: 00 0000 00000000 0.1 7 0.00 2014-03-31 13: 20: 42,049 DEBUG 4B414D00000001184917.GetConventionalDataTask - Updated timestamp for logger load profile logger over time 31-03-2014 12:20:42

How do I obtain 2 lines between getConventionalDataTask lines, then the line from the program line (in which GetCompressedLogResponse has been received) in which line (the timestamp for the logger was updated) line Want to start reading?

This is how far away I can be able to get:

  Public stable bow isolor start (string lesson) {return text. ("GetCompressedLogResponse Received:"); } Public Static Bull Isologorant (String Text) {Return Text. Consistency ("Updated Timestamp for Logger"); } Public static string GetLoggerType (string text) {GetSubStrings (text, "LoggerType =", ",") back. FirstOrDefault (); } Public static string GetNumberOfRegisters (string text) {GetSubStrings (text, "number of registers =", ","). FirstOver Default (); } Get the public static string GetNewLogId (string text) {GetSubStrings (text, "NewLogId =", ","). FirstOrDefault (); }  

and objects created by me:

  class CompressedLogResponse {public loggerAnnounce LoggerAnnounce {get; Set; } Public listing & lt; Int & gt; Logged {get; Set; } Public listing & lt; DateTime & gt; RealtimeCock {Receive; Set; } Public listing & lt; Int & gt; LoggerStats {Receive; Set; } Public listing & lt; Int & gt; Logger dataquake (get; set;} public list & lt; double & gt; energy A14 {get; set;} public list & lt; double & gt; energy A23 {receive; set;}} class logger translation { Public string loggerType {get} set;} public integer numberofferist {get; set;} public int NewLogId {get; set;}}  

Thanks for any help you provide Can be enabled :)

Can receive text between using individual 2 GetConventionalDataTask are

  string = input file. Read all the text ("C: /log.txt"); Match Me = Reggae Match (Input, @ "GetConventionalDataTask \ s- \ s (. *. GetConventionalDataTask", RegexOptions.Singleline); Console.WriteLine (m.Groups [1]);  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

c# - WPF Expander overlay used in ItemsControl -

class - Kivy: how to instantiate a dynamic classes in python -