I want to give the user the possibility to execute some little code from my winforms application, written in c#. I'd like to use php, so I have found Phalanger.
I put two richTextEdit in my Form and I want to write php in richTextEdit1, press a button, and view the result in the richTextEdit2.
The php code is:
echo "Hello word!";
the button code is:
ScriptContext context = ScriptContext.CurrentContext;
MemoryStream ms;
StreamWriter sw;
ms = new MemoryStream();
sw = new StreamWriter(ms);
context.Output = sw ;
//context.Output = Console.Out;
var res = DynamicCode.Eval(
richTextBox1.Text,
false,/*phalanger internal stuff*/
context,
null,/*local variables*/
null,/*reference to "$this"*/
null,/*current class context*/
"Default.aspx.cs",/*file name, used for debug and cache key*/
1, 1,/*position in the file used for debug and cache key*/
-1,/*something internal*/
null/*current namespace, used in CLR mode*/
);
richTextBox2.Text = Encoding.UTF8.GetString(ms.ToArray());
If I use Console.Out as output, it works fine, but is not usefull. If not, I have no result.
Can anyone help me?