Exemple #1
0
        public void Initialize()
        {
            _request1 = new MockRequestInfo("");
            _request2 = new MockRequestInfo("/");
            _request3 = new MockRequestInfo("/path1");
            _request4 = new MockRequestInfo("path1/");
            _request5 = new MockRequestInfo("path1");
            _request6 = new MockRequestInfo("/path1/path2");
            _request7 = new MockRequestInfo("path1/path2/");
            _request8 = new MockRequestInfo("path1/path2");

            IFactory factory = new NinjectFactory();

            _normalizeAction = factory.Create <INormalizeAction>();
            _ruleResult      = factory.Create <IRuleResult>();
        }
        static void Main()
        {
            // Detect existing instances
            string processName = Process.GetCurrentProcess().ProcessName;

            Process[] instances = Process.GetProcessesByName(processName);

            if (instances.Length > 1)
            {
                return;
            }
            // End of detection

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new MainForm());
            Application.Run(NinjectFactory.Resolve <MainForm>());
        }
 public MainForm()
 {
     InitializeComponent();
     SetUpControlls();
     controller = NinjectFactory.Resolve <IController>(this);
 }
        public override void Start(string[] args)
        {
            Host.Object.Say("Starting MRM Meta System.");
            _k = NinjectFactory.getKernel <DynamicLoaderModule>();
            BindableHost.Host   = Host;
            BindableWorld.World = World;

            _k.Bind <IHost>().To <BindableHost>().InSingletonScope();
            _k.Bind <IWorld>().To <BindableWorld>().InSingletonScope();

            string queueLibrary = typeof(AsynchQueueFactory).Assembly.Location;
            string queueType    = typeof(AsynchQueueFactory).FullName;

            try {
                IConfig masterConfig = new DotNetConfigSource(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile).Configs["Bootstrap"];
                queueLibrary = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, masterConfig.GetString(MRMSystem.QUEUE + MRMSystem.ASSEMBLY, queueLibrary));
                queueType    = masterConfig.GetString(MRMSystem.QUEUE + MRMSystem.CLASS, queueType);
            } catch (Exception e) {
            }
            _k.Get <IDynamicLoaderModule>().BindDynamic(typeof(IAsynchQueueFactory), queueLibrary, queueType, true);

            World.OnChat += (world, chatArgs) => {
                lock (this) {
                    if (chatArgs.Channel == CHAN && chatArgs.Text.StartsWith(PING_ACK))
                    {
                        string configFile = chatArgs.Text.Split(new char[] { ':' }, 2)[1];
                        string baseFolder = Path.GetDirectoryName(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
                        configFile = Path.Combine(baseFolder, configFile);
                        Console.WriteLine("Tying to start " + chatArgs.Sender.Name + " from " + configFile);
                        if (!File.Exists(configFile))
                        {
                            //throw new Exception("Unable to start MRM system. No config file found at '" + Path.GetFullPath(configFile) + "'.");
                            return;
                        }
                        IConfig config = new DotNetConfigSource(configFile).Configs["Bootstrap"];
                        if (config == null)
                        {
                            //throw new Exception("Unable to start MRM system. No 'Bootstrap' section found in config file '" + Path.GetFullPath(configFile) + "'.");
                            return;
                        }

                        try {
                            UUID      id     = chatArgs.Sender.GlobalID;
                            MRMSystem system = new MRMSystem();
                            system.InitMiniModule(World, Host, UUID.Random());
                            system.Start(_k, config, configFile, id, false);

                            _liveSystems.Add(chatArgs.Sender.GlobalID, system);
                            _k.Get <IPrimFactory>()[id].OnWorldDelete += destroyedID => {
                                Stop(system);
                                system.Stop();
                                _liveSystems.Remove(id);
                            };
                        } catch (Exception e) {
                            log.Warn("Unable to start MRM system from " + chatArgs.Sender.Name + ". " + e);
                            Host.Object.Say("Unable to start MRM system from " + chatArgs.Sender.Name, 0, true, MRMChatTypeEnum.Region);
                        }
                    }
                }
            };
            Host.Object.Say(PING, CHAN, ChatTargetEnum.LSL);
        }
Exemple #5
0
 public void Setup()
 {
     _nodeWriter = NinjectFactory.GetInstance <INodeWriter>();
 }