示例#1
0
        void RestartCoreWorker(Action next)
        {
            JObject cfg = GetDecodedConfig(true, false, true);

            if (cfg == null)
            {
                StopCoreThen(next);
                return;
            }

            if (!OverwriteInboundSettings(
                    ref cfg,
                    overwriteInboundType,
                    this.inboundIP,
                    this.inboundPort))
            {
                StopCoreThen(next);
                return;
            }

            InjectSkipCnSiteSettingsIntoConfig(ref cfg);

            server.title = GetTitle();
            server.RestartCoreThen(
                cfg.ToString(),
                () =>
            {
                OnRequireNotifierUpdate?.Invoke(this, EventArgs.Empty);
                OnRequireKeepTrack?.Invoke(this, new VgcApis.Models.BoolEvent(true));
                next?.Invoke();
            },
                Lib.Utils.GetEnvVarsFromConfig(cfg));
        }
示例#2
0
 void InvokeEventOnRequireNotifierUpdate(string text)
 {
     try
     {
         OnRequireNotifierUpdate?.Invoke(this, new Model.Data.StrEvent(text));
     }
     catch { }
 }
示例#3
0
 public void StopCoreThen(Action next = null)
 {
     Task.Factory.StartNew(() => server.StopCoreThen(
                               () =>
     {
         OnRequireNotifierUpdate?.Invoke(this, EventArgs.Empty);
         OnRequireKeepTrack?.Invoke(this, new VgcApis.Models.BoolEvent(false));
         next?.Invoke();
     }));
 }