Beispiel #1
0
        private void CompilePlugin(PluginSimulator simulationModule)
        {
            string fullName = simulationModule.FomList[0].Uri;

            try
            {
                OpenFile(fullName, null);
                DescriptorManager descriptorManager = new DescriptorManager();
                descriptorManager.AddDescriptors(fullName);
                Sxta.Rti1516.DynamicCompiler.DynamicCompiler compiler = new Sxta.Rti1516.DynamicCompiler.DynamicCompiler(descriptorManager);
                compiler.TargetDirectory = new FileInfo("Proxys");
                foreach (Assembly asm in simulationModule.Plugin.RuntimeLibraries.Values)
                {
                    compiler.AssemblyDependencies.Add(asm);
                }
                compiler.PackageDependencies.Add("Mogre");
                compiler.PackagePrefix = simulationModule.Plugin.Name;
                compiler.CompileProxies();
                if (log.IsInfoEnabled)
                {
                    log.Info("Compilation of " + fullName + " finished ...");
                    log.Info("Look for generated files in " + compiler.TargetDirectory.FullName);
                }
                string fileName = compiler.TargetDirectory.FullName + Path.DirectorySeparatorChar + "generated.cs";
                OpenFile(fileName, simulationModule.Plugin.Name + Path.DirectorySeparatorChar + "generated.cs");
                fileName = compiler.generatedSerializersFile;
                OpenFile(fileName, simulationModule.Plugin.Name + Path.DirectorySeparatorChar + "serializers.cs");
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Beispiel #2
0
        private void OnLoadPlugins()
        {
            PluginManager pluginManager = PluginManager.Instance;

            pluginManager.ScanForPlugins();
            m_pluginList.ShowPlugins(pluginManager.Plugins);
            foreach (IPlugin plugin in pluginManager.Plugins)
            {
                foreach (Extension extension in plugin.Extensions)
                {
                    foreach (IModule module in extension.ModulesCollection)
                    {
                        if (module is PluginSimulator)
                        {
                            PluginSimulator simulationModule = module as PluginSimulator;
                            simulationModule.Plugin = plugin;
                            //CompilePlugin(simulationModule);
                            foreach (Assembly asm in plugin.RuntimeLibraries.Values)
                            {
                                rtiAmbassador.RegisterAssembly(asm);
                            }

                            ToolStripMenuItem moduleToolStripMenuItem = new ToolStripMenuItem();;
                            moduleToolStripMenuItem.Name   = module.ID + "ToolStripMenuItem";
                            moduleToolStripMenuItem.Size   = new System.Drawing.Size(250, 22);
                            moduleToolStripMenuItem.Text   = module.ID;
                            moduleToolStripMenuItem.Click += new System.EventHandler(this.OnRunSimulation);
                            moduleToolStripMenuItem.Tag    = simulationModule;
                            this.simulationToolStripMenuItem.DropDownItems.Add(moduleToolStripMenuItem);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void OnRunSimulation(object sender, EventArgs e)
        {
            if (!(sender is ToolStripMenuItem))
            {
                return;
            }
            ToolStripMenuItem module = sender as ToolStripMenuItem;
            PluginSimulator   sim    = module.Tag as PluginSimulator;

            sim.StartSimulation(rtiAmbassador);
        }
Beispiel #4
0
 private void CompilePlugin(PluginSimulator simulationModule)
 {
     string fullName = simulationModule.FomList[0].Uri;
     try
     {
         OpenFile(fullName, null);
         DescriptorManager descriptorManager = new DescriptorManager();
         descriptorManager.AddDescriptors(fullName);
         Sxta.Rti1516.DynamicCompiler.DynamicCompiler compiler = new Sxta.Rti1516.DynamicCompiler.DynamicCompiler(descriptorManager);
         compiler.TargetDirectory = new FileInfo("Proxys");
         foreach (Assembly asm in simulationModule.Plugin.RuntimeLibraries.Values)
         {
             compiler.AssemblyDependencies.Add(asm);
         }
         compiler.PackageDependencies.Add("Mogre");
         compiler.PackagePrefix = simulationModule.Plugin.Name;
         compiler.CompileProxies();
         if (log.IsInfoEnabled)
         {
             log.Info("Compilation of " + fullName + " finished ...");
             log.Info("Look for generated files in " + compiler.TargetDirectory.FullName);
         }
         string fileName = compiler.TargetDirectory.FullName + Path.DirectorySeparatorChar + "generated.cs";
         OpenFile(fileName, simulationModule.Plugin.Name + Path.DirectorySeparatorChar + "generated.cs");
         fileName = compiler.generatedSerializersFile;
         OpenFile(fileName, simulationModule.Plugin.Name + Path.DirectorySeparatorChar + "serializers.cs");
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }