Esempio n. 1
0
        internal static DialogResult ScriptEditor(string inputScript, string inputRunner, List <Tuple <string, string> > variables, out string outputScript, out string outputRunner)
        {
            var editScript = new ScriptForm();

            editScript.Script        = inputScript;
            editScript.Runner        = inputRunner;
            editScript.Variables     = variables;
            editScript.StartPosition = FormStartPosition.CenterParent;
            var result = editScript.ShowDialog(Application.OpenForms[0]);

            outputScript = editScript.Script;
            if (outputScript != null)
            {
                // Remove \r not supported in shell scripts
                outputScript = outputScript.Replace("\r\n", "\n");
            }

            outputRunner = editScript.Runner;

            if (inputScript == outputScript && inputRunner == outputRunner)
            {
                result = DialogResult.Cancel;
            }

            return(result);
        }
Esempio n. 2
0
        internal static DialogResult ScriptEditor(ScriptInfo script1, ScriptInfo script2, List <Tuple <string, string> > variables)
        {
            string originalScript1 = script1 == null ? null : script1.Code;
            string originalScript2 = script2 == null ? null : script2.Code;

            var editScript = new ScriptForm(script1, script2, variables);

            editScript.StartPosition = FormStartPosition.CenterParent;
            var result = editScript.ShowDialog(Application.OpenForms[0]);

            if ((script1 == null || (script1.Code == originalScript1)) && (script2 == null || (script2.Code == originalScript2)))
            {
                result = DialogResult.Cancel;
            }

            return(result);
        }