Ejemplo n.º 1
0
        static void Main(string[] args)
        {
#if DEBUG
            args = new string[2]
            {
                @"C:\Temp\forums.db",
                @"C:\Temp\output"
            };
#endif
            string source      = String.Empty;
            string destination = String.Empty;
            bool   validArgs   = false;

            if (args.Length != 2 && args.Length != 0)
            {
                Console.WriteLine("Invalid Arguments");
                return;
            }
            else if (args.Length == 2)
            {
                validArgs = ValidateArgs(args[0], args[1]);
                if (validArgs)
                {
                    source      = args[0];
                    destination = args[1];
                }
            }
            else if (args.Length == 0)
            {
                source      = GetSourceFromUser();
                destination = GetDestinationFromUser();
                validArgs   = true;
            }

            if (validArgs)
            {
                using (ParallelProcessor processor = new ParallelProcessor(source, destination))
                    using (ConsoleStats stats = new ConsoleStats(processor))
                    {
                        Task.Run(async() =>
                        {
                            await processor.Start();
                        }).GetAwaiter().GetResult();
                    }
            }
            Console.WriteLine("Completed Sqlite processing");
#if DEBUG
            Console.ReadLine();
#endif
        }
Ejemplo n.º 2
0
 public ConsoleStats(ParallelProcessor processor)
 {
     startTime      = DateTime.Now;
     this.processor = processor;
     timer          = new Timer(UpdateConsole, null, 250, Timeout.Infinite);
 }