private void buttonMove_Click(object sender, EventArgs e) { string tagetPath = ""; using (var dialog = new VistaFolderBrowserDialog()) { dialog.SelectedPath = ""; dialog.UseDescriptionForTitle = true; dialog.ShowNewFolderButton = true; dialog.Description = @"Select target folder"; //dialog.RootFolder = Environment.SpecialFolder.Desktop; if (dialog.ShowDialog() == DialogResult.OK) { tagetPath = dialog.SelectedPath; } } if (Pri.LongPath.Directory.Exists(tagetPath)) { foreach (var s in FileOrFolderList) { if (Pri.LongPath.Directory.Exists(s) || Pri.LongPath.File.Exists(s)) { MoveTo(s, tagetPath); } } MessageBox.Show(@"Success", @"Success move " + FileOrFolderList.Count + @" item", MessageBoxButtons.OK, MessageBoxIcon.Information); } Close(); //Environment.Exit(0); }
public FolderBrowser() { if (VistaFolderBrowserDialog.IsVistaFolderDialogSupported) { vista = new VistaFolderBrowserDialog(); } }
private void packButton_Click(object sender, EventArgs e) { string sourcePath; string saveFileName; var useCryptography = useCryptographyCheckbox.Checked; var updateSng = updateSngCheckBox.Checked; using (var fbd = new VistaFolderBrowserDialog()) { if (fbd.ShowDialog() != DialogResult.OK) return; sourcePath = fbd.SelectedPath; } using (var sfd = new SaveFileDialog()) { if (sfd.ShowDialog() != DialogResult.OK) return; saveFileName = sfd.FileName; } try { string[] decodedOGGFiles = Directory.GetFiles(sourcePath, "*_fixed.ogg", SearchOption.AllDirectories); foreach (var file in decodedOGGFiles) File.Delete(file); Packer.Pack(sourcePath, saveFileName, useCryptography, updateSng); MessageBox.Show("Packing is complete.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(String.Format("{0}\n\r{1}\n\r{2}", "Packing error!", ex.Message, ex.InnerException), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void DestButton_Click(object sender, EventArgs e) { using (Ookii.Dialogs.VistaFolderBrowserDialog browserDialog = new Ookii.Dialogs.VistaFolderBrowserDialog()) { if (browserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DestPath.Text = browserDialog.SelectedPath; } } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { VistaFolderBrowserDialog browser = new VistaFolderBrowserDialog(); if (value != null) { browser.SelectedPath = string.Format("{0}", value); } if (browser.ShowDialog(null) == DialogResult.OK) return browser.SelectedPath; return value; }
private void btnProjectDir_Click(object sender, EventArgs e) { using (var fbd = new VistaFolderBrowserDialog()) { fbd.SelectedPath = creator_defaultproject.Name; fbd.Description = "Select Default Project Folder for the CDLC Creator"; if (fbd.ShowDialog() != DialogResult.OK) return; var projectDir = fbd.SelectedPath; creator_defaultproject.Text = projectDir; ConfigRepository.Instance()[creator_defaultproject.Name] = projectDir; } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { using (VistaFolderBrowserDialog browser = new VistaFolderBrowserDialog()) { if (value != null) { browser.SelectedPath = string.Format("{0}", value); } if (browser.ShowDialog(null) == DialogResult.OK) { return(browser.SelectedPath); } } return(value); }
private new void addDirectoryButton_Click(object sender, EventArgs e) { VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog(); fbd.Description = "Select a directory."; fbd.UseDescriptionForTitle = true; if (fbd.ShowDialog() == DialogResult.OK) { if (MessageBox.Show("Include files within subdirectories?", "Subdirectories", MessageBoxButtons.YesNo) == DialogResult.Yes) { AddFiles(Directory.GetFiles(fbd.SelectedPath, "*.*", SearchOption.AllDirectories)); } else { AddFiles(Directory.GetFiles(fbd.SelectedPath)); } EnableRunButton(); } }
private void btnUnpack_Click(object sender, EventArgs e) { string[] sourceFileNames; savePath = String.Empty; using (var ofd = new OpenFileDialog()) { //ofd.Filter = "All Files (*.*)|*.*"; ofd.Filter = "Custom Rocksmith/Rocksmith 2014 CDLC (*.dat;*.psarc)|*.dat;*.psarc"; ofd.Multiselect = true; if (ofd.ShowDialog() != DialogResult.OK) return; sourceFileNames = ofd.FileNames; } using (var fbd = new VistaFolderBrowserDialog()) { fbd.SelectedPath = Path.GetDirectoryName(sourceFileNames[0]) + Path.DirectorySeparatorChar; if (fbd.ShowDialog() != DialogResult.OK) return; savePath = fbd.SelectedPath; } UnpackSongs(sourceFileNames, savePath, decodeAudio, extractSongXml); }
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(); }
public void dlcImportButton_Click(object sender = null, EventArgs e = null) { string sourcePackage; string savePath; // GET PATH using (var ofd = new OpenFileDialog()) { ofd.Title = "Select one DLC to import"; var filter = CurrentRocksmithTitle + " PC/Mac Package (*.psarc)|*.psarc|"; filter += CurrentRocksmithTitle + " XBox360 Package (*.*)|*.*|"; filter += CurrentRocksmithTitle + " PS3 Package (*.edat)|*.edat"; ofd.Filter = filter; if (ofd.ShowDialog() != DialogResult.OK) return; sourcePackage = ofd.FileName; } if (!sourcePackage.IsValidPSARC()){ MessageBox.Show(String.Format("File '{0}' isn't valid. File extension was changed to '.invalid'", Path.GetFileName(sourcePackage)), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } using (var fbd = new VistaFolderBrowserDialog()) { fbd.Description = "Select folder to save project artifacts"; fbd.UseDescriptionForTitle = true; if (fbd.ShowDialog() != DialogResult.OK) return; savePath = fbd.SelectedPath; } // UNPACK var unpackedDir = Packer.Unpack(sourcePackage, savePath, true, true, false); var packagePlatform = sourcePackage.GetPlatform(); // REORGANIZE var structured = ConfigRepository.Instance().GetBoolean("creator_structured"); if (structured) unpackedDir = DLCPackageData.DoLikeProject(unpackedDir); // LOAD DATA DLCPackageData info = null; // FIXME DLCPackageData.Load(unpackedDir, packagePlatform); info.PackageVersion = "1"; //TODO: add PackageVersion to "toolkit.version" File and use it switch (packagePlatform.platform) { case GamePlatform.Pc: info.Pc = true; break; case GamePlatform.Mac: info.Mac = true; break; case GamePlatform.XBox360: info.XBox360 = true; break; case GamePlatform.PS3: info.PS3 = true; break; } // FILL PACKAGE CREATOR FORM FillPackageCreatorForm(info, unpackedDir); MessageBox.Show(CurrentRocksmithTitle + " DLC Template was imported.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Focus(); }
private void AddArrBT_Click(object sender, EventArgs e) { using (var ofd = new VistaOpenFileDialog()) using (var sfd = new VistaFolderBrowserDialog()) { ofd.Filter = "Select Package or Arrangement (*.psarc;*.dat;*.edat;*.xml)|*.psarc;*.dat;*.edat;*.xml|" + "All files|*.*"; ofd.FilterIndex = 0; ofd.Multiselect = true; ofd.ReadOnlyChecked = true; ofd.CheckFileExists = true; ofd.CheckPathExists = true; ofd.RestoreDirectory = true; if (ofd.ShowDialog() != DialogResult.OK) return; foreach (var file in ofd.FileNames) { if (file.EndsWith("_showlights.xml") || file.EndsWith(".dlc.xml") || file.StartsWith("DDC_")) continue; if (!DLCdb.ContainsValue(file)) DLCdb.Add(Path.GetFileNameWithoutExtension(file), file); } } FillDB(); }
private void convertButton_Click(object sender, EventArgs e) { IList<string> sourceFileNames; string savePath; bool max = difficultyMax.Checked; bool all = difficultyAll.Checked; // Input file(s) using (var ofd = new OpenFileDialog()) { ofd.Multiselect = true; ofd.Filter = "Rocksmith 1 DLC Package (.dat)|*.dat"; if (ofd.ShowDialog() != DialogResult.OK) return; sourceFileNames = ofd.FileNames; } // Output path using (var fbd = new VistaFolderBrowserDialog()) { if (fbd.ShowDialog() != DialogResult.OK) return; savePath = fbd.SelectedPath; } foreach (string inputFile in sourceFileNames) { if (Path.GetExtension(inputFile) == ".sng") Convert(inputFile, savePath, all); else ExtractBeforeConvert(inputFile, savePath, all); } MessageBox.Show("The conversion is complete.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void rs2014PathButton_Click(object sender, EventArgs e) { using (var fbd = new VistaFolderBrowserDialog()) { if (fbd.ShowDialog() != DialogResult.OK) return; var rs2014Path = fbd.SelectedPath; general_rs2014path.Text = rs2014Path; ConfigRepository.Instance()[general_rs2014path.Name] = rs2014Path; } }
private void unpackButton_Click(object sender, EventArgs e) { string[] sourceFileNames; savePath = String.Empty; using (var ofd = new OpenFileDialog()) { ofd.Filter = "All Files (*.*)|*.*"; ofd.Multiselect = true; if (ofd.ShowDialog() != DialogResult.OK) return; sourceFileNames = ofd.FileNames; } using (var fbd = new VistaFolderBrowserDialog()) { fbd.SelectedPath = Path.GetDirectoryName(sourceFileNames[0]) + Path.DirectorySeparatorChar; if (fbd.ShowDialog() != DialogResult.OK) return; savePath = fbd.SelectedPath; } // commented out bWorker aspects to test GlobalExtension ProgressBar function //if (!bwUnpack.IsBusy && sourceFileNames.Length > 0) //{ // updateProgress.Value = 0; // updateProgress.Visible = true; // currentOperationLabel.Visible = true; unpackButton.Enabled = false; // bwUnpack.RunWorkerAsync(sourceFileNames); //} //} //private void Unpack(object sender, DoWorkEventArgs e) //{ // var sourceFileNames = e.Argument as string[]; errorsFound = new StringBuilder(); //var step = (int)Math.Round(1.0 / sourceFileNames.Length * 100, 0); //int progress = 0; GlobalExtension.UpdateProgress = this.updateProgress; GlobalExtension.CurrentOperationLabel = this.currentOperationLabel; Thread.Sleep(100); // give Globals a chance to initialize foreach (string sourceFileName in sourceFileNames) { Application.DoEvents(); Platform platform = Packer.GetPlatform(sourceFileName); // bwUnpack.ReportProgress(progress, String.Format("Unpacking '{0}'", Path.GetFileName(sourceFileName))); GlobalExtension.ShowProgress(String.Format("Unpacking '{0}'", Path.GetFileName(sourceFileName))); // remove this exception handler for testing try { Stopwatch sw = new Stopwatch(); sw.Restart(); Packer.Unpack(sourceFileName, savePath, decodeAudio, extractSongXml); sw.Stop(); GlobalExtension.ShowProgress("Finished unpacking archive (elapsed time): " + sw.Elapsed, 100); } catch (Exception ex) { errorsFound.AppendLine(String.Format("Error unpacking file '{0}': {1}", Path.GetFileName(sourceFileName), ex.Message)); } // progress += step; // bwUnpack.ReportProgress(progress); } // bwUnpack.ReportProgress(100); // e.Result = "unpack"; // add this message while bWorker is commented out if (errorsFound.Length <= 0) MessageBox.Show("Unpacking is complete.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("Unpacking is complete with errors. See below: " + Environment.NewLine + Environment.NewLine + errorsFound.ToString(), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning); unpackButton.Enabled = true; // prevents possible cross threading GlobalExtension.Dispose(); }
private void btnUnpack_Click(object sender, EventArgs e) { string[] srcFileNames; using (var ofd = new OpenFileDialog()) { ofd.Filter = "All Files (*.*)|*.*|Rocksmith 1|*.dat|Rocksmith 2014 PC|*_p.psarc|Rocksmith 2014 Mac|*_m.psarc|Rocksmith 2014 Xbox|*_xbox|Rocksmith 2014 PS3|*.edat"; ofd.Multiselect = true; ofd.FilterIndex = 1; ofd.FileName = destPath; if (ofd.ShowDialog() != DialogResult.OK) return; srcFileNames = ofd.FileNames; } using (var fbd = new VistaFolderBrowserDialog()) { fbd.Description = "Select a artifacts destination folder."; fbd.SelectedPath = Path.GetDirectoryName(srcFileNames[0]) + Path.DirectorySeparatorChar; if (fbd.ShowDialog() != DialogResult.OK) return; destPath = fbd.SelectedPath; } UnpackSongs(srcFileNames, destPath, DecodeAudio, OverwriteSongXml); }
private void btnPack_Click(object sender, EventArgs e) { var srcPath = String.Empty; var destFileName = String.Empty; using (var fbd = new VistaFolderBrowserDialog()) { fbd.SelectedPath = destPath; fbd.Description = "Select CDLC artifacts folder."; if (fbd.ShowDialog() != DialogResult.OK) return; srcPath = destPath = fbd.SelectedPath; } destFileName = RecycleFolderName(srcPath); using (var sfd = new SaveFileDialog()) { sfd.Title = "Select a new CDLC destination file name or use the system generated default."; sfd.FileName = destFileName; if (sfd.ShowDialog() != DialogResult.OK) return; destFileName = sfd.FileName; } ToggleUIControls(false); GlobalExtension.UpdateProgress = this.pbUpdateProgress; GlobalExtension.CurrentOperationLabel = this.lblCurrentOperation; Thread.Sleep(100); // give Globals a chance to initialize GlobalExtension.ShowProgress("Packing archive ..."); Application.DoEvents(); var errMsg = String.Empty; try { Stopwatch sw = new Stopwatch(); sw.Restart(); var packagePlatform = srcPath.GetPlatform(); Packer.Pack(srcPath, destFileName, UpdateSng, packagePlatform, UpdateManifest); 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); } PromptComplete(destFileName, true, errMsg); GlobalExtension.Dispose(); ToggleUIControls(true); }
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 ..."); 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, 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); } 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); }
//bool notifyPathChanged( string path ) //{ // if (PathToFolderChanged != null) // { // var pathToFolderChangedEventArgs = new PathToFolderChangedEventArgs // { // Cancel = false, // ChosenFolder = path // } ; // PathToFolderChanged(this, pathToFolderChangedEventArgs); // return pathToFolderChangedEventArgs.Cancel ; // } // return true ; //} void chooseFolderClick(object sender, EventArgs e) { using( var dialog = new VistaFolderBrowserDialog( ) ) { dialog.SelectedPath = uiFolderText.Text ; if( dialog.ShowDialog( ) == DialogResult.OK ) { string selectedPath = dialog.SelectedPath ; bool shouldCancel = false;// notifyPathChanged(selectedPath); if (!shouldCancel) { loadFolder(selectedPath); } } } }
private void browseButton_Click(object sender, EventArgs e) { VistaFolderBrowserDialog folder = new VistaFolderBrowserDialog(); if (customTextBox.Text.Length > 0 && Directory.Exists(customTextBox.Text)) folder.SelectedPath = customTextBox.Text; if (folder.ShowDialog() == DialogResult.OK) { customTextBox.Text = folder.SelectedPath; } }
private void extractAllToolStripMenuItem_Click(object sender, EventArgs e) { ArchiveReader archive = openedArchives.Peek().Archive; // No files in the archive if (archive.Entries.Count == 0) return; // One file in the archive else if (archive.Entries.Count == 1) { ArchiveEntry entry = archive.Entries[0]; SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = entry.Name; sfd.Filter = "All Files (*.*)|*.*"; sfd.Title = "Extract File"; if (sfd.ShowDialog() == DialogResult.OK) { archive.ExtractToFile(entry, sfd.FileName); } } // Multiple files in the archive else { VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog(); fbd.Description = "Select a folder to extract the files to."; fbd.UseDescriptionForTitle = true; if (fbd.ShowDialog() == DialogResult.OK) { for (int i = 0; i < archive.Entries.Count; i++) { ArchiveEntry entry = archive.Entries[i]; string entryFilename = entry.Name; if (entryFilename == String.Empty) { entryFilename = i.ToString("D" + archive.Entries.Count.ToString().Length); } archive.ExtractToFile(entry, Path.Combine(fbd.SelectedPath, entryFilename)); } } } }
private void packButton_Click(object sender, EventArgs e) { string sourcePath; string saveFileName; using (var fbd = new VistaFolderBrowserDialog()) { if (fbd.ShowDialog() != DialogResult.OK) return; sourcePath = fbd.SelectedPath; } using (var sfd = new SaveFileDialog()) { if (sfd.ShowDialog() != DialogResult.OK) return; saveFileName = sfd.FileName; } GlobalExtension.UpdateProgress = this.updateProgress; GlobalExtension.CurrentOperationLabel = this.currentOperationLabel; Thread.Sleep(100); // give Globals a chance to initialize GlobalExtension.ShowProgress("Packing archive ..."); Application.DoEvents(); try { Stopwatch sw = new Stopwatch(); sw.Restart(); Packer.Pack(sourcePath, saveFileName, updateSng); 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 btnWwisePath_Click(object sender, EventArgs e) { using (var fbd = new VistaFolderBrowserDialog()) { fbd.SelectedPath = general_wwisepath.Name; fbd.Description = "Select Wwise CLI installation folder."; if (fbd.ShowDialog() != DialogResult.OK) return; var wwisePath = fbd.SelectedPath; general_wwisepath.Text = wwisePath; ConfigRepository.Instance()[general_wwisepath.Name] = wwisePath; } }
private void SelectFolderButton_Click( object sender, RoutedEventArgs e ) { try { var dialog = new VistaFolderBrowserDialog {Description = @"Please select your Series folder.", UseDescriptionForTitle = true}; var result = dialog.ShowDialog(); if ( result != System.Windows.Forms.DialogResult.OK ) { return; } this.set_ready( false ); if ( Factory.Instance.MetaDataReady >= 3 ) { Factory.Instance.MetaDataReady = 1; } this.PathLabel.Visibility = Visibility.Visible; Factory.Instance.ScanLocation = dialog.SelectedPath; this.ScanLocationLabel.Content = dialog.SelectedPath; Factory.Instance.ItemProvider = new ItemProvider(); this.SeriesTreeView.DataContext = Factory.Instance.ItemProvider.Items; Factory.Instance.ItemProvider.scan_series_folder(); if ( Factory.Instance.TvdbAvailable == false ) { MessageBox.Show( "Unable to access thetvdb." + Environment.NewLine + "This functionality will be disabled", "Connectivity Issues" ); return; } Factory.Instance.fetch_tvdb_metadata(); } catch ( Exception ex ) { Factory.Instance.LogLines.Enqueue( ex.Message ); Factory.Instance.LogLines.Enqueue( ex.StackTrace ); } }
private void button2_Click(object sender, EventArgs e) { Ookii.Dialogs.VistaFolderBrowserDialog folderdialog = new Ookii.Dialogs.VistaFolderBrowserDialog(); VistaSaveFileDialog folderdialog2 = new VistaSaveFileDialog(); string filename = ""; GameSeries indexcombo = Utils.getSeries(Program.mainf.cb_method.SelectedIndex); switch (comboBox1.SelectedIndex) { case 6: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { filename = Program.mainXBB.getFileName(i).Replace("\0", ""); papa tempapa = new papa(Program.mainXBB.getSelectedfile(i)); StringBuilder buildstr = new StringBuilder(); for (int j = 0; j < tempapa.Count - 1; j++) { msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo); buildstr.AppendLine("============================================"); buildstr.AppendLine(newMsg.GetVariableSection()).Append("\n"); buildstr.AppendLine("--------------------------------------------"); buildstr.AppendLine(newMsg.GetTextSection()).Append("\n"); } progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + (i + 1) + " of " + Program.mainXBB.getCount(); })); File.WriteAllText(pathe + @"\" + filename + ".txt", buildstr.ToString(), Encoding.UTF8); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 0: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { File.WriteAllBytes(pathe + Program.mainXBB.getFileName(i).Replace("\0", "") + ".pp", Program.mainXBB.getSelectedfile(i)); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { progressBar1.Text = "Progress : " + i + " of " + Program.mainXBB.getCount(); })); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 1: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { filename = Program.mainXBB.getFileName(i).Replace("\0", ""); papa tempapa = new papa(Program.mainXBB.getSelectedfile(i)); ppmsg4 newtempjson = new ppmsg4(); newtempjson.Date = DateTime.Now; newtempjson.Author = "BokujoMessage4 JSON generated files"; newtempjson.Content = new pmsg4[tempapa.Count - 1]; for (int j = 0; j < tempapa.Count - 1; j++) { msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo); newtempjson.Content[j].VardId = newMsg.GetVariableSection(); newtempjson.Content[j].Text = newMsg.GetTextSection(); } progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainXBB.getCount(); })); File.WriteAllText(pathe + @"\" + filename + ".json", JsonConvert.SerializeObject(newtempjson, Formatting.Indented), Encoding.UTF8); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 2: filename = Program.mainf.cb_xbb.Text; folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + filename + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainPP.Count; Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainPP.Count - 1; i++) { msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo); File.WriteAllText(pathe + newMsg.GetVariableSection() + ".txt", newMsg.GetTextSection(), Encoding.UTF8); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainPP.Count; })); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 3: filename = Program.mainf.cb_xbb.Text; folderdialog = new Ookii.Dialogs.VistaFolderBrowserDialog(); folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + filename + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainPP.Count; Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainPP.Count - 1; i++) { msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo); File.WriteAllBytes(pathe + newMsg.GetVariableSection() + ".msg4", newMsg.GetMSGData()); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainPP.Count; })); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 5: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { filename = Program.mainXBB.getFileName(i).Replace("\0", ""); papa tempapa = new papa(Program.mainXBB.getSelectedfile(i)); FileInfo newFile = new FileInfo(pathe + @"\" + filename + ".xlsx"); ExcelPackage pck = new ExcelPackage(newFile); if (File.Exists(newFile.FullName)) { File.Delete(newFile.FullName); } var ws = pck.Workbook.Worksheets.Add(filename); for (int j = 0; j < tempapa.Count - 1; j++) { msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo); ws.Cells["A" + (j + 1)].Value = newMsg.GetVariableSection(); ws.Cells["B" + (j + 1)].Value = newMsg.GetTextSection(); } progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + (i + 1) + " of " + Program.mainXBB.getCount(); })); pck.Save(); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 4: filename = Program.mainf.cb_xbb.Text; folderdialog2.FileName = filename + ".json"; folderdialog2.Filter = "JSON files (*.json) | *.json"; folderdialog2.InitialDirectory = Program.AConfig.FilePath[0]; if (folderdialog2.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = Path.GetDirectoryName(folderdialog2.InitialDirectory) + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } ppmsg4 newtempjson = new ppmsg4(); newtempjson.Date = DateTime.Now; newtempjson.Author = "BokujoMessage4 JSON generated files"; newtempjson.Content = new pmsg4[Program.mainPP.Count - 1]; progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainPP.Count; Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainPP.Count - 1; i++) { msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo); newtempjson.Content[i].VardId = newMsg.GetVariableSection(); newtempjson.Content[i].Text = newMsg.GetTextSection(); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainPP.Count; })); } uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); File.WriteAllText(folderdialog2.FileName, JsonConvert.SerializeObject(newtempjson, Formatting.Indented), Encoding.UTF8); } break; } }
/// <summary> /// Selects the path for the find and replace /// </summary> private void BrowseButtonClick(Object sender, EventArgs e) { VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog(); fbd.Multiselect = true; String curDir = this.folderComboBox.Text; if (curDir == "<Project>") { if (PluginBase.CurrentProject != null) { String projectPath = PluginBase.CurrentProject.ProjectPath; curDir = Path.GetDirectoryName(projectPath); } else curDir = Globals.MainForm.WorkingDirectory; } if (Directory.Exists(curDir)) fbd.SelectedPath = curDir; if (fbd.ShowDialog() == DialogResult.OK && Directory.Exists(fbd.SelectedPath)) { this.folderComboBox.Text = String.Join(";", fbd.SelectedPaths); this.folderComboBox.SelectionStart = this.folderComboBox.Text.Length; } }
private string ExtractPackagedProject(string packagePath) { using (FileStream fs = new FileStream(packagePath, FileMode.Open, FileAccess.Read)) using (ZipFile zFile = new ZipFile(fs)) { if (zFile.GetEntry(".actionscriptProperties") != null) { using (VistaFolderBrowserDialog saveDialog = new VistaFolderBrowserDialog()) { saveDialog.ShowNewFolderButton = true; saveDialog.UseDescriptionForTitle = true; saveDialog.Description = TextHelper.GetString("Title.ImportPackagedProject"); if (saveDialog.ShowDialog() == DialogResult.OK) { foreach (ZipEntry entry in zFile) { Int32 size = 4095; Byte[] data = new Byte[4095]; string newPath = Path.Combine(saveDialog.SelectedPath, entry.Name.Replace('/', '\\')); if (entry.IsFile) { Stream zip = zFile.GetInputStream(entry); String dirPath = Path.GetDirectoryName(newPath); if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath); FileStream extracted = new FileStream(newPath, FileMode.Create); while (true) { size = zip.Read(data, 0, data.Length); if (size > 0) extracted.Write(data, 0, size); else break; } extracted.Close(); extracted.Dispose(); } else { Directory.CreateDirectory(newPath); } } } return Path.Combine(saveDialog.SelectedPath, ".actionScriptProperties"); } } } return string.Empty; }
private void browseButton_Click(object sender, System.EventArgs e) { VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog(); dialog.RootFolder = Environment.SpecialFolder.Desktop; dialog.UseDescriptionForTitle = true; dialog.Description = TextHelper.GetString("Info.SelectProjectDirectory"); string selectedPath = locationTextBox.Text; // try to get as close as we can to the directory you typed in try { while (!Directory.Exists(selectedPath)) { selectedPath = Path.GetDirectoryName(selectedPath); } } catch { selectedPath = ProjectPaths.DefaultProjectsDirectory; } dialog.SelectedPath = selectedPath; if (dialog.ShowDialog(this) == DialogResult.OK) { locationTextBox.Text = dialog.SelectedPath; locationTextBox.SelectionStart = locationTextBox.Text.Length; // smart project naming if (!this.createDirectoryBox.Checked && this.nameTextBox.Text == TextHelper.GetString("Info.NewProject")) { string name = Path.GetFileName(dialog.SelectedPath); if (name.Length > 5) { this.nameTextBox.Text = name.Substring(0, 1).ToUpper() + name.Substring(1); } } } }
private void btn_SteamDLCFolder_Click(object sender, EventArgs e) { using (var fbd = new VistaFolderBrowserDialog()) { if (fbd.ShowDialog() != DialogResult.OK) return; var temppath = fbd.SelectedPath; txt_FTPPath.Text = temppath; //-Save the location in the Config file/reg //ConfigRepository.Instance()["ManageTempFolder"] = temppath; } }
private void btn_SteamDLCFolder_Click(object sender, EventArgs e) { using (var fbd = new VistaFolderBrowserDialog()) { if (fbd.ShowDialog() != DialogResult.OK) return; var temppath = fbd.SelectedPath; txt_FTPPath.Text = temppath; } }
private void btn_CompileDir_Click(object sender, EventArgs e) { VistaFolderBrowserDialog scriptDir = new VistaFolderBrowserDialog(); if (!VistaFolderBrowserDialog.IsVistaFolderDialogSupported) MessageBox.Show(this, "Because you are not using Windows Vista or later, the regular folder browser dialog will be used. Please use Windows Vista to see the new dialog.", "Sample folder browser dialog"); // FolderBrowserDialog scriptDir = new FolderBrowserDialog(); if (scriptDir.ShowDialog() == DialogResult.OK) { ecompile.FileName = ecompilerPath; ecompile.Arguments = "-r \"" + scriptDir.SelectedPath + "\"" + " -Ecfgpath " + ecompilerPath.Replace(".exe", ".cfg"); ecompile.UseShellExecute = false; ecompile.CreateNoWindow = true; ecompile.ErrorDialog = false; ecompile.RedirectStandardInput = false; ecompile.RedirectStandardOutput = true; lastFolder = scriptDir.SelectedPath; ListDirectory(lastFolder); compileScripts(); if (!btn_lastFolder.Enabled) btn_lastFolder.Enabled = true; if (!tree_folders.Enabled) tree_folders.Enabled = true; } }
/// <summary> /// Gets the user selected folder /// </summary> public static String GetOpenDir() { VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog(); fbd.RootFolder = Environment.SpecialFolder.MyComputer; if (fbd.ShowDialog(Globals.MainForm) == DialogResult.OK) return fbd.SelectedPath; else return String.Empty; }
private void btnRs1Path_Click(object sender, EventArgs e) { using (var fbd = new VistaFolderBrowserDialog()) { fbd.SelectedPath = general_rs1path.Name; fbd.Description = "Select Rocksmith 2012 executable root installation folder."; if (fbd.ShowDialog() != DialogResult.OK) return; var rs1Path = fbd.SelectedPath; general_rs1path.Text = rs1Path; ConfigRepository.Instance()[general_rs1path.Name] = rs1Path; } }