private void metroButton1_Click(object sender, EventArgs e) { OpenFileDialog oFD = new OpenFileDialog() { ValidateNames = false, CheckFileExists = false, InitialDirectory = FolderPath != null ? FolderPath : Environment.GetFolderPath(Environment.SpecialFolder.CommonPictures), Title = "Choose folder with pictures to sort", CheckPathExists = true, Filter = "Picture Files (*.png, *.jpg)|*.png;*.jpg|All files|*.*" }; Ookii.Dialogs.WinForms.VistaFolderBrowserDialog fBD = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog() { ShowNewFolderButton = true, Description = "Choose folder with pictures to sort", UseDescriptionForTitle = true, RootFolder = Environment.SpecialFolder.CommonPictures }; if (DialogResult.OK == fBD.ShowDialog()) { FolderPath = fBD.SelectedPath; tbfolderpath.Text = FolderPath; } }
/// <summary> /// Shows the directory browser and updates the search directory if ok is clicked on the dialog. /// </summary> private void showDirectoryBrowser() { if (uDirectoryBrowser.ShowDialog() == DialogResult.OK) { uDirectoryList.Text = uDirectoryBrowser.SelectedPath; } }
private void SelectFolder() { try { if (string.IsNullOrWhiteSpace(txtOutputDirectory.Text)) { AutoDefineOutputDirectory(); } var browser = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog { SelectedPath = txtOutputDirectory.Text }; var result = browser.ShowDialog(); if (result == DialogResult.OK) { txtOutputDirectory.Text = browser.SelectedPath; } } catch (Exception) { // Ignore errors here } }
/// <summary> /// Process the selected solution from the folder dialog by language /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessSelectSolutionButton_Click(object sender, EventArgs e) { Solution = Operations.Solution; MainListView.Items.Clear(); var initialPath = @"C:\OED\Dotnetland\VS2019\"; if (Environment.UserName != "PayneK") { initialPath = @"C:\"; } var dialog = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog { SelectedPath = initialPath, ShowNewFolderButton = false, Description = @"Select solution folder", UseDescriptionForTitle = true }; if (dialog.ShowDialog() == DialogResult.OK) { var projectType = ((ProjectType)ProjectTypeComboBox.SelectedItem).Extension; Operations.BuilderPackageTable(dialog.SelectedPath, projectType); Solution = Operations.Solution; DisplayDetails(); ExportToWebPageButton.Enabled = Solution.Packages.Any(); PackageComboBox.DataSource = Operations.DistinctPackageNames(); } }
private void destinationFolderBrowseButton_Click(object sender, EventArgs e) { Ookii.Dialogs.WinForms.VistaFolderBrowserDialog dialog = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog(); dialog.SelectedPath = destinationFolderBox.Text; if (dialog.ShowDialog(this) == DialogResult.OK) { destinationFolderBox.Text = dialog.SelectedPath; } }
private void directoryBrowseButtonClick(object sender, EventArgs e) { var dialog = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog(); var result = dialog.ShowDialog(this); if (result == DialogResult.OK) { this.directoryTextBox.Text = dialog.SelectedPath; } }
private void button1_Click(object sender, EventArgs e) { Ookii.Dialogs.WinForms.VistaFolderBrowserDialog fileDialog = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog(); fileDialog.SelectedPath = textBox1.Text; fileDialog.ShowDialog(); musicManager.RemoveFolder(textBox1.Text); musicManager.SaveFolder(fileDialog.SelectedPath); if (fileDialog.SelectedPath != textBox1.Text) { _OptionsBoard.PathChanged(); } textBox1.Text = fileDialog.SelectedPath; }
private void btnBrowseOutputFolder_Click(object sender, EventArgs e) { Ookii.Dialogs.WinForms.VistaFolderBrowserDialog dlg = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog(); string path = Settings.OutputFolder; if (!string.IsNullOrWhiteSpace(path)) { // Ookii dialogs does not support InitialDirectory. The best we can do is set SelectedPath. // This opens to the folder most recently opened, but the path text box is set to the selected // path. dlg.SelectedPath = path; } DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) { Settings.OutputFolder = dlg.SelectedPath; } }
/// <summary> /// Process the selected solution from the folder dialog by language /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessSelectSolutionButton_Click(object sender, EventArgs e) { var dialog = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog { SelectedPath = @"C:\OED\Dotnetland\", ShowNewFolderButton = false, Description = @"Select solution folder", UseDescriptionForTitle = true }; if (dialog.ShowDialog() == DialogResult.OK) { listView1.Items.Clear(); var projectType = ((ProjectType)ProjectTypeComboBox.SelectedItem).Extension; Operations.BuilderPackageTable(dialog.SelectedPath, projectType); Solution = Operations.Solution; DisplayDetails(); } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { Ookii.Dialogs.WinForms.VistaFolderBrowserDialog dlg = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog(); //Used a custom folder selection dialog, just because I didn't want to torture myself and other people using this code. (Microsoft, please make this an actual part of WinForms next time, not an ancient nugget package) if (dlg.ShowDialog() == DialogResult.OK) { //Disable GUI, to prevent random exceptions and user intervention fileNameBox.Enabled = false; newFileNameBox.Enabled = false; cgfxStringsBox.Enabled = false; if (!Directory.Exists(dlg.SelectedPath)) { return; //Just give up is the given path doesn't exist } folderPath = dlg.SelectedPath; //Set global variable with current file path var files = Directory.GetFiles(folderPath, "*.mnlmap"); //Look for .mnlmap files, somehow I managed to get this tied to another one of my useless tools... foreach (var file in files) //Loop through all map files { BinaryReader br = new BinaryReader(File.OpenRead(file)); //Open file br.BaseStream.Position = 0x60; //Go to 0x60 immidialtely, since the rest is practically useless uint cgfxOffset = br.ReadUInt32(); //Read start offset of CGFX data uint cgfxLength = br.ReadUInt32(); //Read length of CGFX data byte[] cgfxData = new byte[cgfxLength]; //Create a byte array to store this br.BaseStream.Position = cgfxOffset; //Read the CGFX data into the array...only now, few years after I wrote this, for (uint i = 0; i < cgfxLength; i++) { cgfxData[i] = br.ReadByte(); //I realize how stupid this is: basically just trash the whole RAM with CGFX data... } itemList.Add(new ThingyItem(Path.GetFileNameWithoutExtension(file), cgfxOffset, cgfxLength, cgfxData)); //Add item to file list br.Close(); //Close reader } foreach (var item in itemList) { fileNameBox.Items.Add(item.fileName); //Now add those entries to the GUI list } fileNameBox.SelectedIndex = 0; //Change selected intex to 0 to trigger an event //Re-enable the GUI fileNameBox.Enabled = true; newFileNameBox.Enabled = true; cgfxStringsBox.Enabled = true; } }
private void mnlmapToCgfxToolStripMenuItem_Click(object sender, EventArgs e) { //As NOT noted by the GUI in any way, this function is standalone. Refer to openToolStripMenuItem_Click() commentary for info, since this is basically the same, just saves CGFX to file List <ThingyItem> tempList = new List <ThingyItem>(); Ookii.Dialogs.WinForms.VistaFolderBrowserDialog dlg = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog(); if (dlg.ShowDialog() == DialogResult.OK) { fileNameBox.Enabled = false; newFileNameBox.Enabled = false; cgfxStringsBox.Enabled = false; if (!Directory.Exists(dlg.SelectedPath)) { return; } folderPath = dlg.SelectedPath; var files = Directory.GetFiles(folderPath, "*.mnlmap"); foreach (var file in files) { BinaryReader br = new BinaryReader(File.OpenRead(file)); br.BaseStream.Position = 0x60; uint cgfxOffset = br.ReadUInt32(); uint cgfxLength = br.ReadUInt32(); byte[] cgfxData = new byte[cgfxLength]; br.BaseStream.Position = cgfxOffset; for (uint i = 0; i < cgfxLength; i++) { cgfxData[i] = br.ReadByte(); } tempList.Add(new ThingyItem(Path.GetFileNameWithoutExtension(file), cgfxOffset, cgfxLength, cgfxData)); br.Close(); } Directory.CreateDirectory(folderPath + "\\to_bcres"); foreach (var item in tempList) { BinaryWriter bw = new BinaryWriter(File.Create(folderPath + "\\to_bcres\\" + item.fileName + ".bcres")); bw.Write(item.cgfxData); bw.Close(); } } }
private void btnBrws_Click(object sender, EventArgs e) { using (Ookii.Dialogs.WinForms.VistaFolderBrowserDialog fbd = new Ookii.Dialogs.WinForms.VistaFolderBrowserDialog() { Description = "Select a folder to store downloads...", UseDescriptionForTitle = true }) { if (!string.IsNullOrEmpty(txtSaveTo.Text)) { fbd.SelectedPath = txtSaveTo.Text; } if (fbd.ShowDialog() == DialogResult.OK) { if (!string.IsNullOrWhiteSpace(txtSaveTo.Text) && Directory.Exists(txtSaveTo.Text)) { string MessageDialog = "Would you like to move your current downloads to the new directory?"; string MessageTotalCount = string.Empty; if (Directory.Exists(txtSaveTo.Text + "\\Tags")) { MessageTotalCount += "\r\nYou have " + Directory.GetDirectories(txtSaveTo.Text + "\\Tags", "*", SearchOption.TopDirectoryOnly).Length + " downloaded tags"; } if (Directory.Exists(txtSaveTo.Text + "\\Pages")) { MessageTotalCount += "\r\nYou have " + Directory.GetDirectories(txtSaveTo.Text + "\\Pages", "*", SearchOption.TopDirectoryOnly).Length + " downloaded pages"; } if (Directory.Exists(txtSaveTo.Text + "\\Pools")) { MessageTotalCount += "\r\nYou have " + Directory.GetDirectories(txtSaveTo.Text + "\\Pools", "*", SearchOption.TopDirectoryOnly).Length + " downloaded pools"; } if (Directory.Exists(txtSaveTo.Text + "\\Images")) { int ExplicitCount = 0; int QuestionableCount = 0; int SafeCount = 0; if (Directory.Exists(txtSaveTo.Text + "\\Images\\explicit")) { ExplicitCount += Directory.GetFiles(txtSaveTo.Text + "\\Images\\explicit", "*", SearchOption.TopDirectoryOnly).Length; } if (Directory.Exists(txtSaveTo.Text + "\\Images\\questionable")) { QuestionableCount += Directory.GetFiles(txtSaveTo.Text + "\\Images\\questionable", "*", SearchOption.TopDirectoryOnly).Length; } if (Directory.Exists(txtSaveTo.Text + "\\Images\\safe")) { SafeCount += Directory.GetFiles(txtSaveTo.Text + "\\Images\\safe", "*", SearchOption.TopDirectoryOnly).Length; } MessageTotalCount += string.Format("\r\nYou have " + (ExplicitCount + QuestionableCount + SafeCount) + " downloaded images\r\n({0} explicit, {1} questionable, {2} safe)", ExplicitCount, QuestionableCount, SafeCount); } if (!string.IsNullOrWhiteSpace(MessageTotalCount)) { MessageTotalCount = "\r\n" + MessageTotalCount; } switch (MessageBox.Show(MessageDialog + MessageTotalCount, "aphrodite", MessageBoxButtons.YesNoCancel)) { case System.Windows.Forms.DialogResult.Cancel: return; case System.Windows.Forms.DialogResult.Yes: if (Directory.Exists(txtSaveTo.Text + "\\Tags")) { Directory.Move(txtSaveTo.Text + "\\Tags", fbd.SelectedPath + "\\Tags"); } if (Directory.Exists(txtSaveTo.Text + "\\Pages")) { Directory.Move(txtSaveTo.Text + "\\Pages", fbd.SelectedPath + "\\Pages"); } if (Directory.Exists(txtSaveTo.Text + "\\Pools")) { Directory.Move(txtSaveTo.Text + "\\Pools", fbd.SelectedPath + "\\Pools"); } if (Directory.Exists(txtSaveTo.Text + "\\Images")) { Directory.Move(txtSaveTo.Text + "\\Images", fbd.SelectedPath + "\\Images"); } break; } } txtSaveTo.Text = fbd.SelectedPath; } } }