static void Test4() { //ApiTest.Main(); //TestService.ServiceMain(); //HeaderLengthPacket.Test(); var svr = new DNSServer(); svr.Start(); }
static void Main(string[] args) { DNSServer s = new DNSServer(); s.VerboseLog += VerboseLog; s.ErrorLog += ErrorLog; s.Start(); for (string command; (command = CommandlineHelper.ParseCommand()) != CommandlineHelper.COMMAND_EXIT;) { CommandlineHelper.Execute(s, command); } s.Stop(); }
protected override void StartWork(String reason) { // 修改数据库默认目录 var xcode = XCode.Setting.Current; if (xcode.IsNew) { xcode.ShowSQL = false; xcode.SQLiteDbPath = "..\\Data"; xcode.Save(); } // 初始化数据库 Task.Run(() => { var n = 0; n = Rule.Meta.Count; n = Record.Meta.Count; n = Visitor.Meta.Count; }); var set = Setting.Current; // 启动服务器 var svr = new DNSServer(); if (set.Debug) { svr.Log = XTrace.Log; } //svr.Parent = set.DNSServer + "," + svr.Parent; svr.Parents.AddRange(svr.GetLocalDNS()); svr.SetParents(set.DNSServer); svr.OnRequest += Server_OnRequest; svr.OnResponse += Server_OnResponse; svr.OnNew += Server_OnNew; svr.Start(); Server = svr; base.StartWork(reason); }