Skip to content

Instantly share code, notes, and snippets.

@joecastelo
Created May 14, 2020 15:19
Show Gist options
  • Save joecastelo/f685c91402d4c2dffc034c1f8d5ac039 to your computer and use it in GitHub Desktop.
Save joecastelo/f685c91402d4c2dffc034c1f8d5ac039 to your computer and use it in GitHub Desktop.
Entry to ESAPI
using ExecutableLogic;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VMS.TPS.Common.Model.API;
namespace VMS.TPS
{
public class Script
{
public Script()
{
}
public static void Execute(ScriptContext context)
{
Perform(context);
}
public static void Perform(ScriptContext context)
{
string binFile = "\\";
var dialog = new OpenFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
binFile = dialog.FileName;
}
else
{
throw new System.Exception("Choose a file to run the executable");
}
var args = ScriptContextArgs.From(context);
var runner = new RunStandalone(args.ToArgs());
runner.RunProgram(binFile);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment