/// <summary> /// Saves this state. If <see cref="IsStateDirty"/> is false, nothing is done. /// </summary> /// <param name="m">The monitor to use.</param> /// <returns>True on success, false on error.</returns> public bool SaveState(IActivityMonitor m) { if (IsStateDirty) { if (!_store.SaveState(m, this)) { return(false); } IsStateDirty = false; Saved?.Invoke(this, new EventMonitoredArgs(m)); } return(true); }
/// <summary> /// Helper to impact local state an save it. /// </summary> /// <param name="this">This store.</param> /// <param name="m">The monitor to use.</param> /// <param name="state">The state to save.</param> /// <param name="a">The state modifier.</param> /// <returns>True on succes, false on error.</returns> public static bool SetLocalState(this WorldStore @this, IActivityMonitor m, LocalWorldState state, Action <LocalWorldState> a) { a(state); return(@this.SaveState(m, state)); }