コード例 #1
0
        private void TopMenu_File_SaveAllImage_Click(object sender, EventArgs e)
        {
            if (!ImageTags.Any())
            {
                System.Media.SystemSounds.Exclamation.Play();
                return;
            }

            if (SaveFolderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    foreach (var parser in Parsers)
                    {
                        string dirname = Path.GetFileNameWithoutExtension(parser.Key);

                        foreach (var tag in parser.Value.FindTags <ImageTag>())
                        {
                            using (var img = tag.ExtractImage())
                            {
                                img.Save(SaveFolderDialog.SelectedPath.TrimEnd('\\') + "\\" + dirname + "_" + tag.CharacterID + ".png", ImageFormat.Png);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(SaveFolderDialog.SelectedPath + "\r\nへの保存に失敗しました。\r\n" + ex.GetType().Name + "\r\n" + ex.Message);
                }
            }
        }
コード例 #2
0
ファイル: Launcher.cs プロジェクト: aalmada/bonsai
        static string LaunchPackageBootstrapper(
            PackageConfiguration packageConfiguration,
            string editorRepositoryPath,
            string editorPath,
            string targetPath,
            string packageId,
            Func <IPackageManager, Task> installPackage)
        {
            EnableVisualStyles();
            var installPath       = string.Empty;
            var executablePackage = default(IPackage);
            var packageManager    = CreatePackageManager(editorRepositoryPath);

            using (var monitor = new PackageConfigurationUpdater(packageConfiguration, packageManager, editorPath))
            {
                packageManager.PackageInstalling += (sender, e) =>
                {
                    var package = e.Package;
                    if (package.Id == packageId && e.Cancel)
                    {
                        executablePackage = package;
                    }
                };

                PackageHelper.RunPackageOperation(packageManager, () => installPackage(packageManager));
            }

            if (executablePackage != null)
            {
                if (string.IsNullOrEmpty(targetPath))
                {
                    var entryPoint = executablePackage.Id + NuGet.Constants.BonsaiExtension;
                    var message    = string.Format(Resources.InstallExecutablePackageWarning, executablePackage.Id);
                    var result     = MessageBox.Show(message, Resources.InstallExecutablePackageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (result == DialogResult.Yes)
                    {
                        using (var dialog = new SaveFolderDialog())
                        {
                            dialog.FileName = executablePackage.Id;
                            if (dialog.ShowDialog() == DialogResult.OK)
                            {
                                targetPath = dialog.FileName;
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(targetPath))
                {
                    var targetFileSystem = new PhysicalFileSystem(targetPath);
                    installPath = PackageHelper.InstallExecutablePackage(executablePackage, targetFileSystem);
                }
            }
            return(installPath);
        }
コード例 #3
0
        private void SaveFolderButton_Click(object sender, EventArgs e)
        {
            DialogResult result = SaveFolderDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                SaveFolderBox.Text            = SaveFolderDialog.SelectedPath;
                iniData["Config"]["SavePath"] = SaveFolderDialog.SelectedPath;
                iniParser.WriteFile(iniPath, iniData);
                Invalidate();
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: zac182/myFOCA
 private void cleanButtonClick(object sender, EventArgs e)
 {
     try
     {
         bool srcAsDest    = srcAsDestCheckBox.Checked;
         bool existDir     = false;
         bool executeClean = false;
         if (!srcAsDest)
         {
             DialogResult result = SaveFolderDialog.ShowDialog();
             if (result == DialogResult.OK)
             {
                 existDir = Directory.Exists(SaveFolderDialog.SelectedPath + "\\src");
             }
         }
         if (srcAsDest || existDir)
         {
             DialogResult result2 = MessageBox.Show("This process will overwrite the checked files in the path selected.\r\nDo you want to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (result2 == DialogResult.Yes)
             {
                 executeClean = true;
             }
         }
         if (executeClean || !(srcAsDest || existDir || executeClean))
         {
             Cursor.Current = Cursors.WaitCursor;
             if (MainDGV.Rows.Count != 0)
             {
                 bool   chkboxtrue = false;
                 string field      = FieldTextBox.Text.Trim();
                 string component  = ObjectTextBox.Text.Trim();
                 foreach (DataGridViewRow row in MainDGV.Rows)
                 {
                     DataGridViewCheckBoxCell chkboxCell = row.Cells[0] as DataGridViewCheckBoxCell;
                     if (Convert.ToBoolean(chkboxCell.Value))
                     {
                         chkboxtrue = true;
                         int         i         = 0;
                         bool        bkr       = false;
                         XmlDocument doc       = new XmlDocument();
                         XmlWriter   writer    = null;
                         string      pathCell  = row.Cells[5].Value.ToString();
                         string      matchLine = row.Cells[4].Value.ToString();
                         doc.Load(pathCell);
                         if (pathCell.Contains("\\reportTypes\\"))
                         {
                             cleanButtonProcess(sender, e, i, matchLine, bkr, doc, writer, row, pathCell, "ReportType", "reportTypes", srcAsDest, existDir);
                         }
                         else if (pathCell.Contains("\\permissionsets\\"))
                         {
                             cleanButtonProcess(sender, e, i, matchLine, bkr, doc, writer, row, pathCell, "PermissionSet", "permissionsets", srcAsDest, existDir);
                         }
                         else if (pathCell.Contains("\\reports\\"))
                         {
                             cleanButtonProcess(sender, e, i, matchLine, bkr, doc, writer, row, pathCell, "Report", "report", srcAsDest, existDir);
                         }
                         else if (pathCell.Contains("\\profiles\\"))
                         {
                             cleanButtonProcess(sender, e, i, matchLine, bkr, doc, writer, row, pathCell, "Profile", "profiles", srcAsDest, existDir);
                         }
                         else if (pathCell.Contains("\\objectTranslations\\"))
                         {
                             cleanButtonProcess(sender, e, i, matchLine, bkr, doc, writer, row, pathCell, "CustomObjectTranslation", "objectTranslations", srcAsDest, existDir);
                         }
                     }
                 }
                 Cursor.Current = Cursors.Default;
                 if (chkboxtrue)
                 {
                     MessageBox.Show("Task Completed!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     previewOn = false;
                 }
                 else
                 {
                     MessageBox.Show("There was no row checked", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("There was an error in the execution, please restart the app and try again.\nIf the issue persist please reach the dev.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
     }
 }