Exemplo n.º 1
0
        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);
                }

            }
        }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
0
        private void DumpFederationObjects(MetaFederateAmbassador metaFederateAmbassador, IList<HLAobjectRoot> objects, String parentNodeName, String federationName)
        {
            TreeNode parentNode = FindNode(treeView1.Nodes, parentNodeName);
            if (parentNode == null)
            {
                parentNode = new TreeNode(parentNodeName);
                parentNode.ImageIndex = 3;
                parentNode.SelectedImageIndex = 3;
                parentNode.Tag = parentNodeName;
                this.treeView1.Nodes.Add(parentNode);

                HLAfederation federationObject = metaFederateAmbassador.GetFederation(federationName);

                if (federationObject != null)
                {
                    DescriptorManager descriptorManager = new DescriptorManager();
                    descriptorManager.AddDescriptors(federationObject.HLAFDDID);

                    ShowInformationFromDescriptorManager(descriptorManager, parentNodeName);
                }
            }

            AddHLAobjectRootNodes(parentNode, objects);
        }