static void Main(string[] args) { var configHandler = new AppConfigHandler(); var config = configHandler.GetConfig(); var ipChecker = config.IPChecker; var route53Client = new AmazonRoute53Client(config.Route53AccessKey, config.Route53SecretKey, RegionEndpoint.EUWest1); var dnsUpdater = new DnsUpdater(route53Client); HostFactory.Run(x => { x.Service <IScheduledTaskService>(s => { s.ConstructUsing(name => new DnsUpdateService(new SchedulerRegistry(new ScheduledTaskWorker(dnsUpdater, ipChecker, config.DomainList)))); s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); }); x.RunAsLocalSystem(); x.SetDisplayName("DynDns53 Service"); x.SetServiceName("DynDns53"); x.SetDescription("Updates AWS Route53 records with the current external IP of the system"); x.StartAutomatically(); x.EnableServiceRecovery(s => { s.RestartService(1); s.RestartService(2); s.RestartService(5); }); }); }
static void Main(string[] args) { try { Console.WriteLine(AppConfig.Instance.IsLog); AppConfigHandler.GetConfig <AppConfig>("AppConfig.xml"); AppConfigHandler.EnableRemoteConfig(10008, "56yhgfrt"); //AppConfigHandler.SaveConfig<AppConfig>("AppConfig.xml", true, AppConfig.Instance); string s = string.Empty; while (true) { try { Console.WriteLine(); Console.WriteLine("如何使用 Z.DA 进行数据库访问"); Console.WriteLine("1. 基本数据库操作(从AbstractDA派生)"); Console.WriteLine("2. 基本数据库操作(基本表操作)"); Console.WriteLine("3. 基本数据库操作(执行存储过程)"); Console.WriteLine("4. 基本数据库操作(实现一个长连接, 避免每次执行重复创建和销毁Connection)"); Console.WriteLine("5. 基本数据库操作(实现事务)"); Console.WriteLine("6. 基本数据库操作(打印内部缓存SQL数据)"); Console.WriteLine("7. 基本数据库操作(返回泛型列表的存储过程)"); Console.WriteLine("8. 基本数据库操作(返回存储过程, 不返回任何值)"); Console.WriteLine("9. 基本数据库操作(返回一个字符串数组)"); Console.WriteLine("0, q, x. 退出"); Console.WriteLine("c. 清屏"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.Write("选择样例:"); Console.ForegroundColor = ConsoleColor.Gray; s = Console.ReadLine().ToLower(); Console.ForegroundColor = ConsoleColor.Green; switch (s) { case "1": HowTO_1(); break; case "2": HowTO_2(); break; case "3": HowTO_3(); break; case "4": HowTO_4(); break; case "5": HowTO_5(); break; case "6": HowTO_6(); break; case "7": HowTO_7(); break; case "8": HowTO_8(); break; case "9": HowTO_9(); break; case "0": case "q": case "x": Console.ForegroundColor = ConsoleColor.Gray; return; case "c": Console.Clear(); break; default: Console.Clear(); break; } Console.ForegroundColor = ConsoleColor.Gray; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }