public frmAlbumEdit(AlbumIcon albumToEdit, PhotoGallery parentPhotoGallery) { InitializeComponent(); album = albumToEdit; this.txtTitle.Text = this.Text = album.Title; this.txtAuthor.Text = album.AlbumObject.vauthor; this.txtDescription.Text = album.AlbumObject.vdescribe; this.pbMainPhoto.Image = album.MainImage; parentGallery = parentPhotoGallery; }
private void PatchButtonClick(object sender, EventArgs e) { if (CommonSzs == null || targetPatch == null) { MessageBox.Show("Open a valid theme first !"); return; } if (tbBntxFile.Text.Trim() == "") { if (LayoutPatchList.SelectedIndex <= 0) { MessageBox.Show("There is nothing to patch"); return; } if (MessageBox.Show("Are you sure you want to continue without selecting a bntx ?", "", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } else if (!File.Exists(tbBntxFile.Text)) { MessageBox.Show($"{tbBntxFile.Text} not found !"); return; } SaveFileDialog sav = new SaveFileDialog() { Filter = "szs file|*.szs", FileName = targetPatch.szsName }; if (sav.ShowDialog() != DialogResult.OK) { return; } var res = BflytFile.PatchResult.OK; if (tbBntxFile.Text.Trim() != "") { if (!BgImageCheck(true)) { return; } if (SwitchThemesCommon.PatchBntx(CommonSzs, File.ReadAllBytes(tbBntxFile.Text), targetPatch) == BflytFile.PatchResult.Fail) { MessageBox.Show( "Can't build this theme: the szs you opened doesn't contain some information needed to patch the bntx," + "without this information it is not possible to rebuild the bntx." + "You should use an original or at least working szs", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (targetPatch.NXThemeName == "home" && AlbumIcon != null) { if (!AlbumIcon.EndsWith(".dds") && !AlbumIcontoDDS()) { return; } SwitchThemesCommon.PatchBntxTexture(CommonSzs, File.ReadAllBytes(AlbumIcon), "RdtIcoPvr_00^s", 0x02000000); } res = SwitchThemesCommon.PatchBgLayouts(CommonSzs, targetPatch); if (res == BflytFile.PatchResult.Fail) { MessageBox.Show("Couldn't patch this file, it might have been already modified or it's from an unsupported system version."); return; } else if (res == BflytFile.PatchResult.CorruptedFile) { MessageBox.Show("This file has been already patched with another tool and is not compatible, you should get an unmodified layout."); return; } } if (LayoutPatchList.SelectedIndex != 0) { var layoutres = SwitchThemesCommon.PatchLayouts(CommonSzs, LayoutPatchList.SelectedItem as LayoutPatch, targetPatch.NXThemeName == "home", !UseAnim.Checked); if (layoutres == BflytFile.PatchResult.Fail) { MessageBox.Show("One of the target files for the selected layout patch is missing in the SZS, you are probably using an already patched SZS"); return; } else if (layoutres == BflytFile.PatchResult.CorruptedFile) { MessageBox.Show("A layout in this SZS is missing a pane required for the selected layout patch, you are probably using an already patched SZS"); return; } layoutres = SwitchThemesCommon.PatchAnimations(CommonSzs, (LayoutPatchList.SelectedItem as LayoutPatch).Anims); if (layoutres != BflytFile.PatchResult.OK) { MessageBox.Show("Error while patching the animations !"); return; } } var sarc = SARC.PackN(CommonSzs); File.WriteAllBytes(sav.FileName, ManagedYaz0.Compress(sarc.Item2, 3, (int)sarc.Item1)); GC.Collect(); if (res == BflytFile.PatchResult.AlreadyPatched) { MessageBox.Show("Done, This file has already been patched before.\r\nIf you have issues try with an unmodified file"); } else { MessageBox.Show("Done"); } }