Example #1
0
        /// <summary>
        /// The static Main method.
        /// </summary>
        public static int Main(string[] args)
        {
            Log.Logger = new ConsoleLogger();

            var options = new Options();
            DateTime start = DateTime.Now;

            try {
                int result = options.ParseCommandLine(args);
                if (result != 0) {
                    return result;
                }
                Log.IsDebugEnabled = options.Debug;
                Log.IsVerboseEnabled = options.Verbose;
                var main = new Program(options);
                return main.Run();
            } catch (Exception ex) {
                string msg = "Exception occurred: " + ex;
                Log.WriteError(msg);
                if (options.Verbose) {
                    Log.WriteError(ex.StackTrace);
                }
                return 5;
            } finally {
                DateTime end = DateTime.Now;
                TimeSpan runtime = end.Subtract(start);
                if (runtime < new TimeSpan(0, 0, 1)) {
                    Log.WriteInfo("DC took " + runtime.Milliseconds + " ms.");
                } else if (runtime < new TimeSpan(0, 1, 0)) {
                    Log.WriteInfo("DC took " + runtime.TotalSeconds + " s.");
                } else if (runtime < new TimeSpan(1, 0, 0)) {
                    Log.WriteInfo("DC took " + runtime.Minutes + " min and " + runtime.Seconds + " s.");
                } else {
                    Log.WriteInfo("DC took " + runtime.TotalHours + " hours.");
                }
            }
        }
Example #2
0
 public DependencyGrapher(DependencyChecker checker, Options options)
 {
     _checker = checker;
     _options = options;
 }
Example #3
0
 public Program(Options options)
 {
     _options = options;
     _checker = new DependencyChecker();
     _grapher = new DependencyGrapher(_checker, _options);
 }