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)); }
void InvokeEventOnRequireNotifierUpdate(string text) { try { OnRequireNotifierUpdate?.Invoke(this, new Model.Data.StrEvent(text)); } catch { } }
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(); })); }