private void ReplaceCharacterImage(string image) { Tools.CurrentFolder = Path.GetDirectoryName(image); console = isPS3 ? "ps3" : (isWii ? "wii" : "xbox"); var xfile = ImageFolder + "character_" + (cboCharacter.SelectedIndex + 1) + ".png_" + console; var file = ImageFolder + "character_" + (cboCharacter.SelectedIndex + 1) + ".png"; var backup = xfile + ".bak"; File.Copy(xfile, backup); Tools.isSaveFileCharacter = true; Tools.isSaveFileArt = false; Tools.TextureSize = isWii? 256 : 512; Tools.isVerticalTexture = true; if (isWii) { Tools.ConvertImagetoWii(wimgt, image, xfile); } else { Tools.ConvertImagetoRB(image, xfile, false, isPS3); } if (File.Exists(xfile)) { Tools.DeleteFile(file); if (isWii) { Tools.ConvertWiiImage(xfile, image, file); } else { Tools.ConvertRBImage(xfile, file); } picCharacter.Image = Tools.NemoLoadImage(file); Log("Replaced image for character '" + cboCharacter.Items[cboCharacter.SelectedIndex] + "' successfully"); NeedsToSave(true); Log("Ready"); Tools.DeleteFile(backup); return; } Log("Replacing image for character '" + cboCharacter.Items[cboCharacter.SelectedIndex] + "' failed"); //set everything back File.Move(backup, xfile); Tools.DeleteFile(file); if (isWii) { Tools.ConvertImagetoWii(wimgt, image, xfile); } else { Tools.ConvertImagetoRB(image, xfile, false, isPS3); } ChangeImagePadding(); picCharacter.Image = Tools.NemoLoadImage(file); }
private void FromWii(string image) { if (!File.Exists(image)) { return; } imgCounter++; Log("Converting file " + imgCounter + " of " + (imagesWii.Count() + imagesTPL.Count())); Log(" - " + Path.GetFileName(image)); var format = Path.GetExtension(image).Replace(".", "").Trim().ToLowerInvariant(); var success = false; // Save the image if (chkWiiBMP.Checked) { success = Tools.ConvertWiiImage(image, image, "bmp", false); } if (chkWiiJPG.Checked) { success = Tools.ConvertWiiImage(image, image, "jpg", false); } if (chkWiiPNG.Checked) { success = Tools.ConvertWiiImage(image, image, "png", false); } if (success) { //if clean up box checked, delete originals if (chkCleanUpWii.Checked) { Tools.SendtoTrash(image); } Log("Converted from " + format + " format successfully"); } else { Log("Error converting from " + format + " format"); } }