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); } }
private void OpenFileToCompile(object sender, EventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); openFile.InitialDirectory = Application.ExecutablePath; openFile.Filter = "Xml files (*.xml)|*.xml|All files (*.*)|*.*"; openFile.FilterIndex = 1; openFile.RestoreDirectory = true; if (openFile.ShowDialog() == DialogResult.OK) { string fullName = openFile.FileName; 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"); 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, null); fileName = compiler.TargetDirectory.FullName + Path.DirectorySeparatorChar + "Serializers.cs"; OpenFile(fileName, null); } catch (Exception exception) { MessageBox.Show(exception.Message); } } }