LogSearchMd.cs 838 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace NX_ModelClassLibrary.LogCorrelationModel
  7. {
  8. public class LogSearchMd
  9. {
  10. private const char SplitCHar = '|';
  11. public DateTime Time { get; set; }
  12. public string Message { get; set; }
  13. public string Serialize()
  14. {
  15. return $"{Time}{SplitCHar}{Message}";
  16. }
  17. public static LogSearchMd Deserialize(string txt)
  18. {
  19. LogSearchMd log = new LogSearchMd();
  20. string[] txts = txt.Split(SplitCHar);
  21. txts[0] = txts[0].Replace("发生时间:", "");
  22. return new LogSearchMd()
  23. {
  24. Message = txts[1],
  25. Time = DateTime.Parse(txts[0])
  26. };
  27. }
  28. }
  29. }