public MonoExpanderClient(Main main)
 {
     this.main = main;
     this.downloadInfos = new Dictionary<string, DownloadInfo>();
     this.typeCache = new Dictionary<string, Type>();
     this.handleMethodCache = new Dictionary<Type, System.Reflection.MethodInfo>();
 }
Example #2
0
        public static void Main(string[] args)
        {
            var log = LogManager.GetLogger("Program");

            log.Info("Starting");

            try
            {
                var arguments = Args.Parse<Arguments>(args);

                var cts = new CancellationTokenSource();

                Console.CancelKeyPress += (s, e) =>
                {
                    e.Cancel = true;
                    cts.Cancel();
                };

                try
                {
                    using (var main = new Main(arguments))
                    {
                        main.Execute(cts.Token);
                    }
                }
                finally
                {
                    Console.CursorVisible = true;
                }

            }
            catch (ArgException ex)
            {
                log.Warn(ex.Message);
                Console.WriteLine(ArgUsage.GenerateUsageFromTemplate<Arguments>());
            }
            catch (Exception ex)
            {
                log.Error(ex, "Unhandled exception");
                Console.WriteLine("Unhandled exception: {0}", ex);
            }

            log.Info("Closing");
        }