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"); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { sOpenPackage = ""; try { var files = Directory.GetFiles(txtFolder.Text); if (files.Count() != 0) { if (!extractRBFiles()) { Log("There was an error extracting the files ... stopping here"); return; } } else { Log("No new files found and no existing directory found ... there's nothing to do"); backgroundWorker1.CancelAsync(); return; } } catch { Log("Error retrieving files to extract"); } var success = false; if (backgroundWorker1.CancellationPending) { goto Finish; } //check if the CON/LIVE files were actually RB songs or not //if not, end var isRbSong = Directory.Exists(tempFolder + "songs\\"); if (!isRbSong) { Log("I can't find a 'songs' folder in the extracted files"); Log("Are you sure these are Rock Band songs?"); Log("Check the files and try again"); return; } Log("Beginning to add the files"); packfiles.HeaderData.TitleID = 0x45410914; packfiles.HeaderData.Title_Package = "Rock Band 3"; packfiles.HeaderData.SetLanguage(Languages.English); packfiles.HeaderData.Publisher = ""; packfiles.STFSType = STFSType.Type0; packfiles.HeaderData.ThisType = PackageType.SavedGame; packfiles.HeaderData.Title_Display = txtTitle.Text; packfiles.HeaderData.Description = "Created with C3 CON Tools for video recording purposes ONLY."; packfiles.HeaderData.ContentImageBinary = Resources.RB3.ImageToBytes(ImageFormat.Png); packfiles.HeaderData.PackageImageBinary = Resources.RB3.ImageToBytes(ImageFormat.Png); packfiles.HeaderData.MakeAnonymous(); songsFolder = tempFolder + "songs\\"; success = addFiles(); if (success) { Log("All set, going to try to build the pack for you"); Log("This may take a while, depending on how many songs"); Log("Unless you get an error or I crash, assume that I'm working!"); success = buildPackage(); } if (success) { Log("Trying to unlock CON file"); if (Tools.UnlockCON(xOut)) { Log("Unlocked CON file successfully"); } else { Log("Error unlocking CON file"); success = false; } } if (success) { Log("Trying to sign CON file"); if (Tools.SignCON(xOut)) { Log("CON file signed successfully"); } else { Log("Error signing CON file"); success = false; } } Finish: Log("Deleting temporary folder"); if (Directory.Exists(tempFolder)) { try { Tools.SendtoTrash(tempFolder, true); //send files to recycle bin Directory.CreateDirectory(tempFolder); //restore empty extracted folder (requested by C16) } catch { Log("Error deleting temporary folder"); } } if (success) { Log("Done!"); endTime = DateTime.Now; var timeDiff = endTime - startTime; Log("Process took " + timeDiff.Minutes + (timeDiff.Minutes == 1 ? " minute" : " minutes") + " and " + (timeDiff.Minutes == 0 && timeDiff.Seconds == 0 ? "1 second" : timeDiff.Seconds + " seconds")); Log("You can click View Package to close this form"); Log("and open the new pack in CON Explorer"); Log("Click reset to start again and create a new pack,"); Log("or just close me down and enjoy your new pack!"); sOpenPackage = xOut; } else { Log("Something went wrong and your pack was NOT created, sorry!"); } }