예제 #1
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.Title = "Blockchain Router Job - Ver. " + Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion;

            var settings = GetSettings();

            if (settings == null)
            {
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
                return;
            }

            try
            {
                CheckSettings(settings);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
                return;
            }

            Console.WriteLine("Settings checked!");

            try
            {
                JobApp = new JobApp();
                JobApp.Run(settings);
            }
            catch (Exception e)
            {
                Console.WriteLine("cannot start job! Exception: " + e.Message);
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
                return;
            }

            Console.WriteLine("Router started");
            Console.WriteLine("Utc time: " + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"));

            Console.WriteLine("Press 'q' to quit.");


            while (Console.ReadLine() != "q")
            {
                continue;
            }
            JobApp.Stop().Wait();
        }
예제 #2
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.Title = "Ethereum Core Job - Ver. " + Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion;

            try
            {
                FileInfo fi       = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location);
                var      location = Path.Combine(fi.DirectoryName, "..", "..", "..");
                var      builder  = new ConfigurationBuilder()
                                    .SetBasePath(location)
                                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                    .AddEnvironmentVariables();
                var configuration = builder.Build();

                var app = new JobApp();
                app.Run(configuration);
            }
            catch (Exception e)
            {
                Console.WriteLine("cannot start jobs! Exception: " + e.Message);
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
                return;
            }

            Console.WriteLine("Web job started");
            Console.WriteLine("Utc time: " + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"));

            Console.WriteLine("Press 'q' to quit.");

            while (Console.ReadLine() != "q")
            {
                continue;
            }
        }