コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BotEngineExample"/> class.
        ///
        /// You will have to have a valid app.Config settings file, please read documentation on codeplex.
        /// </summary>
        public BotEngineExample()
        {
            //ServicesManager.StartService(_commandInterpeter.TechnicalName);
            ConsoleHelpers.ParseCommandLine = ProcessCommandLine;
            Console.Title           = string.Format("Managed Bot Engine Server {0}\r\n", base.Version());
            Console.BackgroundColor = ConsoleColor.DarkBlue;
            Console.Clear();

            ServicesManager.OnServiceStarted += ServicesManager_OnServiceStarted;
            LocalBotPluginServicesManager.OnServiceStarted += LocalBotPluginServicesManager_OnServiceStarted;
            BotEventSlaveStarted += HandleBotEventSlaveStarted;
            BotEventLoggedIn     += HandleBotEventLoggedIn;
            BotEventEntersWorld  += HandleBotEventEntersWorld;

            ConsoleHelpers.WriteLine(ConsoleColor.Yellow, string.Format("Managed Bot Engine Server {0}\r\nCopyright (C)2009-2010 TCPX\r\n", base.Version()));
            ConsoleHelpers.WriteLine(ConsoleColor.White, "Starting services");
            ConsoleHelpers.ReadLine();
            _sw1.Start();
            // ensure creation of remote client test account for the AwManaged.RemotingTests console application.
            Start();

            _commandInterpeter = new GenericInterpreterService <CCEnumTypeAttribute, CCEnumBindingAttribute, CCItemBindingAttribute>
                                     (Assembly.GetAssembly(GetType()))
            {
                TechnicalName = "Server Console interpeter"
            };
            ServicesManager.AddService(_commandInterpeter);
            ServicesManager.StartService(_commandInterpeter.TechnicalName);
        }
コード例 #2
0
        public void TestInterpretation()
        {
            var svc = new GenericInterpreterService <CCEnumTypeAttribute, CCEnumBindingAttribute, CCItemBindingAttribute>(Assembly.GetAssembly(typeof(CCEnumBindingAttribute)));

            svc.Start();

            var ret = svc.Interpret("backup world mybackup");

            foreach (var item in ret)
            {
                foreach (var cmd in item.Commands)
                {
                    if (ReflectionHelpers.HasInterface(cmd, typeof(ICommandExecute)))
                    {
                        if (ReflectionHelpers.HasInterface(cmd, typeof(INeedBotEngineInstance <BotEngine>)))
                        {
                            ((INeedBotEngineInstance <BotEngine>)cmd).BotEngine = null;
                        }
                        ICommandExecutionResult result = ((ICommandExecute)cmd).ExecuteCommand();
                    }
                }
            }
            // var ret = svc.Interpret("activate envi res=512 type=1 upd=25 time=20 aspect=0.5 zoom=0.8, @key value=mykey");
            //var ret = svc.Interpret("bump lock owners=4711:1174:333333");
            //var ret = svc.Interpret("create matfx type=2 coef=1 tex=self");
            //   var ret = svc.Interpret("activate media set vol=100 osd=on name=foo");
        }
コード例 #3
0
 public void Setup()
 {
     _ccSvc = new GenericInterpreterService <CCEnumTypeAttribute, CCEnumBindingAttribute, CCItemBindingAttribute>(Assembly.GetAssembly(typeof(ServerConsole)));
     _ccSvc.Start();
     _acSvc = new GenericInterpreterService <ACEnumTypeAttribute, ACEnumBindingAttribute, ACItemBindingAttribute>(Assembly.GetAssembly(typeof(ACEnumBindingAttribute)));
     _acSvc.Start();
 }
コード例 #4
0
 public PropertiesToolWindow()
 {
     InitializeComponent();
     _acSvc = new GenericInterpreterService <ACEnumTypeAttribute, ACEnumBindingAttribute, ACItemBindingAttribute>(Assembly.GetAssembly(typeof(ACEnumBindingAttribute)));
     _acSvc.Start();
     var ret = _acSvc.Interpret("create matfx type=2 coef=1 tex=self");
     //var ret = _acSvc.Interpret("activate media set radius=30.5 vol=100 osd=on name=foo");
     //propertyGrid1.SelectedObject = ret.ElementAt(0).Commands[0];
     //propertyGrid1.SelectedObject = new UniverseConnectionProperties();
 }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BotEngineExample"/> class.
        ///
        /// You will have to have a valid app.Config settings file, please read documentation on codeplex.
        /// </summary>
        public ServerConsole()
        {
            //ServicesManager.StartService(_commandInterpeter.TechnicalName);
            Console.ParseCommandLine = ProcessCommandLine;
            Console.Title            = string.Format("Managed Bot Engine Server {0}\r\n", base.Version());
            Console.BackgroundColor  = ConsoleColor.DarkBlue;
            Console.Clear();

            CrossAppDomainSingletonT <CrossAppDomainSingleton> .Instance.Shared = this;



            ServicesManager.OnServiceStarted += ServicesManager_OnServiceStarted;
            LocalBotPluginServicesManager.OnServiceStarted += LocalBotPluginServicesManager_OnServiceStarted;
            BotEventSlaveStarted += HandleBotEventSlaveStarted;
            BotEventLoggedIn     += HandleBotEventLoggedIn;
            BotEventEntersWorld  += HandleBotEventEntersWorld;

            Console.WriteLine(ConsoleMessageType.Information, string.Format("Managed Bot Engine Server {0}\r\nCopyright (C)2009-2010 TCPX\r\n", base.Version()));
            Console.WriteLine(ConsoleMessageType.Information, "Starting services");
            Console.ReadLine();
            _sw1.Start();
            // ensure creation of remote client test account for the AwManaged.RemotingTests console application.
            Console.WriteLine("Connecting to your Universe");
            try
            {
                Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ConsoleMessageType.Error, ex.Message);
                Console.WriteLine(ConsoleMessageType.Information, "Please check your application configuration universe connection settings.");
                Console.WriteLine(ConsoleMessageType.Information, "Press enter to exit.");
                System.Console.ReadLine();
                Environment.Exit(0);
            }

            _commandInterpeter = new GenericInterpreterService <CCEnumTypeAttribute, CCEnumBindingAttribute, CCItemBindingAttribute>
                                     (Assembly.GetAssembly(GetType()))
            {
                IdentifyableTechnicalName = "Server Console interpeter"
            };
            ServicesManager.AddService(_commandInterpeter);
            ServicesManager.StartService(_commandInterpeter.IdentifyableTechnicalName);

            // load persistent plugins.
            // persist thie command object if it does not exist.
            var q = from PersistedPlugin p in Storage.Db select p;

            foreach (var item in q.ToList())
            {
                var instance = new LoadPlugin()
                {
                    Name = item.Name
                };
                instance.Interpreted = new List <ICommandGroup>();
                instance.BotEngine   = this;
                instance.Interpreted.Add(new Load());
                var result = instance.ExecuteCommand();
                Console.WriteLine(result.DisplayMessage);
            }
        }