private void PatchRom(ModInfo mod) { if (!_dialogService.CommitToRom(mod, out string romPath, out var patchOpt)) { return; } if (!_modPatcher.CanPatch(mod, romPath, patchOpt, out string reason)) { _dialogService.ShowMessageBox(MessageBoxArgs.Ok("Unable to patch sprites", reason)); return; } Exception error = null; _dialogService.ProgressDialog(progress => { try { _modPatcher.Patch(mod, romPath, patchOpt, progress); } catch (Exception e) { error = e; } }); if (error != null) { _dialogService.ShowMessageBox(MessageBoxArgs.Ok( title: "Error Writing To Rom", message: error.ToString(), type: MessageBoxType.Error )); } }