예제 #1
0
        /// <summary>
        /// Logic to handle one file per thread.
        /// </summary>
        /// <param name="fileInfo"> Log file to process </param>
        private static void processLogFile(FileInfo fileInfo)
        {
            string          pattern = @"^device_(.+).txt";
            Regex           rgx     = new Regex(pattern, RegexOptions.IgnoreCase);
            MatchCollection matches = rgx.Matches(fileInfo.Name);

            if (matches.Count != 1 && matches[0].Groups.Count != 2)
            {
                return;
            }

            string       deviceId = matches[0].Groups[1].Value;
            StreamReader eventLog = new StreamReader(fileInfo.FullName);

            IEventCounter eventCounter = EventCounter.Instance;

            eventCounter.ParseEvents(deviceId, eventLog);
            int faultySeqCount = eventCounter.GetEventCount(deviceId);

            Console.WriteLine(string.Format("File : {0} | Device ID : {1} | Fault Event Count : {2}", fileInfo.Name, deviceId, faultySeqCount));
        }
예제 #2
0
 public void ProcessorTests_ParseEvents_MisingArguments()
 {
     mCounter.ParseEvents("", null);
 }