using System; using Eagle._Attributes; using Eagle._Components.Public; using Eagle._Containers.Public; using Eagle._Interfaces.Public; namespace ConsoleApplication1 { [ObjectId("5b519c7e-d08d-4377-ba48-ad098b100fd7")] class Program { static int Main(string[] args) { Result result = null; using (Interpreter interpreter = Interpreter.Create(ref result)) { ICommand command = new Hello(new CommandData( "hello", null, null, null, typeof(Hello).FullName, CommandFlags.None, null, 0)); ReturnCode code; long token = 0; code = interpreter.AddCommand( command, null, ref token, ref result); if (code == ReturnCode.Ok) { int errorLine = 0; code = interpreter.EvaluateScript(new StringList( "hello", Environment.UserName).ToString(), ref result, ref errorLine); interpreter.Host.WriteResult( code, result, errorLine, true); code = Interpreter.InteractiveLoop( interpreter, null, ref result); return (int)interpreter.ExitCode; } else { interpreter.Host.WriteResult(code, result, true); } } return (int)ExitCode.Failure; } } [ObjectId("261885bf-2ba0-48c0-8905-6301e7d6201a")] internal sealed class Hello : Eagle._Commands.Default { public Hello( ICommandData commandData ) : base(commandData) { this.Flags |= Utility.GetCommandFlags(GetType().BaseType) | Utility.GetCommandFlags(this); } public override ReturnCode Execute( Interpreter interpreter, IClientData clientData, ArgumentList arguments, ref Result result ) { if ((arguments == null) || (arguments.Count != 2)) { result = Utility.WrongNumberOfArguments( this, 1, arguments, "userName"); return ReturnCode.Error; } result = String.Format("Hello, {0}", arguments[1]); return ReturnCode.Ok; } } }