private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { if (Debugger.IsAttached) //调试模式 { this.Topmost = false; //防止挡住代码 } //LocationTestBox1.Logs = Logs; InitData(); ServerManagerBox1.Init(); if (EngineClientSetting.AutoStart) { ShowEngineClientWindow(); } //var hex = "10 01 C0 01 02 85 A4 F4 8C C0 3A"; //var bytes = ByteHelper.HexToBytes(hex); //var str = "85A4"; //byte[] bytes1 = Encoding.UTF8.GetBytes(str); //byte[] bytes2 = Encoding.UTF32.GetBytes(str); //byte[] bytes4 = Encoding.ASCII.GetBytes(str); //byte[] bytes5 = Encoding.UTF7.GetBytes(str); //byte[] bytes6 = Encoding.Default.GetBytes(str); version = ConfigurationHelper.GetValue("ServerVersionCode"); clientVersion = ConfigurationHelper.GetValue("ClientVersionCode"); this.Title = "服务端 -v" + version + "," + clientVersion; var isStartDaemon = ConfigurationHelper.GetBoolValue("StartDaemon"); if (isStartDaemon && Debugger.IsAttached == false) { StartDaemon(false); } bool isAutoRun = RegeditRW.ReadIsAutoRun(); var registerDaemonAutoRun = ConfigurationHelper.GetBoolValue("RegisterDaemonAutoRun"); if (registerDaemonAutoRun) { if (isAutoRun == false) { RegeditRW.SetIsAutoRun(true); string path2 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; Log.Info(LogTags.Server, "注册开机自启动:" + path2); } else { Log.Info(LogTags.Server, "开机自启动:" + isAutoRun); } } else { Log.Info(LogTags.Server, "开机自启动:" + isAutoRun); } timeTimer = new DispatcherTimer(); timeTimer.Interval = TimeSpan.FromMilliseconds(500); //timer2.Interval = TimeSpan.FromSeconds(1); timeTimer.Tick += TimeTimer_Tick; timeTimer.Start(); StaticEvents.LocateArchorByIp += StaticEvents_LocateArchorByIp; }
private void SettingWindow_OnLoaded(object sender, RoutedEventArgs e) { bool isAutoRun = RegeditRW.ReadIsAutoRun(); CbAutoRun.IsChecked = isAutoRun; }