Ejemplo n.º 1
0
        public bool AddServer(string config, string mark, bool quiet = false)
        {
            // duplicate
            if (IsServerItemExist(config))
            {
                return(false);
            }

            var newServer = new Controller.CoreServerCtrl()
            {
                config = config,
                mark   = mark,
            };

            lock (serverListWriteLock)
            {
                serverList.Add(newServer);
            }

            newServer.Run(cache, setting, this);
            BindEventsTo(newServer);

            if (!quiet)
            {
                newServer.UpdateSummaryThen(() =>
                {
                    InvokeEventOnRequireMenuUpdate(this, EventArgs.Empty);
                    InvokeEventOnRequireFlyPanelUpdate();
                });
            }

            setting.LazyGC();
            LazySaveServerList();
            return(true);
        }