Example #1
0
        public static void TestSingle()
        {
            var fileList = Directory.GetFiles(testResourceDirectory, "*.PRM");

            Parser p = new Parser();
            var startTime = DateTime.Now;

            foreach (var file in fileList)
            {
                var fileName = file.Substring(file.LastIndexOf("\\") + 1);
                Console.WriteLine(file);
                p.parsePRM(file, fileName);
            }

            var endTime = DateTime.Now;

            Console.WriteLine("Use Time(Milliseconds):" + (endTime - startTime).TotalMilliseconds);
            Console.WriteLine("Total PRM Count:" + fileList.Count());
            Console.WriteLine("Total Line:" + p.TotalLineCount);
            Console.WriteLine("Total Word:" + p.TotalWordCount);
            Console.ReadKey();
        }
Example #2
0
        public static void TestParalle()
        {
            var fileList = Directory.GetFiles(testResourceDirectory, "*.PRM");
            Parser p = new Parser();
            var startTime = DateTime.Now;

            Parallel.ForEach(fileList, delegate(string path)
            {
                var fileName = path.Substring(path.LastIndexOf("\\") + 1);
                Console.WriteLine(fileName);
                p.parsePRM(path, fileName);

            });

            var endTime = DateTime.Now;

            Console.WriteLine("Use Time(Milliseconds):" + (endTime - startTime).TotalMilliseconds);
            Console.WriteLine("Total PRM Count:" + fileList.Count());
            Console.WriteLine("Total Line:" + p.TotalLineCount);
            Console.WriteLine("Total Word:" + p.TotalWordCount);
            Console.ReadKey();
        }