private utilitylaunchparams GatherParameters() { utilitylaunchparams myParams = new utilitylaunchparams(); System.IO.FileInfo myInFileInfo = new System.IO.FileInfo(txtInPath.Text); System.IO.DirectoryInfo myInDirInfo = new System.IO.DirectoryInfo(txtInPath.Text); //Validate input path if (myInFileInfo.Exists || myInDirInfo.Exists) { myParams.inputpath = txtInPath.Text; } else { throw new Exception("Input path doesn't exist!"); } //Validate output path System.IO.DirectoryInfo parentOutDir = System.IO.Directory.GetParent(txtOutPath.Text); if (!parentOutDir.Exists) { throw new Exception("Output path parent directory doesn't exist!"); } else { myParams.outputPath = txtOutPath.Text; } //Get forced offset if necessary if (chkPokeSprite.Checked) { myParams.foffset = Decimal.ToUInt32(numForcedOffset.Value); } else { myParams.foffset = 0; } return(myParams); }
private void DoExecuteUtility() { SetStatusWorking(); EnableDisableEditableControls(false); try { utilitylaunchparams execparams = GatherParameters(); string args = "\"" + execparams.inputpath + "\" \"" + execparams.outputPath + "\""; if (execparams.foffset != 0) { args = "-a " + execparams.foffset + " " + args; } FrontendCommon.UtilityLauncher myUtility = new FrontendCommon.UtilityLauncher(this, PPMD_PFU_NAME); if (myUtility.StartUtil(args)) { myUtility.WaitUntilFinished(); } if (myUtility.GetReturnCode() == 0) { SetStatusSuccess(); } else { SetStatusFailure(); } } catch (Exception e) { MessageBox.Show(this, e.Message, "Exception!", MessageBoxButtons.OK, MessageBoxIcon.Error); SetStatusFailure(); } EnableDisableEditableControls(true); timerResetStatus.Start(); }