Exemplo n.º 1
0
        /// <summary>
        /// Determine log line types and data.
        /// </summary>
        /// <param name="logLines">List of log lines.</param>
        /// <param name="logFileType">File Type - Legacy or FahClient</param>
        /// <exception cref="ArgumentNullException">Throws if logLines is null.</exception>
        public static ICollection <LogLine> GetLogLines(IEnumerable <string> logLines, LogFileType logFileType)
        {
            if (logLines == null)
            {
                throw new ArgumentNullException("logLines");
            }

            // Need to clear any previous data before adding new range.
            var logLineList = logFileType.GetLogLineList();

            logLineList.AddRange(logLines);

            return(logLineList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Determine log line types and data.
        /// </summary>
        /// <param name="logFilePath">Path to the log file.</param>
        /// <param name="logFileType">File Type - Legacy or FahClient</param>
        /// <exception cref="ArgumentNullException">Throws if logFilePath is null.</exception>
        /// <exception cref="ArgumentException">Throws if logFilePath is empty.</exception>
        public static ICollection <LogLine> GetLogLines(string logFilePath, LogFileType logFileType)
        {
            if (logFilePath == null)
            {
                throw new ArgumentNullException("logFilePath");
            }

            if (logFilePath.Length == 0)
            {
                throw new ArgumentException("Argument 'logFilePath' cannot be an empty string.");
            }

            var logLineList = logFileType.GetLogLineList();

            foreach (string line in File.ReadLines(logFilePath))
            {
                logLineList.Add(line);
            }

            return(logLineList);

            //return GetLogLines(File.ReadAllLines(logFilePath), logFileType);
        }
Exemplo n.º 3
0
      /// <summary>
      /// Determine log line types and data.
      /// </summary>
      /// <param name="logLines">List of log lines.</param>
      /// <param name="logFileType">File Type - Legacy or FahClient</param>
      /// <exception cref="ArgumentNullException">Throws if logLines is null.</exception>
      public static ICollection<LogLine> GetLogLines(IEnumerable<string> logLines, LogFileType logFileType)
      {
         if (logLines == null) throw new ArgumentNullException("logLines");

         // Need to clear any previous data before adding new range.
         var logLineList = logFileType.GetLogLineList();
         logLineList.AddRange(logLines);

         return logLineList;
      }
Exemplo n.º 4
0
      /// <summary>
      /// Determine log line types and data.
      /// </summary>
      /// <param name="logFilePath">Path to the log file.</param>
      /// <param name="logFileType">File Type - Legacy or FahClient</param>
      /// <exception cref="ArgumentNullException">Throws if logFilePath is null.</exception>
      /// <exception cref="ArgumentException">Throws if logFilePath is empty.</exception>
      public static ICollection<LogLine> GetLogLines(string logFilePath, LogFileType logFileType)
      {
         if (logFilePath == null) throw new ArgumentNullException("logFilePath");

         if (logFilePath.Length == 0)
         {
            throw new ArgumentException("Argument 'logFilePath' cannot be an empty string.");
         }

         var logLineList = logFileType.GetLogLineList();
         foreach (string line in File.ReadLines(logFilePath))
         {
            logLineList.Add(line);
         }

         return logLineList;

         //return GetLogLines(File.ReadAllLines(logFilePath), logFileType);
      }