sdk\c-sharp\eval\eval\Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Threading;
using RobotNET.SDK;
namespace RoboEval
{
class Program
{
static void Main( string[] args )
{
Console.WriteLine( string.Format( "Program started!" ) );
if( args.Count() > 1 )
{
string addr = args[0];
string pass = args[1];
try
{
MemoryStream ms = new MemoryStream();
using( Eval eval = new Eval( addr, pass, uint.MaxValue ) )
{
eval.Set( "push", Encoding.Unicode.GetBytes( "Hello, world!" ) );
Dictionary<string, int> slots = eval.EvalIt( "/mod:echo" );
while( slots == null )
{
Console.Write( "." );
Thread.Sleep( 1000 );
slots = eval.EvalIt();
}
if( slots != null )
{
string echo = Encoding.Unicode.GetString( eval.Get( "pop" ) );
Console.WriteLine( string.Format( "{0}", echo ) );
}
else
Console.WriteLine( string.Format( "Eval fail!" ) );
}
}
catch( Exception e )
{
Console.WriteLine( e.ToString() );
}
}
Console.WriteLine( string.Format( "Program finished!" ) );
}
}
}