Exemplo n.º 1
0
 private void textBoxWorkingPath_Click(object sender, EventArgs e)
 {
     ofd.FileName = textBoxWorkingPath.Text;
     if (ofd.ShowDialog() == false)
     {
         return;
     }
     textBoxWorkingPath.Text = ofd.FileName;
 }
Exemplo n.º 2
0
        private void btnExtractAll_Click(object sender, EventArgs e)
        {
            if (tvFolders.SelectedNode == null)
            {
                return;
            }

            if (_openFolderDialog.ShowDialog(this) == DialogResult.OK)
            {
                this.ExtractFiles(_openFolderDialog.Folder,
                                  false,
                                  true,
                                  this.SelectedArchiveNode.Archive.Files.ToArray());
            }
        }
Exemplo n.º 3
0
        protected virtual void InitializeCommands()
        {
            OpenEmulatorFolderCommand = new RelayCommand(p =>
            {
                OpenFolderDialog openFolderDialog = new OpenFolderDialog();

                if (openFolderDialog.ShowDialog() == true)
                {
                    SetSelectedPath(openFolderDialog.SelectedPath);
                }
            });

            OpenFolderCommand = new RelayCommand(p =>
            {
                try
                {
                    var path = Path.GetFullPath(SelectedPath);
                    Process.Start(path);
                }
                catch
                {
                    Process.Start(Environment.CurrentDirectory);
                }
            });

            OpenMTPFolderCommand = new RelayCommand(p =>
            {
                var mtp = mTPManager.Open(SelectedPath);
                if (mtp.Result == true)
                {
                    SetSelectedPath(mtp.SelectedPath);
                }
            });
        }
Exemplo n.º 4
0
 private void ButtonBrowseFolder_Click(object sender, EventArgs e)
 {
     if (OpenFolderDialog.ShowDialog(this) == DialogResult.OK)
     {
         TextFolder.Text = OpenFolderDialog.SelectedPath;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void openFileSystemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (worker.IsBusy)
            {
                return;
            }

            fileSystemToolStripMenuItem.Enabled      = false;
            iSOToolStripMenuItem.Enabled             = true;
            saveAsToolStripMenuItem.Enabled          = true;
            saveToolStripMenuItem.Enabled            = true;
            closeFileSystemToolStripMenuItem.Enabled = true;

            using (OpenFolderDialog d = new OpenFolderDialog())
            {
                if (d.ShowDialog() == DialogResult.OK)
                {
                    if (openedPath == d.SelectedPath)
                    {
                        MessageBox.Show("File System is already opened", "Open ISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        if (Core.MEX.InitFromFileSystem(d.SelectedPath))
                        {
                            FileSystemLoaded(d.SelectedPath);
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void fileSystemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (worker.IsBusy || !Core.MEX.Initialized)
            {
                return;
            }

            rebuildPath = null;

            using (var d = new OpenFolderDialog())
            {
                d.Title = "Choose output folder";

                if (d.ShowDialog() == DialogResult.OK)
                {
                    rebuildPath = d.SelectedPath;
                }
                else
                {
                    return;
                }
            }

            BeginSaving(ForceMode.FileSystem);
        }
        private void btExportCSV_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFolderDialog();

            if (ofd.ShowDialog(this) == DialogResult.OK)
            {
                //получаем список анкет в выбранной папке
                var anketas = Directory.GetFiles(ofd.Folder, "*.a").Select(path => SaverLoader.Load <Anketa>(path)).ToList();
                if (anketas.Count == 0)
                {
                    MessageBox.Show("В этой папке не найдены анкеты");
                    return;
                }

                //запрашиваем имя выходного csv файла
                var sfd = new SaveFileDialog()
                {
                    Filter = "CSV|*.csv"
                };
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    //экспортируем
                    new Export().ExportToCSV(anketas, sfd.FileName);
                    MessageBox.Show("Экспортировано " + anketas.Count + " анкет");
                }
            }
        }
Exemplo n.º 8
0
        void Brouse(object sender, EventArgs e)
        {
            if (Environment.OSVersion.Version.Major >= 6)
            {
                OpenFolderDialog dialog = new OpenFolderDialog();

                if (System.IO.Directory.Exists(DirPath))
                {
                    dialog.InitialFolder = DirPath;
                }

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    DirPath = dialog.Folder;
                }
            }
            else
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog()
                {
                    Description = "検索対象のフォルダを選択してください。",
                };
                if (System.IO.Directory.Exists(DirPath))
                {
                    dialog.SelectedPath = DirPath;
                }

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    DirPath = dialog.SelectedPath;
                }
            }
        }
Exemplo n.º 9
0
        public AssetTypeValueField GetBaseField(AssetContainer cont)
        {
            var item     = cont.Item;
            var fileInst = cont.FileInstance;

            if (item.TypeID == 0x72)
            {
                var tt = fileInst.file.typeTree;
                //check if typetree data exists already
                if (!tt.hasTypeTree || AssetHelper.FindTypeTreeTypeByScriptIndex(tt, item.MonoID) == null)
                {
                    var filePath    = Path.GetDirectoryName(fileInst.parentBundle != null ? fileInst.parentBundle.path : fileInst.path);
                    var managedPath = Path.Combine(filePath ?? Environment.CurrentDirectory, "Managed");
                    if (!Directory.Exists(managedPath))
                    {
                        var ofd = new OpenFolderDialog
                        {
                            Title = @"Select a folder for assemblies"
                        };
                        if (ofd.ShowDialog() != DialogResult.OK)
                        {
                            return(cont.TypeInstance?.GetBaseField());
                        }

                        managedPath = ofd.Folder;
                    }
                    var monoField = GetMonoBaseField(cont, managedPath);
                    if (monoField != null)
                    {
                        return(monoField);
                    }
                }
            }
            return(cont.TypeInstance?.GetBaseField());
        }
Exemplo n.º 10
0
        private void BatchExportRaw(List <AssetContainer> selectedAssets)
        {
            var fd = new OpenFolderDialog
            {
                Title = "Select a folder for the raw assets"
            };

            if (fd.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            foreach (var cont in selectedAssets)
            {
                var item = cont.Item;
                var name = item.Name;
                if (string.IsNullOrEmpty(name))
                {
                    name = "Unnamed asset";
                }

                var fileName = $"{name}-{Workspace.LoadedFiles[item.FileID].name}-{item.PathID}-{item.Type}.dat";
                var path     = Path.Combine(fd.Folder, fileName);
                Exporter.ExportRawAsset(path, item);
            }
        }
        private void ButtonOpenFolder_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFolderDialog();

            dialog.Title         = "Sample Open Folder dialog";
            dialog.OkButtonLabel = "Test OK";
            dialog.ShowDialog();
        }
Exemplo n.º 12
0
        private void btnDirectFolder_Click(object sender, EventArgs e)
        {
            OpenFolderDialog dialog = new OpenFolderDialog();

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                lblDirect.Text = dialog.Folder.TrimEnd(System.IO.Path.DirectorySeparatorChar) + System.IO.Path.DirectorySeparatorChar;
            }
        }
 /// <summary>
 /// Browse folder button clicked
 /// </summary>
 private void btnBrowseFolder_Click(object sender, EventArgs e)
 {
     // do we have a folder selected?
     if (OpenFolderDialog.ShowDialog(this) == DialogResult.OK)
     {
         // set the folder path into the textbox
         txtFolder.Text = OpenFolderDialog.SelectedPath;
     }
 }
Exemplo n.º 14
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFolderDialog ofd = new OpenFolderDialog();

            if (ofd.ShowDialog(this) == DialogResult.OK)
            {
                txtDefaultDirectory.Text = ofd.Folder;
            }
        }
Exemplo n.º 15
0
        // フォルダの参照イベント
        private void FolderRefButton_Click(object sender, EventArgs e)
        {
            DialogResult dr = OpenFolderDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                FolderText.Text = GetRelPath(OpenFolderDialog.SelectedPath, @"\Game\");
            }
        }
Exemplo n.º 16
0
        private void Open_Click(object sender, EventArgs e)
        {
            if ((ModifierKeys & Keys.Shift) == Keys.Shift)
            {
                // Open Folder dialog
                if (OpenFolderDialog.ShowDialog() == DialogResult.OK)
                {
                    // Populate the Textbox with the folder
                    InputFile.Text = OpenFolderDialog.SelectedPath;
                    bulkUnpack     = true;

                    // Output Options? No
                    Header.Visible      = false;
                    OnlyUpdated.Visible = false;
                    Plaintext.Visible   = false;
                }
            }
            else
            {
                /// Open File dialog
                if (OpenFileDialog.ShowDialog() == DialogResult.OK)
                {
                    /// Populate the Textbox with the file and set as current directory
                    InputFile.Text = OpenFileDialog.FileName;
                    OpenFileDialog.InitialDirectory = OpenFileDialog.FileName;
                    //MessageBox.Show(Path.GetExtension(InputFile.Text));

                    switch (Path.GetExtension(InputFile.Text))
                    {
                    case ".xci":
                        /// Output Options? No
                        Header.Visible      = false;
                        OnlyUpdated.Visible = false;
                        Plaintext.Visible   = false;
                        break;

                    case ".nsp":
                        /// Output Options? No
                        Header.Visible      = false;
                        OnlyUpdated.Visible = false;
                        Plaintext.Visible   = false;
                        break;

                    case ".nca":
                    default:
                        /// Output Options? Yes
                        Header.Visible      = true;
                        OnlyUpdated.Visible = true;
                        Plaintext.Visible   = true;
                        break;
                    }

                    bulkUnpack = false;
                }
            }
        }
Exemplo n.º 17
0
    public string GetFolderPath()
    {
        var openFolderDialog = new OpenFolderDialog();

        if (openFolderDialog.ShowDialog() == DialogResult.OK)
        {
            return(openFolderDialog.SelectedPath);
        }
        return(string.Empty);
    }
Exemplo n.º 18
0
        private void btnBrowseDest_Click(object sender, EventArgs e)
        {
            OpenFolderDialog dlg = new OpenFolderDialog();

            dlg.SelectedPath = txtDestFolder.Text;
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                txtDestFolder.Text = dlg.SelectedPath;
            }
        }
Exemplo n.º 19
0
        private void button4_Click(object sender, EventArgs e)
        {
            OpenFolderDialog openFolderDialog = new OpenFolderDialog();

            if (openFolderDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            ExtractTextFromScriptsAsync(openFolderDialog.Folder);
        }
Exemplo n.º 20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="filter"></param>
 /// <returns></returns>
 public static string OpenFolder()
 {
     using (OpenFolderDialog d = new OpenFolderDialog())
     {
         if (d.ShowDialog() == DialogResult.OK)
         {
             return(d.SelectedPath);
         }
     }
     return(null);
 }
Exemplo n.º 21
0
        /// <summary>
        /// Set download  directory to a custom directory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SetDownloadFolderButton_Click(object sender, EventArgs e)
        {
            DialogResult result = OpenFolderDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string newDownloadDirectory = OpenFolderDialog.SelectedPath;
                defaultDownloadDirectory = newDownloadDirectory;
                irc.setCustomDownloadDir(newDownloadDirectory);
            }
        }
        // ---------------------------------------------------------------------------------------
        public void CreateTemplate()
        {
            if (string.IsNullOrWhiteSpace(SelectedTemplate))
            {
                return;
            }

            // Choose folder
            var openFolderDialog = new OpenFolderDialog();

            if (openFolderDialog.ShowDialog(new WindowInteropHelper(Application.Current.MainWindow).Handle) == System.Windows.Forms.DialogResult.OK)
            {
                var chosenFolder = openFolderDialog.Folder;

                // Extract to temp dir
                var templateFolderPath = Path.GetFullPath("TempTemplateFolder");
                if (Directory.Exists(templateFolderPath))
                {
                    Directory.Delete(templateFolderPath, true);
                }

                ZipFile.ExtractToDirectory(Path.Combine(TemplateFolder, SelectedTemplate + ".zip"), templateFolderPath);

                // Replace all keys
                Func <string, string> replaceKeys = (input) =>
                {
                    var output = input;

                    foreach (var key in TemplateKeys)
                    {
                        output = output.Replace("%" + key.Name + "%", key.Value);
                    }

                    return(output);
                };

                // Copy to final dir
                foreach (var file in Directory.EnumerateFiles(templateFolderPath, "*", SearchOption.AllDirectories))
                {
                    var fullPath   = Path.GetFullPath(file);
                    var relPath    = fullPath.Replace(templateFolderPath + System.IO.Path.DirectorySeparatorChar, "");
                    var newRelPath = replaceKeys(relPath);
                    var newPath    = Path.Combine(chosenFolder, newRelPath);

                    var contents    = File.ReadAllText(file);
                    var newContents = replaceKeys(contents);

                    File.WriteAllText(newPath, newContents);
                }

                // Cleanup
                Directory.Delete(templateFolderPath, true);
            }
        }
Exemplo n.º 23
0
        private void button2_Click(object sender, EventArgs e)
        {
            OpenFolderDialog openFolderDialog = new OpenFolderDialog();

            if (openFolderDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            outDir      = openFolderDialog.Folder;
            label2.Text = outDir;
        }
Exemplo n.º 24
0
        private void btnExtract_Click(object sender, EventArgs e)
        {
            if (lvFiles.SelectedIndices.Count == 0)
            {
                return;
            }

            if (_openFolderDialog.ShowDialog(this) == DialogResult.OK)
            {
                var files = new List <ArchiveEntry>();

                foreach (int index in lvFiles.SelectedIndices)
                {
                    files.Add(_files[index]);
                }

                bool useFolderPath = Settings.Default.ExtractMaintainFolderStructure;

                this.ExtractFiles(_openFolderDialog.Folder, useFolderPath, true, files.ToArray());
            }
        }
Exemplo n.º 25
0
        static void Main(string [] args)
        {
            FileDialog ofd = new OpenFolderDialog()
            {
                //Filter = "이미지 파일(*.bmp;*.jpg;*.jpeg;*.png)|*.bmp;*.jpg;*.jpeg;*.png",
            };

            if (ofd.ShowDialog() == true)
            {
                Console.WriteLine(ofd.FileName);
            }
        }
Exemplo n.º 26
0
        private static void promptUser()
        {
            directories = new List <string[]>();
            using (StreamReader streamreader = new StreamReader(tr, Encoding.UTF8))
            {
                defaultPath    = streamreader.ReadLine();
                fileExtensions = streamreader.ReadLine().Split(',');
            }

            //Console.Write("Default Directory is {0}\nEnter directory:", defaultPath);
            fb.Title            = "Choose a music folder";
            fb.InitialDirectory = defaultPath;
            fb.ShowDialog(IntPtr.Zero);
            response = fb.SelectedPath;

            path = response;

            if (response != defaultPath)
            {
                Console.WriteLine("make new default? Enter <y> to confirm");

                string r = Console.ReadLine();

                if (r == "y" || r == "Y")
                {
                    using (StreamWriter streamwriter = new StreamWriter(tw))
                    {
                        streamwriter.WriteLine(response);
                        Console.WriteLine("New default directory is {0}", response);
                    }
                }
            }

            string extensions = "";
            int    i          = 0;

            foreach (string ext in fileExtensions)
            {
                extensions += ", " + ext;
                string[] files = Directory.GetFiles(path, "*." + fileExtensions[i], SearchOption.AllDirectories);
                if (files.Length > 0)
                {
                    directories.Add(files);
                    total += files.Length;
                }
                i++;
            }

            extensions = extensions.TrimStart(',', ' ');

            Console.Title = "Reading files from " + path + " | " + extensions;
        }
Exemplo n.º 27
0
        private void FileButton_Click(object sender, EventArgs e)
        {
            DialogResult result = OpenFolderDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string newDownloadDirectory = OpenFolderDialog.SelectedPath;
                Properties.Settings.Default.Directory = newDownloadDirectory;
                Properties.Settings.Default.Save();

                WriteDebugLabel("File set");
            }
        }
        private void addFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var folderDialog = new OpenFolderDialog();

            if (folderDialog.ShowDialog(this) == DialogResult.OK)
            {
                listViewAssets.BeginUpdate();
                this.AddDirectoryAssets(folderDialog.Folder);

                listViewAssets.EndUpdate();
                this.SetSaveButtonsEnableState();
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            OpenFolderDialog dialog = new OpenFolderDialog();

            dialog.Title = (VariableInfo.Value as DirectoryInfo)?.FullName;

            if (!dialog.ShowDialog())
            {
                return;
            }

            VariableInfo.Value = new DirectoryInfo(dialog.FileName);
        }
Exemplo n.º 30
0
        public static string OpenFolderDialog(string Title = null, string InitPath = null)
        {
            OpenFolderDialog openFolderDialog = new OpenFolderDialog()
            {
                InitPath = InitPath,
                Title    = Title
            };

            if (openFolderDialog.ShowDialog() == 0)
            {
                return(null);
            }
            return(openFolderDialog.SelectedFolder);
        }
Exemplo n.º 31
0
        public override WindowResponse Show()
        {
            if (DialogType == FileDialogType.SelectFolder)
            {
                fbdlg = new OpenFolderDialog();
                fbdlg.InitialFolder = InitialDirectory;
                fbdlg.Title = Title;

                WindowResponse resp = WinFormHelper.GetResponse(fbdlg.ShowDialog(owner));
                SelectedPath = fbdlg.Folder;
                return resp;
            }
            else
            {
                switch (DialogType)
                {
                    case FileDialogType.OpenFile:
                        fdlg = new OpenFileDialog();
                        break;
                    case FileDialogType.SaveFile:
                        fdlg = new SaveFileDialog();
                        break;
                }

                fdlg.InitialDirectory = InitialDirectory;
                fdlg.Title = Title;
                string tmpFilter = string.Empty;

                foreach (FileTypeFilter filter in FileTypeFilters)
                {
                    tmpFilter += filter.FilterName + "|";
                    for (int i = 0; i < filter.Filter.Length; i++) tmpFilter += (i == 0 ? "" : ";") + "*." + filter.Filter[i];
                }
                fdlg.Filter = tmpFilter;
                WindowResponse resp = WinFormHelper.GetResponse(fdlg.ShowDialog());
                SelectedPath = fdlg.FileName;
                return resp;
            }
        }
Exemplo n.º 32
0
        private void OnLoadFolder()
        {
            if (!CheckModifiedSaved()) return;

            ClearReadonlyFiles();
            var folderDlg = new OpenFolderDialog();
            folderDlg.Title = Tx.T("msg.load folder.title");
            if (folderDlg.ShowDialog(new Wpf32Window(MainWindow.Instance)) == true)
            {
                DoLoadFolder(folderDlg.Folder);
            }
        }
Exemplo n.º 33
0
 //Select a Text Button
 private void button2_Click(object sender, EventArgs e)
 {
     OpenFolderDialog openDlg = new OpenFolderDialog();
     if (openDlg.ShowDialog(@"All File(*.*)|*.*", "Select a File") == DialogResult.OK)
     {
         this.FileName = openDlg.Path;
         this.textBox1.Text = openDlg.Path;
     }
     else
     {
         this.FileName = "";
         this.textBox1.Text = "";
     }
 }
Exemplo n.º 34
0
        private void btn_extract_Click(object sender, EventArgs e)
        {
            if (filelistview.SelectedObjects.Count < 1)
                return;

            List<fileSystemObject> objectList = new List<fileSystemObject>();
            if (filelistview.SelectedObjects.Count == 1)
            {
                // Handle single Dir
                if (filelistview.SelectedObject is RPFLib.Common.Directory)
                {
                    using (var sfrm = new OpenFolderDialog())
                    {
                        if (sfrm.ShowDialog(this) == DialogResult.OK)
                        {
                            try
                            {
                                using (Cursors.WaitCursor)
                                {
                                    objectList.Add(filelistview.SelectedObject as fileSystemObject);
                                    form_extract extract_form = new form_extract(objectList, Path.GetFullPath(sfrm.Folder));
                                    extract_form.ShowDialog();
                                    extract_form.Dispose();
                                }
                            }
                            catch
                            {
                                MessageBox.Show("Failed to extract files", "Extract Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
                else
                {
                    // Handle single file
                    using (var sfrm = new SaveFileDialog())
                    {
                        var file = filelistview.SelectedObject as RPFLib.Common.File;
                        sfrm.FileName = file.Name;
                        if (sfrm.ShowDialog(this) == DialogResult.OK)
                        {
                            byte[] data = file.GetData(false);
                            System.IO.File.WriteAllBytes(sfrm.FileName, data);
                        }
                    }
                }
            }
            //Handle multiple files/folders
            else if (filelistview.SelectedObjects.Count > 1)
            {
                using (var frm = new OpenFolderDialog())
                {
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        try
                        {
                            using (Cursors.WaitCursor)
                            {
                                foreach (object item in filelistview.SelectedObjects)
                                {
                                    objectList.Add(item as fileSystemObject);
                                }
                                form_extract extract_form = new form_extract(objectList, frm.Folder);
                                extract_form.ShowDialog();
                                extract_form.Dispose();
                            }
                        }
                        catch
                        {
                            MessageBox.Show("Failed to extract files", "Extract Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            else
                return;
        }
Exemplo n.º 35
0
        private void iExtractAll_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (filelistview.Items.Count > 0)
            {
                List<fileSystemObject> objectList = new List<fileSystemObject>();
                using (var frm = new OpenFolderDialog())
                {
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        try
                        {
                            using (Cursors.WaitCursor)
                            {
                                objectList.Add(archiveFile.RootDirectory);
                                if (objectList.Count > 0)
                                {
                                    form_extract extract_form = new form_extract(objectList, frm.Folder);
                                    extract_form.ShowDialog();
                                    extract_form.Dispose();
                                }
                                else
                                    MessageBox.Show("Failed to find root Dir", "Extract Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                            }
                        }
                        catch
                        {
                            MessageBox.Show("Failed to extract files", "Extract Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
Exemplo n.º 36
0
 //Select a Script Button
 private void button4_Click(object sender, EventArgs e)
 {
     OpenFolderDialog openDlg = new OpenFolderDialog();
     if (openDlg.ShowDialog(@"X'moe Script(*.axs)|*.axs", "Select a Script") == DialogResult.OK)
     {
         this.ScriptName = openDlg.Path;
         this.textBox3.Text = openDlg.Path;
     }
     else
     {
         this.ScriptName = "";
         this.textBox3.Text = "";
     }
 }