public void Save(SaveWorldFlags worldFlags) { var editingWorld = worldTreeService.EditingWorld; if (SaveLoadWorldProperties.Get(editingWorld).IsReadOnly) { messageBoxService.Show("Cannot save a read-only world.", MessageBoxButtons.Ok, MessageBoxType.Error); return; } var editableWorld = worldFlags.HasFlag(SaveWorldFlags.EditableWorld) ? editingWorld : null; var readOnlyWorld = worldFlags.HasFlag(SaveWorldFlags.ReadOnlyWorld) ? readOnlyWorldBuilder.BuildReadOnly(editingWorld) : null; Format.Save(new DefaultFileSaveInfo(FileName, editableWorld, readOnlyWorld, assetService)); eventRoutingService.FireEvent <ISaveLoadEvent>(new SaveLoadEvent(SaveLoadEventType.Save, worldTreeService.World, assetService.Assets)); }
public static bool HasFlag(this SaveWorldFlags value, SaveWorldFlags flag) => CodingHelper.HasFlag((int)value, (int)flag);