Пример #1
0
        private void batchActionRenameType_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderDialog = new FolderBrowserDialog();

            folderDialog.ShowNewFolderButton = false;
            folderDialog.SelectedPath        = Path.GetFullPath(DualityApp.DataDirectory);
            folderDialog.Description         = "Select a folder to process..";
            if (folderDialog.ShowDialog(this) == DialogResult.OK)
            {
                RenameTypeDialog dialog = new RenameTypeDialog(this.GetAvailTypes());
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    int replaced = 0;
                    ProcessingBigTaskDialog taskDialog = new ProcessingBigTaskDialog(
                        Properties.ResourceHackerRes.TaskBatchRenameType_Caption,
                        string.Format(Properties.ResourceHackerRes.TaskBatchRenameType_Desc, dialog.SearchFor, dialog.ReplaceWith),
                        this.async_PerformBatchAction,
                        new BatchActionTaskData(folderDialog.SelectedPath, n => replaced += n.ReplaceTypeStrings(dialog.SearchFor, dialog.ReplaceWith)));
                    taskDialog.MainThreadRequired = false;
                    taskDialog.ShowDialog();

                    MessageBox.Show(
                        string.Format(Properties.ResourceHackerRes.MessageBox_RenameType_Text, replaced, dialog.SearchFor, dialog.ReplaceWith),
                        Properties.ResourceHackerRes.MessageBox_RenameType_Title,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
            }
        }
Пример #2
0
        private void actionRenameType_Click(object sender, EventArgs e)
        {
            RenameTypeDialog dialog = new RenameTypeDialog(this.GetAvailTypes());

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                int replaced = 0;
                this.CurrentPerformAction(n => replaced += n.ReplaceTypeStrings(dialog.SearchFor, dialog.ReplaceWith));
                MessageBox.Show(
                    string.Format(Properties.ResourceHackerRes.MessageBox_RenameType_Text, replaced, dialog.SearchFor, dialog.ReplaceWith),
                    Properties.ResourceHackerRes.MessageBox_RenameType_Title,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }
        }
Пример #3
0
        private void batchActionRenameType_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderDialog = new FolderBrowserDialog();
            folderDialog.ShowNewFolderButton = false;
            folderDialog.SelectedPath = Path.GetFullPath(DualityApp.DataDirectory);
            folderDialog.Description = "Select a folder to process..";
            if (folderDialog.ShowDialog(this) == DialogResult.OK)
            {
                RenameTypeDialog dialog = new RenameTypeDialog(this.GetAvailTypes());
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    int replaced = 0;
                    ProcessingBigTaskDialog taskDialog = new ProcessingBigTaskDialog(
                        Properties.ResourceHackerRes.TaskBatchRenameType_Caption,
                        string.Format(Properties.ResourceHackerRes.TaskBatchRenameType_Desc, dialog.SearchFor, dialog.ReplaceWith),
                        this.async_PerformBatchAction,
                        new BatchActionTaskData(folderDialog.SelectedPath, n => replaced += n.ReplaceTypeStrings(dialog.SearchFor, dialog.ReplaceWith)));
                    taskDialog.MainThreadRequired = false;
                    taskDialog.ShowDialog();

                    MessageBox.Show(
                        string.Format(Properties.ResourceHackerRes.MessageBox_RenameType_Text, replaced, dialog.SearchFor, dialog.ReplaceWith),
                        Properties.ResourceHackerRes.MessageBox_RenameType_Title,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
            }
        }
Пример #4
0
 private void actionRenameType_Click(object sender, EventArgs e)
 {
     RenameTypeDialog dialog = new RenameTypeDialog(this.GetAvailTypes());
     if (dialog.ShowDialog(this) == DialogResult.OK)
     {
         int replaced = 0;
         this.CurrentPerformAction(n => replaced += n.ReplaceTypeStrings(dialog.SearchFor, dialog.ReplaceWith));
         MessageBox.Show(
             string.Format(Properties.ResourceHackerRes.MessageBox_RenameType_Text, replaced, dialog.SearchFor, dialog.ReplaceWith),
             Properties.ResourceHackerRes.MessageBox_RenameType_Title,
             MessageBoxButtons.OK,
             MessageBoxIcon.Information);
     }
 }