public virtual void Start()
 {
     //启动服务
     appCenter.CurrentGuid = Guid.NewGuid();
     //连接服务器
     P2PClient.ConnectServer();
     appCenter.StartNewTask(() => P2PClient.TestAndReconnectServer());
     //启动端口映射
     P2PClient.StartPortMap();
     Thread.Sleep(1000);
 }
 public void Start()
 {
     LogUtils.InitConfig();
     LogUtils.Info($"客户端版本:{AppCenter.SoftVerSion} 作者:wireboy", false);
     LogUtils.Info($"github地址:https://github.com/bobowire/Wireboy.Socket.P2PSocket", false);
     //读取配置文件
     if (ConfigUtils.IsExistConfig())
     {
         //加载配置文件
         try
         {
             ConfigCenter config = ConfigUtils.LoadFromFile();
             ConfigCenter.LoadConfig(config);
             FileSystemWatcher fw = new FileSystemWatcher(Path.Combine(AppCenter.Instance.RuntimePath, "P2PSocket"), "Client.ini")
             {
                 NotifyFilter = NotifyFilters.LastWrite
             };
             fw.Changed            += Fw_Changed;
             fw.EnableRaisingEvents = true;
         }
         catch (Exception ex)
         {
             LogUtils.Error($"加载配置文件Client.ini失败:{Environment.NewLine}{ex}");
             return;
         }
     }
     else
     {
         LogUtils.Error($"找不到配置文件.{AppCenter.Instance.ConfigFile}");
         return;
     }
     //启动服务
     AppCenter.Instance.CurrentGuid = Guid.NewGuid();
     //连接服务器
     P2PClient.ConnectServer();
     AppCenter.Instance.StartNewTask(() => P2PClient.TestAndReconnectServer());
     //启动端口映射
     P2PClient.StartPortMap();
     System.Threading.Thread.Sleep(1000);
 }