示例#1
0
        private void exportAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderSelectDialog fsd = new FolderSelectDialog();
            fsd.Title = "Export all files";

            if (fsd.ShowDialog())
            {
                ProgressDialog progress = new ProgressDialog();
                progress.title.Text = "Exporting all files";
                progress.action.Text = String.Empty;

                BackgroundWorker bw = new BackgroundWorker();
                bw.WorkerReportsProgress = true;
                bw.DoWork += delegate(object sender2, DoWorkEventArgs e2)
                {
                    gameISO.ExportDirectory(gameISO.FileSystem.Root, fsd.FileName, sender2 as BackgroundWorker);
                };
                bw.RunWorkerCompleted += delegate(object sender2, RunWorkerCompletedEventArgs e2)
                {
                    progress.Close();
                    this.Enabled = true;
                    this.Focus();
                };
                bw.ProgressChanged += delegate(object sender2, ProgressChangedEventArgs e2)
                {
                    progress.action.Text = (string)e2.UserState;
                    progress.progressBar.Value = e2.ProgressPercentage;
                };

                this.Enabled = false;
                progress.Show();
                bw.RunWorkerAsync();
            }
        }
        private void ExportAll(object sender, EventArgs e)
        {
            FolderSelectDialog ofd = new FolderSelectDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var archiveFiles = ArchiveFile.Files.ToList();
                ProgressWindow.Start(() => ExtractFiles(ofd.SelectedPath, archiveFiles), MainForm.Instance);
            }
        }
示例#3
0
 public static void IndexFolder(TaskSettings taskSettings = null)
 {
     using (FolderSelectDialog dlg = new FolderSelectDialog())
     {
         if (dlg.ShowDialog())
         {
             IndexFolder(dlg.FileName, taskSettings);
         }
     }
 }
示例#4
0
        private void SetRedirectSpriteFolderButton_Click(object sender, RoutedEventArgs e)
        {
            FolderSelectDialog fsd = new FolderSelectDialog();

            if (fsd.ShowDialog())
            {
                SceneCurrentSettings.ManiacINIData.RedirectSpriteDataFolder = fsd.FileName;
                RefreshListBoxes();
            }
        }
        internal void ShowOpenFileDialog()
        {
            var dialog = new FolderSelectDialog();

            dialog.InitialDirectory = OutputDirectory;

            if (dialog.ShowDialog() == true)
            {
                OutputDirectory = dialog.FileName;
            }
        }
    //Folder Select
    private void outputFolderClick(object sender, EventArgs e)
    {
        FolderSelectDialog openFolder = new FolderSelectDialog();

        DialogResult result = openFolder.ShowDialog();

        if (result == DialogResult.OK)
        {
            this.outputFolderPath.Text = openFolder.Path;
        }
    }
示例#7
0
        private void BrowseBtnClick(object sender, EventArgs e)
        {
            var dialog = new FolderSelectDialog();

            dialog.InitialDirectory = pathTxtBox.Text;

            if (dialog.ShowDialog())
            {
                pathTxtBox.Text = dialog.FileName;
            }
        }
示例#8
0
        /// <summary>
        ///
        /// </summary>
        void BrowseForFolder()
        {
            var dlg = new FolderSelectDialog();

            if (dlg.ShowDialog() == false)
            {
                return;
            }

            FolderPath = dlg.FolderName;
        }
示例#9
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            var dlg = new FolderSelectDialog();

            var result = dlg.ShowDialog();

            if (result)
            {
                tbxDestination.Text = dlg.FileName;
            }
        }
示例#10
0
 private void btnBrowse_Click(object sender, EventArgs e)
 {
     FolderSelectDialog fsd = new FolderSelectDialog();
     fsd.InitialDirectory = "C:\\";
     fsd.Title = "Choose the root dir of your WindWaker ISO extract.";
     if(fsd.ShowDialog())
     {
         textDir.Text = fsd.FileName;
         UpdateButtonStates();
     }
 }
示例#11
0
 private void browseDownloadDestButton_Click(object sender, EventArgs e)
 {
     FolderSelectDialog dialog = new FolderSelectDialog()
     {
         Title = "Select download destination"
     };
     if (dialog.ShowDialog())
     {
         downloadDestBox.Text = dialog.FileName;
     }
 }
示例#12
0
        private string SelectFolder(object arg)
        {
            var dialog = new FolderSelectDialog();

            if (dialog.ShowDialog() == true)
            {
                return(dialog.FileName);
            }

            return(null);
        }
示例#13
0
        private void DlPathButton_Click(Object sender, EventArgs e)
        {
            var fsd = new FolderSelectDialog( );

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

            ConfigsManager.SavePath = fsd.FileName;
        }
示例#14
0
 private void browseMainDlcFolderButton_Click(object sender, EventArgs e)
 {
     FolderSelectDialog dialog = new FolderSelectDialog();
     dialog.ShowDialog();
     string folder = dialog.FileName;
     if (!folder.Equals(""))
         // Show new folder
         settingsMainDlcFolderTextBox.Text = folder;
         // Save data to settings
         Settings.setDlcMainFolder(settingsMainDlcFolderTextBox.Text);
 }
示例#15
0
 private void openCharacterToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var ofd = new FolderSelectDialog())
     {
         ofd.Title = "Character Folder";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             project.openACMD($"{ofd.SelectedPath}\\script\\animcmd\\body\\motion.mtable", $"{ofd.SelectedPath}\\motion");
         }
     }
 }
示例#16
0
        /// <summary>
        /// Opens the FolderSelectDialog to select a new backup path.
        /// </summary>
        public static void SelectNewBackupPath()
        {
            var dlg = new FolderSelectDialog();

            dlg.Title            = "Please select a new Backup path.";
            dlg.InitialDirectory = string.Empty;

            if (dlg.ShowDialog(View.ParentForm.Handle))
            {
                View.BackupPath = dlg.FileName;
            }
        }
示例#17
0
        private void btnSelectFolder_Click(object sender, EventArgs e)
        {
            try
            {
                using (var fsd = new FolderSelectDialog())
                {
                    fsd.Title = "选择文件夹";
                    if (fsd.ShowDialog(this.Handle))
                    {
                        var folder = fsd.FileName;
                        if (!string.IsNullOrWhiteSpace(folder) && Directory.Exists(folder))
                        {
                            this.DialogResult = DialogResult.OK;

                            DirectoryInfo dir  = new DirectoryInfo(folder);
                            MSelectedItem item = _settingInfo.SelectedItems.FirstOrDefault(n => n.Path == dir.FullName);
                            if (item == null)
                            {
                                item = new MSelectedItem()
                                {
                                    Type = 3, Name = dir.Name, Path = dir.FullName, Guid = Guid.NewGuid().ToString(), CreateTime = DateTime.Now
                                };
                                _settingInfo.SelectedItems.Add(item);
                                SettingHelper.SaveSettingInfo(_settingInfo);
                            }
                            ProjSelectedEvent?.BeginInvoke(item, null, null);
                            this.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.Message, "文件选择处理错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }



            //FolderBrowserDialog dlg = new FolderBrowserDialog();
            //if (dlg.ShowDialog() == DialogResult.OK)
            //{
            //    DirectoryInfo dir = new DirectoryInfo(dlg.SelectedPath);
            //    MSelectedItem item = _settingInfo.SelectedItems.FirstOrDefault(n => n.Path == dir.FullName);
            //    if (item == null)
            //    {
            //        item = new MSelectedItem() { Type = 3, Name = dir.Name, Path = dir.FullName, Guid = Guid.NewGuid().ToString(), CreateTime = DateTime.Now };
            //        _settingInfo.SelectedItems.Add(item);
            //        SettingHelper.SaveSettingInfo(_settingInfo);
            //    }
            //    ProjSelectedEvent?.Invoke(item);
            //    this.Close();
            //}
        }
        private void addBtn_Click(object sender, EventArgs e)
        {
            if (_persistence.Load() != null)
            {
                _folderPathList = _persistence.Load();
            }

            var folderDialog = new FolderSelectDialog();


            if (folderDialog.ShowDialog())
            {
                var folderPath  = folderDialog.FileName;
                var watchFolder = new ProjectRequest
                {
                    Path = folderPath
                };
                _watchFolders.Add(watchFolder);
                var folders = Directory.GetDirectories(folderPath);

                if (folders.Length != 0)
                {
                    foreach (var directory in folders)
                    {
                        var directoryInfo = new DirectoryInfo(directory);

                        if (_folderPathList != null)
                        {
                            if (directoryInfo.Name != "AcceptedRequests")
                            {
                                var selectedFolder = new ProjectRequest
                                {
                                    Name  = directoryInfo.Name,
                                    Path  = folderPath,
                                    Files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories),
                                };
                                if (!_folderPathList.Contains(selectedFolder))
                                {
                                    _folderPathList.Add(selectedFolder);
                                }
                            }
                        }
                    }
                }
                else
                {
                    SetWatchFolder(folderPath);
                }

                foldersListView.SetObjects(_watchFolders);
                Save();
            }
        }
示例#19
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            FolderSelectDialog fsd = new FolderSelectDialog();

            fsd.InitialDirectory = "C:\\";
            fsd.Title            = "Choose the root dir of your WindWaker ISO extract.";
            if (fsd.ShowDialog())
            {
                textDir.Text = fsd.FileName;
                UpdateButtonStates();
            }
        }
示例#20
0
        private void createTab(string selectedPath, WorkspaceType workspaceType, GameConsole gameConsole)
        {
            TabPage tabPage = new TabPage();

            workspaceTabs.TabPages.Add(tabPage);
            switch (workspaceType)
            {
            case WorkspaceType.SBFRESManager:
                BFRESManager bfresManager = new BFRESManager();
                bfresManager.Parent = tabPage;
                bfresManager.Size   = tabPage.Size;
                if (Directory.Exists(selectedPath))
                {
                    bfresManager.BaseProjectPath = selectedPath;
                }
                else
                {
                    if (MessageBox.Show(@"Could not find """ + selectedPath + @""" please specify a new directory", "Missing Directory",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        FolderSelectDialog dialog = new FolderSelectDialog();
                        if (dialog.ShowDialog() == DialogResult.OK)
                        {
                            bfresManager.BaseProjectPath = dialog.SelectedPath;
                        }
                    }
                }

                switch (gameConsole)
                {
                case GameConsole.WiiU:
                    tabPage.Text = "BFRES Manager (Wii U)";
                    bfresManager.NintendoSwitchMode = false;
                    break;

                case GameConsole.Switch:
                    tabPage.Text = "BFRES Manager (Switch)";
                    bfresManager.NintendoSwitchMode = true;
                    break;
                }
                break;

            case WorkspaceType.CEMURulesGenerator:
                CEMURulesGenerator cemuRulesGenerator = new CEMURulesGenerator();
                cemuRulesGenerator.Parent = tabPage;
                cemuRulesGenerator.Size   = tabPage.Size;
                tabPage.Text = "CEMU Rules Generator";
                break;
            }
            workspacePaths.Add(selectedPath);
            workspaces.Add(workspaceType);
            workspaceConsoles.Add(gameConsole);
        }
示例#21
0
        private void bBrowseModelPath_Click(object sender, EventArgs e)
        {
            FolderSelectDialog dirdialog = new FolderSelectDialog();

            dirdialog.Title            = "Select model folder";
            dirdialog.InitialDirectory = tbModelPath.Text;

            if (dirdialog.ShowDialog(this.Handle))
            {
                tbModelPath.Text = dirdialog.FileName;
            }
        }
示例#22
0
        public static void BatchExportLightSetValues()
        {
            // Get the source model folder and then the output folder.
            using (var sourceFolderSelect = new FolderSelectDialog())
            {
                sourceFolderSelect.Title = "Stages Directory";
                if (sourceFolderSelect.ShowDialog() == DialogResult.OK)
                {
                    using (var outputFolderSelect = new FolderSelectDialog())
                    {
                        outputFolderSelect.Title = "Output Directory";
                        if (outputFolderSelect.ShowDialog() == DialogResult.OK)
                        {
                            StringBuilder miscCsv     = new StringBuilder();
                            StringBuilder lightSetCsv = new StringBuilder();
                            StringBuilder fogCsv      = new StringBuilder();
                            StringBuilder unkCsv      = new StringBuilder();

                            string[] files = Directory.GetFiles(outputFolderSelect.SelectedPath, "*.bin", SearchOption.AllDirectories);
                            foreach (string file in files)
                            {
                                if (!(file.Contains("light_set")))
                                {
                                    continue;
                                }

                                ParamFile lightSet;
                                try
                                {
                                    lightSet = new ParamFile(file);
                                }
                                catch (NotImplementedException)
                                {
                                    continue;
                                }

                                // Hardcoding this because all lightsets are structured the same way.
                                // Use basic csv formatting to open in excel, sheets, etc.
                                string[] directories = file.Split('\\');
                                string   stageName   = directories[directories.Length - 3]; // get stage folder name

                                AppendMiscValues(miscCsv, stageName, lightSet);
                                AppendLightSetValues(lightSetCsv, stageName, lightSet);
                                AppendFogSetValues(fogCsv, stageName, lightSet);
                                AppendUnknownValues(unkCsv, stageName, lightSet);
                            }

                            SaveLightSetValues(outputFolderSelect, miscCsv, lightSetCsv, fogCsv, unkCsv);
                        }
                    }
                }
            }
        }
示例#23
0
        private void btnSaveToFile_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderSelectDialog();

            dialog.ShowDialog();
            string selection = dialog.FileName;

            using (var file = new System.IO.StreamWriter($"{selection}\\QuickNoteWidget_{DateTime.Now.ToShortDateString()}.txt", true))
            {
                file.WriteLine(tbxMultiLine.Text);
            }
        }
示例#24
0
 private void splitPopupFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     openFileDialog1.FileName = "";
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         FolderSelectDialog fbox = new FolderSelectDialog();
         if (fbox.ShowDialog() == DialogResult.OK)
         {
             SmashBcatFile.SplitFile(openFileDialog1.FileName, fbox.SelectedPath);
         }
     }
 }
示例#25
0
        private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Dictionary <string, byte[]> files = new Dictionary <string, byte[]>();

            foreach (ListViewItem item in listView1.SelectedItems)
            {
                var bxlan      = item.Tag as BxlanHeader;
                var fileFormat = bxlan.FileInfo;
                //Check parent archive for raw data to export
                if (!fileFormat.CanSave && fileFormat.IFileInfo.ArchiveParent != null)
                {
                    foreach (var file in fileFormat.IFileInfo.ArchiveParent.Files)
                    {
                        if (file.FileName == fileFormat.FileName)
                        {
                            files.Add(file.FileName, file.FileData);
                        }
                    }
                }
                else
                {
                    var mem = new System.IO.MemoryStream();
                    bxlan.FileInfo.Save(mem);
                    files.Add(fileFormat.FileName, mem.ToArray());
                }
            }

            if (files.Count == 1)
            {
                string name = files.Keys.FirstOrDefault();

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.FileName   = System.IO.Path.GetFileName(name);
                sfd.DefaultExt = System.IO.Path.GetExtension(name);

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    System.IO.File.WriteAllBytes(sfd.FileName, files.Values.FirstOrDefault());
                }
            }
            if (files.Count > 1)
            {
                FolderSelectDialog dlg = new FolderSelectDialog();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (var file in files)
                    {
                        string name = System.IO.Path.GetFileName(file.Key);
                        System.IO.File.WriteAllBytes($"{dlg.SelectedPath}/{name}", file.Value);
                    }
                }
            }
        }
示例#26
0
            private void ExportAllAction(object sender, EventArgs e)
            {
                FolderSelectDialog ofd = new FolderSelectDialog();

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    foreach (AudioEntry audio in Nodes)
                    {
                        File.WriteAllBytes($"{ofd.SelectedPath}/{audio.Text}", audio.Data);
                    }
                }
            }
示例#27
0
        private async Task OpenImportLibraryDialog()
        {
            var dialog = new FolderSelectDialog
            {
                Title = "ライブラリディレクトリの場所"
            };

            if (dialog.ShowDialog() == true)
            {
                await LibraryVM.ImportLibrary(dialog.FileName);
            }
        }
示例#28
0
        protected override void ShowDialog()
        {
            var ofd = new FolderSelectDialog
            {
                InitialDirectory = PropertyItem.Value?.ToString()
            };

            if (ofd.ShowDialog(Application.Current.MainWindow) == true)
            {
                PropertyItem.Value = ofd.SelectedPath.Replace(Settings.AppBaseDirectory, ".\\");
            }
        }
示例#29
0
        private void fitOpen_Click(object sender, EventArgs e)
        {
            if (fsDlg.ShowDialog() == DialogResult.OK)
            {
                this.Reset();
                foreach (var p in Directory.EnumerateFiles(fsDlg.SelectedPath))
                {
                    if (p.EndsWith(".bin"))
                    {
                        var acmd = new ACMDFile(p);
                        ScriptFiles.Add(p, acmd);
                        Runtime.WorkingEndian = acmd.Endian;
                    }
                    else if (p.EndsWith(".mtable"))
                    {
                        MotionTable = new MTable(p, Runtime.WorkingEndian);
                    }
                }
                var acmdnode = new TreeNode("ACMD")
                {
                    Name = "nACMD"
                };

                for (int i = 0; i < MotionTable.Count; i++)
                {
                    var node = new ScriptNode(MotionTable[i], $"{i:X} - [{MotionTable[i]:X8}]");
                    foreach (var keypair in ScriptFiles)
                    {
                        if (keypair.Value.Scripts.Keys.Contains(MotionTable[i]))
                        {
                            node.Scripts.Add(Path.GetFileNameWithoutExtension(keypair.Key), keypair.Value.Scripts[MotionTable[i]]);
                        }
                    }
                    acmdnode.Nodes.Add(node);
                }
                FileTree.Nodes.Add(acmdnode);
                IDEMode    = IDE_MODE.Fighter;
                this.Text += fsDlg.SelectedPath;
            }
        }
示例#30
0
        public AddNewFolderSourceDialog()
        {
            _input = new JsonFileInput();

            InitializeComponent();

            // sigh, too bad reactiveui doesn't support .net 4
            Action doValidation = () =>
            {
                var path  = PathTextBox.Text;
                var count = NumRowsToSampleTextBox.Text;

                int nr;
                var pathOk  = Directory.Exists(path) || String.IsNullOrEmpty(path);
                var countOk = Int32.TryParse(count, out nr) && nr > 0;

                OkButton.IsEnabled = (pathOk && countOk && !String.IsNullOrEmpty(path));

                PathTextBox.Background            = pathOk ? _goodBrush : _badBrush;
                NumRowsToSampleTextBox.Background = countOk ? _goodBrush : _badBrush;
            };

            PathTextBox.TextChanged            += (sender, args) => doValidation();
            NumRowsToSampleTextBox.TextChanged += (sender, args) => doValidation();

            BrowseButton.Click += (sender, args) =>
            {
                var fileDialog = new FolderSelectDialog();
                var result     = fileDialog.ShowDialog();

                if (result)
                {
                    PathTextBox.Text = fileDialog.FileName;
                }
            };

            CancelButton.Click += (sender, args) => DialogResult = false;
            OkButton.Click     += (sender, args) =>
            {
                _input.InputPath       = PathTextBox.Text;
                _input.Recursive       = (bool)RecurseCheckbox.IsChecked;
                _input.Mask            = String.IsNullOrWhiteSpace(FileMaskTextBox.Text) ? "*.*" : FileMaskTextBox.Text;
                _input.NumRowsToSample = Math.Max(0, Int32.Parse(NumRowsToSampleTextBox.Text));

                Input        = _input;
                DialogResult = true;
            };

            doValidation();

            PathTextBox.Focus();
        }
示例#31
0
 private void MediaPath_Click(object sender, EventArgs e)
 {
     FolderSelectDialog fsd = new FolderSelectDialog();
     if(fsd.ShowDialog())
     {
         if (Directory.Exists(fsd.FileName))
         {
             textBox_rootMedia.Text = fsd.FileName;
         }
         else
             MessageBox.Show("Errore nel recupero della cartella");
     }
 }
示例#32
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            var folderDialog = new FolderSelectDialog();

            if (folderDialog.ShowDialog())
            {
                List <TranslationMemoryInfo> tms = _tmHelper.LoadTmsFromPath(folderDialog.FileName);
                foreach (var tm in tms)
                {
                    lstTms.Items.Add(tm);
                }
            }
        }
示例#33
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     using (FolderSelectDialog fsd = new FolderSelectDialog())
     {
         if (fsd.ShowDialog())
         {
             StickerPackInfo stickerPackInfo = new StickerPackInfo(fsd.FileName);
             Stickers.Add(stickerPackInfo);
             cbStickers.Items.Add(stickerPackInfo);
             cbStickers.SelectedIndex = cbStickers.Items.Count - 1;
         }
     }
 }
示例#34
0
        private void btnDirectoryClick(object sender, EventArgs e)
        {
            if (dialog == null)
            {
                dialog       = new FolderSelectDialog();
                dialog.Title = dirDescription;
            }

            if (dialog.ShowDialog(Form.ActiveForm.Handle))
            {
                FullName = dialog.FileName;
            }
        }
示例#35
0
		static void Main(string[] args)
		{
			Console.WriteLine(Environment.OSVersion.Platform.ToString());
			Console.WriteLine(Environment.OSVersion.Version.Major);

			{
				var fsd = new FolderSelectDialog();
				fsd.Title = "What to select";
				fsd.InitialDirectory = @"c:\";
				if (fsd.ShowDialog(IntPtr.Zero))
				{
					Console.WriteLine(fsd.FileName);
				}
			}
		}
示例#36
0
        public MainForm()
        {
            InitializeComponent();

            DoVersionCheck();

            // Load resources
            Icon = Properties.Resources.WoWConsolePort;

            groupStatus.Text = Resources.STRING_STATUS;
            labelConnectionStatus.Text = Resources.STRING_CONTROLLER_DISCONNECTED;
            checkWindowAttached.Text = Resources.STRING_WOW_WINDOW_FOUND;

            groupAdvancedHaptics.Text = Resources.STRING_HAPTIC_STATUS;
            checkHapticsAttached.Text = Resources.STRING_HAPTIC_ATTACHED;
            checkHapticsUserLoggedIn.Text = Resources.STRING_HAPTIC_CHARLOGGEDIN;
            labelPlayerInfo.Text = string.Empty;

            buttonConfig.Text = Resources.STRING_SHOW_CONFIG;
            buttonKeybinds.Text = Resources.STRING_SHOW_KEYBINDS;
            buttonSelectPlugin.Text = Resources.STRING_SHOW_PLUGINS;

            // Set up tray icon
            notifyIcon.Icon = Icon;
            notifyIcon.Text = Properties.Resources.STRING_NOTIFY_TOOLTIP;
            notifyIcon.Visible = true;
            notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
            notifyIcon.ContextMenuStrip = menuNotify;

            // Check for a valid wow directory
            if (!Functions.CheckWoWPath()) // check for valid install path
            {
                var findWoWNow = MessageBox.Show(Resources.STRING_MESSAGE_NO_WOW_PATH, "WoWmapper", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (findWoWNow == DialogResult.Yes)
                {
                    FolderSelectDialog fbd = new FolderSelectDialog();
                    var res = fbd.ShowDialog();
                    if (res && Directory.Exists(fbd.FileName))
                    {
                        Properties.Settings.Default.WoWInstallPath = fbd.FileName;
                        Properties.Settings.Default.Save();
                    }
                }
            }
        }
示例#37
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            var project = context.Instance as PipelineProjectProxy;
            
            var initialDir = (string)value;
            if (initialDir == null || !Directory.Exists(initialDir))
                initialDir = project.Location;

            var dlg = new FolderSelectDialog()
                {                    
                    InitialDirectory = initialDir,
                    Title = "Select Folder",
                };

            if (dlg.ShowDialog(MainView.Form.Handle))
                return dlg.FileName;

            return value;            
        }
示例#38
0
 private void btnSelectFolder_Click(object sender, EventArgs e)
 {
     FolderSelectDialog dlg = new FolderSelectDialog();
     dlg.Title = Messages.MSG_KSP_INSTALL_FOLDER_SELECTION;
     if (dlg.ShowDialog(this.Handle))
     {
         if (KSPPathHelper.IsKSPInstallFolder(dlg.FileName))
         {
             btnFinish.Enabled = true;
             tbKSPPath.Text = dlg.FileName;
         }
         else
         {
             MessageBox.Show(this, Messages.MSG_PLS_SELECT_VALID_KSP_INSTALL_FOLDER, Messages.MSG_TITLE_ATTENTION);
         }
     }
     else
     {
         btnFinish.Enabled = false;
     }
 }
示例#39
0
 public static void IndexFolder(TaskSettings taskSettings = null)
 {
     using (FolderSelectDialog dlg = new FolderSelectDialog())
     {
         if (dlg.ShowDialog())
         {
             IndexFolder(dlg.FileName, taskSettings);
         }
     }
 }
示例#40
0
        private void btnBrowseProjectsXML_Click(object sender, EventArgs e)
        {
            FolderSelectDialog selectFolder = new FolderSelectDialog();
            selectFolder.InitialDirectory = txtProjectsXML.Text;
            if (selectFolder.ShowDialog())
            {
                txtProjectsXML.Text = selectFolder.FileName;

                List<KeyValuePair<String, String>> projects = Projects.Projects.GetAllProjects(txtProjectsXML.Text).OrderBy(project => project.Value).ToList();
                projectsList.DisplayMember = "Value";
                projectsList.ValueMember = "Key";
                projectsList.DataSource = projects;
            }
        }
        /// <summary>
        /// Opens the SelectFolderDialog to select a folder to backup
        /// and Starts the backup process async.
        /// </summary>
        public static void NewBackup()
        {
            if (!ValidBackupDirectory(BackupPath))
                return;

            FolderSelectDialog dlg = new FolderSelectDialog();
            dlg.Title = "Source folder selection";
            dlg.InitialDirectory = KSPPathHelper.GetPath(KSPPaths.KSPRoot);
            if (dlg.ShowDialog(View.ParentForm.Handle))
                BackupDirectoryAsync(dlg.FileName);
        }
        /// <summary>
        /// Opens the FolderSelectDialog to select a new backup path.
        /// </summary>
        public static void SelectNewBackupPath()
        {
            var dlg = new FolderSelectDialog();
            dlg.Title = "Please select a new Backup path.";
            dlg.InitialDirectory = string.Empty;

            if (dlg.ShowDialog(View.ParentForm.Handle))
                View.BackupPath = dlg.FileName;
        }
        /// <summary>
        /// Asks the user for a KSP Install path with a folder browser dialog .
        /// </summary>
        /// <returns>The selected KSP path or String.Empty.</returns>
        public static string AskForKSPInstallFolder()
        {
            string kspPath = string.Empty;


            FolderSelectDialog dlg = new FolderSelectDialog();
            dlg.Title = Messages.MSG_KSP_INSTALL_FOLDER_SELECTION_TITLE;
            dlg.InitialDirectory = "c:/";
            if (dlg.ShowDialog(View.ParentForm.Handle))
            {
                if (KSPPathHelper.IsKSPInstallFolder(dlg.FileName))
                    kspPath = dlg.FileName;
                else
                    MessageBox.Show(Messages.MSG_NOT_KSP_FOLDER);
            }

            return kspPath;
        }
示例#44
0
 private void HandlesbtnEac3toOutputDirectoryClick()
 {
     var fsd = new FolderSelectDialog();
     fsd.Title = "eac3to.exe output directory";
     if (fsd.ShowDialog(IntPtr.Zero))
     {
        txtEac3toOutputDirectory.Text = fsd.FileName;
         this.HandlescbEac3ToOutputDirectoryTypeSelectedIndexChanged();
     }
 }
示例#45
0
        private void buttonSelectPath_Click(object sender, EventArgs e)
        {
            FolderSelectDialog fsd = new FolderSelectDialog();

            if (fsd.ShowDialog() != true) return;

            listModFiles.Items.Clear();

            string modPath = fsd.FileName;
            textModPath.Text = modPath;
            PopulateBoxes(modPath);
            Properties.Settings.Default.LastModDir = modPath;
            Properties.Settings.Default.Save();
        }
示例#46
0
 private void buttonLocateWoW_Click(object sender, EventArgs e)
 {
     FolderSelectDialog fbd = new FolderSelectDialog();
     var res = fbd.ShowDialog();
     if (res != true) return;
     Properties.Settings.Default.WoWInstallPath = fbd.FileName;
     Properties.Settings.Default.Save();
     textWoWPath.Text = fbd.FileName;
 }
示例#47
0
        private void openPathToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var fsd = new FolderSelectDialog();
            fsd.Title = "Select a folder to browse.";
            fsd.InitialDirectory = Properties.Settings.Default.LastDirectory;
            if (fsd.ShowDialog(IntPtr.Zero))
            {
                Console.WriteLine(fsd.FileName);
                currPath = fsd.FileName;
                Properties.Settings.Default.LastDirectory = currPath;
                Properties.Settings.Default.Save();

                PopulateFiles();
            }
        }
示例#48
0
        public static bool Export()
        {
            try
            {
                string exportFolder;

                using (FolderSelectDialog dlg = new FolderSelectDialog())
                {
                    if (dlg.ShowDialog())
                    {
                        exportFolder = dlg.FileName;
                    }
                    else
                    {
                        return false;
                    }
                }

                Set7ZipLibraryPath();

                SevenZipCompressor zip = new SevenZipCompressor();
                zip.ArchiveFormat = OutArchiveFormat.SevenZip;
                zip.CompressionLevel = CompressionLevel.Ultra;
                zip.CompressionMethod = CompressionMethod.Lzma2;

                Dictionary<string, string> files = new Dictionary<string, string>();
                if (Program.Settings.ExportSettings)
                {
                    AddFileToDictionary(files, Program.ApplicationConfigFilePath);
                    AddFileToDictionary(files, Program.HotkeysConfigFilePath);
                    AddFileToDictionary(files, Program.UploadersConfigFilePath);
                    AddFileToDictionary(files, Program.GreenshotImageEditorConfigFilePath);
                }

                if (Program.Settings.ExportHistory)
                {
                    AddFileToDictionary(files, Program.HistoryFilePath);
                }

                if (Program.Settings.ExportLogs)
                {
                    foreach (string file in Directory.GetFiles(Program.LogsFolder, "*.txt", SearchOption.TopDirectoryOnly))
                    {
                        AddFileToDictionary(files, file, Path.GetFileName(Program.LogsFolder));
                    }
                }

                string exportPath = Path.Combine(exportFolder, "ShareX_backup.sxb");

                zip.CompressFileDictionary(files, exportPath);

                return true;
            }
            catch (Exception e)
            {
                DebugHelper.WriteException(e);
                MessageBox.Show("Error while exporting backup:\r\n\r\n" + e, "ShareX - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return false;
        }
示例#49
0
        public static void UploadFolder(TaskSettings taskSettings = null)
        {
            using (FolderSelectDialog folderDialog = new FolderSelectDialog())
            {
                folderDialog.Title = "ShareX - " + Resources.UploadManager_UploadFolder_Folder_upload;

                if (!string.IsNullOrEmpty(Program.Settings.FileUploadDefaultDirectory) && Directory.Exists(Program.Settings.FileUploadDefaultDirectory))
                {
                    folderDialog.InitialDirectory = Program.Settings.FileUploadDefaultDirectory;
                }
                else
                {
                    folderDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                }

                if (folderDialog.ShowDialog() && !string.IsNullOrEmpty(folderDialog.FileName))
                {
                    Program.Settings.FileUploadDefaultDirectory = folderDialog.FileName;
                    UploadFile(folderDialog.FileName);
                }
            }
        }
示例#50
0
 private void ScanbtnClick(object sender, EventArgs e)
 {
     var fsd = new FolderSelectDialog();
     if (!fsd.ShowDialog())
         return;
     scanbtn.Enabled = false;
     AllowDrop = false;
     checkbtn.Enabled = false;
     keybox.Enabled = false;
     status.Text = "Scanning...";
     bw.RunWorkerAsync(fsd.FileName);
     while (bw.IsBusy) {
         Application.DoEvents();
         Thread.Sleep(100);
     }
     scanbtn.Enabled = true;
     AllowDrop = true;
     checkbtn.Enabled = true;
     keybox.Enabled = true;
     keybox.Text = "";
 }
示例#51
0
        private void buttonSelectPath_Click(object sender, EventArgs e)
        {
            FolderSelectDialog fsd = new FolderSelectDialog();

            if (fsd.ShowDialog() != true) return;

            listModFiles.Items.Clear();

            string modPath = fsd.FileName;
            textModPath.Text = modPath;
            foreach (string modFile in Directory.GetFiles(modPath, "*.*", SearchOption.AllDirectories))
            {
                string filePath = modFile.Substring(modPath.Length).Replace("\\", "/");
                if(Hashing.ValidFileExtension(filePath) && filePath != "/metadata.xml") listModFiles.Items.Add(filePath);
            }

            Properties.Settings.Default.LastModDir = modPath;
            Properties.Settings.Default.Save();
        }
示例#52
0
 public string FindCarmaFolder()
 {
     FolderSelectDialog dialog = new FolderSelectDialog();
     dialog.Title = "Select Carmageddon Folder";
     if (dialog.ShowDialog())
     {
         var folder = dialog.FileName;
         if (folder != "" && Directory.Exists(Path.Combine(folder, "ZAD_VT")))
             return folder;
         else
         {
             MessageBox.Show("This is not a valid Carmageddon: Reincarnation folder. Please choose a different one.", "Invalid Folder", MessageBoxButtons.OK);
             return FindCarmaFolder();
         }
     }
     else return "";
 }
示例#53
0
        private void btnDownloadPath_Click(object sender, EventArgs e)
        {
            FolderSelectDialog dlg = new FolderSelectDialog();
            dlg.Title = Messages.MSG_DOWNLOAD_FOLDER_SELECTION_TITLE;
            dlg.InitialDirectory = DownloadPath;
            if (dlg.ShowDialog(this.Handle))
            {
                DownloadPath = dlg.FileName;
                Messenger.AddInfo(string.Format(Messages.MSG_DOWNLOAD_PATH_CHANGED_0, dlg.FileName));
            }

            ////FolderBrowserDialog dlg = new FolderBrowserDialog();
            ////dlg.SelectedPath = DownloadPath;
            ////if (dlg.ShowDialog(this) == DialogResult.OK)
            ////{
            ////    DownloadPath = dlg.SelectedPath;
            ////    Messenger.AddInfo(string.Format(Messages.MSG_DOWNLOAD_PATH_CHANGED_0, dlg.SelectedPath));
            ////}
        }
        /// <summary>
        /// Opens the FolderBrowserDialog and lets the user chose a new download folder.
        /// </summary>
        /// <returns>The new selected download folder or string.Empty.</returns>
        public static string SelectNewDownloadPath()
        {
            if (string.IsNullOrEmpty(SelectedKSPPath))
            {
                MessageBox.Show(View.ParentForm, string.Format(Messages.MSG_SELECT_0_FOLDER_FIRST, KSPINSTALL));
                return string.Empty;
            }

            string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
            string pathDownload = Path.Combine(pathUser, DOWNLOADS);
            if (!string.IsNullOrEmpty(DownloadPath))
                pathDownload = DownloadPath;

            FolderSelectDialog dlg = new FolderSelectDialog();
            dlg.Title = Messages.MSG_DOWNLOAD_SELECTION_TITLE;
            dlg.InitialDirectory = pathDownload;
            if (dlg.ShowDialog(View.ParentForm.Handle))
                DownloadPath = dlg.FileName;

            return DownloadPath;
        }
示例#55
0
 private void HandleBtnOpenX264LogFileOutputDialog()
 {
     var fsd = new FolderSelectDialog();
     fsd.Title = "x264 (.log) files save directory";
     if (fsd.ShowDialog(IntPtr.Zero))
     {
         txtX264LogFileSaveDirectory.Text = fsd.FileName;
     }
 }
示例#56
0
 public static void IndexFolder(TaskSettings taskSettings = null)
 {
     using (FolderSelectDialog dlg = new FolderSelectDialog())
     {
         if (dlg.ShowDialog())
         {
             if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
             UploadText(dlg.FileName, taskSettings);
         }
     }
 }
        private void btnPath_Click(object sender, RoutedEventArgs e)
        {
            var folderSelect = new FolderSelectDialog();
            folderSelect.Title = "Choose a download directory for your wallpapers";

            if (folderSelect.ShowDialog())
            {
                txtPath.Text = folderSelect.FileName;
                FolderPath = folderSelect.FileName;
            }
        }
        private void CustomUploaderExportAll()
        {
            if (Config.CustomUploadersList != null)
            {
                for (int i = 0; i < lbCustomUploaderList.Items.Count; i++)
                {
                    lbCustomUploaderList.SelectedIndex = i;
                    UpdateCustomUploader();
                }

                using (FolderSelectDialog fsd = new FolderSelectDialog())
                {
                    if (fsd.ShowDialog())
                    {
                        foreach (CustomUploaderItem item in Config.CustomUploadersList)
                        {
                            string json = eiCustomUploaders.Serialize(item);
                            string filepath = Path.Combine(fsd.FileName, item.Name + ".json");
                            File.WriteAllText(filepath, json, Encoding.UTF8);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Imports ASP created BAK files (Mysql Out FILE)
        /// </summary>
        private void ImportASPBtn_Click(object sender, EventArgs e)
        {
            // Open File Select Dialog
            FolderSelectDialog Dialog = new FolderSelectDialog();
            Dialog.Title = "Select ASP Database Backup Folder";
            Dialog.InitialDirectory = Path.Combine(Paths.DocumentsFolder, "Backups");
            if (Dialog.ShowDialog())
            {
                // Get files list from path
                string path = Dialog.SelectedPath;
                string[] BakFiles = Directory.GetFiles(path, "*.bak");
                if (BakFiles.Length > 0)
                {
                    // Open the database connection
                    StatsDatabase Database;
                    try
                    {
                        Database = new StatsDatabase();
                    }
                    catch (Exception Ex)
                    {
                        MessageBox.Show(
                            "Unable to connect to database\r\n\r\nMessage: " + Ex.Message,
                            "Database Connection Error",
                            MessageBoxButtons.OK, MessageBoxIcon.Error
                        );

                        // Stop the ASP server, and close this form
                        ASP.ASPServer.Stop();
                        this.Close();
                        return;
                    }

                    // Show task dialog
                    TaskForm.Show(this, "Importing Stats", "Importing ASP Stats Bak Files...", false);
                    TaskForm.UpdateStatus("Removing old stats data");

                    // Clear old database records
                    Database.Truncate();
                    Thread.Sleep(500);

                    // Begin transaction
                    DbTransaction Transaction = Database.BeginTransaction();

                    // import each table
                    foreach (string file in BakFiles)
                    {
                        // Get table name
                        string table = Path.GetFileNameWithoutExtension(file);

                        // Update progress
                        TaskForm.UpdateStatus("Processing stats table: " + table);

                        // Import table data
                        try
                        {
                            // Sqlite kinda sucks... no import methods
                            if (Database.DatabaseEngine == DatabaseEngine.Sqlite)
                            {
                                string[] Lines = File.ReadAllLines(file);
                                foreach (string line in Lines)
                                {
                                    string[] Values = line.Split('\t');
                                    Database.Execute(
                                        String.Format("INSERT INTO {0} VALUES({1})", table, "\"" + String.Join("\", \"", Values) + "\"")
                                    );
                                }
                            }
                            else
                                Database.Execute(String.Format("LOAD DATA LOCAL INFILE '{0}' INTO TABLE {1};", file.Replace('\\', '/'), table));
                        }
                        catch (Exception Ex)
                        {
                            // Show exception error
                            ExceptionForm Form = new ExceptionForm(Ex, false);
                            Form.Message = String.Format("Failed to import data into table {0}!{2}{2}Error: {1}", table, Ex.Message, Environment.NewLine);
                            DialogResult Result = Form.ShowDialog();

                            // Rollback!
                            TaskForm.UpdateStatus("Rolling back stats data");
                            Transaction.Rollback();

                            // Update message
                            TaskForm.CloseForm();
                            return;
                        }
                    }

                    // Commit the transaction, and alert the user
                    Transaction.Commit();
                    TaskForm.CloseForm();
                    Notify.Show("Stats imported successfully!", "Operation Successful", AlertType.Success);

                    // Displose Connection
                    Database.Dispose();
                }
                else
                {
                    // Alert the user and tell them they failed
                    MessageBox.Show(
                        "Unable to locate any .bak files in this folder. Please select an ASP created database backup folder that contains backup files.",
                        "Backup Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error
                    );
                }
            }
        }
        private void PathTextBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var textBox = (TextBox) sender;
            if (textBox != null && string.IsNullOrWhiteSpace(textBox.SelectedText))
            {
                var folderDialog = new FolderSelectDialog();

                folderDialog.Title = "Select project folder";

                if (folderDialog.ShowDialog())
                {
                    textBox.Text = folderDialog.FileName;
                    LocalRadioButton.IsChecked = true;
                }
            }
        }