public static Panel packageCurrentScriptAsStandAloneExe(this ascx_Simple_Script_Editor simpleScriptEditor) { if ("FluentSharp.MsBuild".assembly().isNull()) { "[packageCurrentScriptAsStandAloneExe] could not invoke because FluentSharp.MsBuild assembly is not avaiable".error(); return(null); } var h2File = simpleScriptEditor.currentSourceCodeFilePath(); if (h2File.valid()) { simpleScriptEditor.saveScript(); } else { h2File = simpleScriptEditor.Code.h2_File(); } var assembly = "FluentSharp.MsBuild".assembly(); var type = assembly.type("Package_O2_Script_into_separate_Folder"); var topPanel = type.invokeStatic("Main", /*startHidden*/ false, /*targetScript*/ h2File); return(topPanel.cast <Panel>()); //var packageScript = (Action<string>)"Util - Package O2 Script into separate Folder.h2".executeFirstMethod(); //packageScript(h2File); }
public static ascx_Simple_Script_Editor waitFor_ExecutionComplete(this ascx_Simple_Script_Editor simpleScriptEditor, int maxWaitSeconds = 20) { var executionThread = simpleScriptEditor.ExecutionThread; if (executionThread.isNull()) // if the execution thread is not alive { for (int i = 0; i < maxWaitSeconds; i++) { 500.sleep(); // wait 500ms for a maximum of maxWaitSeconds times (default is 10sec) executionThread = simpleScriptEditor.ExecutionThread; // try again if (executionThread.notNull()) { break; } } } if (executionThread.notNull() && executionThread.IsAlive) { if (executionThread.Join(20 * 1000).isFalse()) { "[ascx_Simple_Script_Editor][waitFor_ExecutionComplete] the execution lasted more than {0} seconds".error(maxWaitSeconds); } } return(simpleScriptEditor); }
public static ascx_Simple_Script_Editor csharpCompiler(this ascx_Simple_Script_Editor simpleScriptEditor, CSharp_FastCompiler value) { if (simpleScriptEditor.notNull()) { simpleScriptEditor.CSharpCompiler = value; } return(simpleScriptEditor); }
public static ascx_Simple_Script_Editor set_Command(this ascx_Simple_Script_Editor scriptEditor, string commandText) { return((ascx_Simple_Script_Editor)scriptEditor.invokeOnThread( () => { scriptEditor.commandsToExecute.set_Text(commandText); return scriptEditor; })); }
public static ascx_Simple_Script_Editor set_Command(this ascx_Simple_Script_Editor scriptEditor, string commandText) { return((ascx_Simple_Script_Editor)scriptEditor.invokeOnThread( () => { scriptEditor.Code = commandText; return scriptEditor; })); }
public static T executionResult <T>(this ascx_Simple_Script_Editor simpleScriptEditor) { if (simpleScriptEditor.notNull() && simpleScriptEditor.LastExecutionResult.notNull()) { if (simpleScriptEditor.LastExecutionResult is T) { return((T)simpleScriptEditor.LastExecutionResult); } } return(default(T)); }
public static T invocationParameter <T>(this ascx_Simple_Script_Editor simpleScriptEditor) { foreach (var invocationParameter in simpleScriptEditor.invocationParameters()) { if (invocationParameter.Value is T) { return((T)invocationParameter.Value); } } return(default(T)); }
public static ascx_Simple_Script_Editor add_Script(this Control hostControl, bool codeCompleteSupport) { return((ascx_Simple_Script_Editor)hostControl.invokeOnThread( () => { var scriptControl = new ascx_Simple_Script_Editor(codeCompleteSupport); scriptControl.fill(); hostControl.add(scriptControl); return scriptControl; })); }
public static ascx_Simple_Script_Editor onCompileExecuteOnce(this ascx_Simple_Script_Editor scriptEditor) { return((ascx_Simple_Script_Editor)scriptEditor.invokeOnThread( () => { scriptEditor.onCompilationOk = () => { scriptEditor.execute(); scriptEditor.onCompilationOk = null; }; return scriptEditor; })); }
public static ascx_Simple_Script_Editor execute(this ascx_Simple_Script_Editor scriptEditor, params string[] codesToExecute) { var codeToExecute = ""; foreach (var code in codesToExecute) { codeToExecute += code.line(); } return((ascx_Simple_Script_Editor)scriptEditor.invokeOnThread( () => { scriptEditor.commandsToExecute.set_Text(codeToExecute); scriptEditor.onCompileExecuteOnce(); return scriptEditor; })); }
public static ascx_Simple_Script_Editor executeOnCompile(this ascx_Simple_Script_Editor simpleEditor) { simpleEditor.ExecuteOnCompile = true; return(simpleEditor); }
public void SetUp() { TestValue = "a test Value"; CodeEditor = TestValue.script_Me("testValue"); }
public static Dictionary <string, object> invocationParameters(this ascx_Simple_Script_Editor simpleScriptEditor) { return(simpleScriptEditor.notNull() ? simpleScriptEditor.InvocationParameters : null); }
//the one below seems to aggresive and not optiomal /*public static ascx_Simple_Script_Editor wait_For_OnExecute_Once(this ascx_Simple_Script_Editor simpleScriptEditor) * { * var previousOnExecute = simpleScriptEditor.onExecute; * var sync = false.autoResetEvent(); * simpleScriptEditor.onExecute = result => * { * sync.set(); * }; * sync.waitOne(); * simpleScriptEditor.onExecute = previousOnExecute; * return simpleScriptEditor; * }*/ public static object executionResult(this ascx_Simple_Script_Editor simpleScriptEditor) { return(simpleScriptEditor.executionResult <object>()); }
public static ascx_Simple_Script_Editor code_Insert(this ascx_Simple_Script_Editor scriptEditor, string textToInsert) { scriptEditor.Code = textToInsert.line() + scriptEditor.Code; return(scriptEditor); }
public static ascx_Simple_Script_Editor set_Code(this ascx_Simple_Script_Editor scriptEditor, string code) { return(scriptEditor.set_Command(code)); }
public static ascx_Simple_Script_Editor add_InvocationParameter(this ascx_Simple_Script_Editor scriptEditor, string parameterName, object parameterObject) { scriptEditor.InvocationParameters.add(parameterName, parameterObject); return(scriptEditor); }
public static ascx_Simple_Script_Editor code_Append(this ascx_Simple_Script_Editor scriptEditor, string textToInsert) { scriptEditor.Code = scriptEditor.Code.line() + textToInsert; return(scriptEditor); }
public static CSharp_FastCompiler csharpCompiler(this ascx_Simple_Script_Editor simpleScriptEditor) { return(simpleScriptEditor.notNull() ? simpleScriptEditor.CSharpCompiler : null); }
public static ascx_Simple_Script_Editor execute_WaitFor_ExecutionComplete(this ascx_Simple_Script_Editor simpleScriptEditor, int maxWaitSeconds = 20) { simpleScriptEditor.execute(); return(simpleScriptEditor.waitFor_ExecutionComplete(maxWaitSeconds)); }
public static ascx_Simple_Script_Editor makeInvocationParametersTypeGeneric(this ascx_Simple_Script_Editor simpleEditor) { simpleEditor.csharpCompiler.ResolveInvocationParametersType = false; return(simpleEditor); }
public static ascx_Simple_Script_Editor compile_WaitFor_CompilationComplete(this ascx_Simple_Script_Editor simpleScriptEditor) { simpleScriptEditor.compile(); simpleScriptEditor.csharpCompiler().waitForCompilationComplete(); return(simpleScriptEditor); }
public static ascx_Simple_Script_Editor append_Code(this ascx_Simple_Script_Editor scriptEditor, string textToInsert) { return(scriptEditor.code_Append(textToInsert)); }