private void btnPackSongPack_Click(object sender, EventArgs e) { string sourcePath; string saveFileName; using (var fbd = new VistaFolderBrowserDialog()) { fbd.Description = "Select the Song Pack folder"; fbd.SelectedPath = savePath; if (fbd.ShowDialog() != DialogResult.OK) return; sourcePath = fbd.SelectedPath; } saveFileName = Path.GetFileName(sourcePath); //using (var sfd = new SaveFileDialog()) //{ // sfd.FileName = Path.GetFileName(sourcePath); // if (sfd.ShowDialog() != DialogResult.OK) // return; // saveFileName = sfd.FileName; //} GlobalExtension.UpdateProgress = this.pbUpdateProgress; GlobalExtension.CurrentOperationLabel = this.lblCurrentOperation; Thread.Sleep(100); // give Globals a chance to initialize GlobalExtension.ShowProgress("Packing archive ..."); Application.DoEvents(); try { Stopwatch sw = new Stopwatch(); sw.Restart(); var songPackDir = AggregateGraph2014.DoLikeSongPack(sourcePath, txtAppId.Text); var destFilePath = Path.Combine(Path.GetDirectoryName(sourcePath), String.Format("{0}_p.psarc", Path.GetFileName(sourcePath))); Packer.Pack(songPackDir, destFilePath, fixShowlights: false, predefinedPlatform: new Platform(GamePlatform.Pc, GameVersion.RS2014)); // clean up now (song pack folder) //if (Directory.Exists(songPackDir)) // DirectoryExtension.SafeDelete(songPackDir); sw.Stop(); GlobalExtension.ShowProgress("Finished packing archive (elapsed time): " + sw.Elapsed, 100); MessageBox.Show("Packing is complete.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(String.Format("{0}\n{1}\n{2}", "Packing error!", ex.Message, ex.InnerException), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } // prevents possible cross threading GlobalExtension.Dispose(); }
private void btnPackSongPack_Click(object sender, EventArgs e) { var srcPath = String.Empty; var errMsg = String.Empty; using (var fbd = new VistaFolderBrowserDialog()) { fbd.Description = "Select the Song Pack folder created in Step #1."; fbd.SelectedPath = destPath; if (fbd.ShowDialog() != DialogResult.OK) { return; } srcPath = fbd.SelectedPath; } ToggleUIControls(false); GlobalExtension.UpdateProgress = this.pbUpdateProgress; GlobalExtension.CurrentOperationLabel = this.lblCurrentOperation; Thread.Sleep(100); // give Globals a chance to initialize GlobalExtension.ShowProgress("Packing archive ...", 30); Application.DoEvents(); try { Stopwatch sw = new Stopwatch(); sw.Restart(); var songPackDir = AggregateGraph2014.DoLikeSongPack(srcPath, txtAppId.Text); destPath = Path.Combine(Path.GetDirectoryName(srcPath), String.Format("{0}_songpack_p.psarc", Path.GetFileName(srcPath))); // PC Only for now can't mix platform packages Packer.Pack(songPackDir, destPath, predefinedPlatform: new Platform(GamePlatform.Pc, GameVersion.RS2014)); // clean up now (song pack folder) if (Directory.Exists(songPackDir)) { DirectoryExtension.SafeDelete(songPackDir); } sw.Stop(); GlobalExtension.ShowProgress("Finished packing archive (elapsed time): " + sw.Elapsed, 100); } catch (Exception ex) { errMsg = String.Format("{0}\n{1}", ex.Message, ex.InnerException); errMsg += Environment.NewLine + "Make sure there aren't any non-PC CDLC in the SongPacks folder."; } PromptComplete(destPath, true, errMsg); GlobalExtension.Dispose(); ToggleUIControls(true); }