示例#1
0
        private static async Task <bool> StartServer(Server server, Mode mode, IServerController controller)
        {
            controller = ServerHelper.GetUtilByTypeName(server.Type).GetController();

            if (controller is Guard instanceController)
            {
                Utils.Utils.KillProcessByName(instanceController.MainFile);
            }

            PortCheckAndShowMessageBox(controller.Socks5LocalPort(), "Socks5");

            Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", controller.Name));
            if (await Task.Run(() => controller.Start(server, mode)))
            {
                UsingPorts.Add(StatusPortInfoText.Socks5Port = controller.Socks5LocalPort());
                StatusPortInfoText.ShareLan = controller.LocalAddress == "0.0.0.0";
                return(true);
            }

            return(false);
        }