/// <summary> /// Loads the current configuration in parallel. /// </summary> public void LoadStart(ConfigDataCallback UpdateConfig, bool silent = false) { if (!SaveInProgress) { SaveInProgress = true; if (!silent) { Main.SendChatMessage("Loading configuration..."); } taskPool.EnqueueTask(() => { ConfigData cfg; BvException loadException, saveException; loadException = TryLoad(out cfg); cfg = ValidateConfig(cfg); taskPool.EnqueueAction(() => UpdateConfig(cfg)); saveException = TrySave(cfg); if (loadException != null) { loadException = TrySave(cfg); taskPool.EnqueueAction( () => LoadFinish(false, silent)); if (saveException != null) { BvMain.Log.TryWriteToLog(loadException.ToString() + "\n" + saveException.ToString()); taskPool.EnqueueAction(() => Main.SendChatMessage("Unable to load or create configuration file.")); } } else { taskPool.EnqueueAction(() => LoadFinish(true, silent)); } }); } else { Main.SendChatMessage("Save operation already in progress."); } }
public static extern void BRRegisterConfigDataCallback(IntPtr customedObj, ConfigDataCallback handle);