当前位置: 首页>>代码示例>>C#>>正文


C# ConfigNode.AddNode方法代码示例

本文整理汇总了C#中System.ConfigNode.AddNode方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.AddNode方法的具体用法?C# ConfigNode.AddNode怎么用?C# ConfigNode.AddNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ConfigNode的用法示例。


在下文中一共展示了ConfigNode.AddNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsConfigNode

        public ConfigNode AsConfigNode()
        {
            //save the source node, the variables, the teacher name, the student names, Started/Completed and the elapsed time
            ConfigNode node = new ConfigNode("ACTIVE_COURSE");
            node.AddValue("id", id);
            node.AddValue("name", name);
            node.AddValue("elapsedTime", elapsedTime);
            node.AddValue("Started", Started);
            node.AddValue("Completed", Completed);
            node.AddValue("teacher", Teacher != null ? Teacher.name : "NA");
            ConfigNode studentNode = new ConfigNode("STUDENTS");
            foreach (ProtoCrewMember student in Students)
                studentNode.AddValue("student", student.name);
            node.AddNode("STUDENTS", studentNode);

            ConfigNode variableNode = new ConfigNode("VARIABLES");
            foreach (KeyValuePair<string, string> kvp in Variables)
            {
                variableNode.AddValue(kvp.Key, kvp.Value);
            }
            node.AddNode("VARIABLES", variableNode);
            node.AddNode("SOURCE_NODE", sourceNode);

            return node;
        }
开发者ID:CliftonMarien,项目名称:FlightSchool,代码行数:25,代码来源:ActiveCourse.cs

示例2: OnSave

        public void OnSave(ConfigNode configNode)
        {
            configNode.AddValue("name", name);
            configNode.AddValue("aspectRatio", aspectRatio);

            foreach (CutSceneCamera cameraDefinition in cameras)
            {
                ConfigNode child = new ConfigNode(cameraDefinition.GetType().Name);
                configNode.AddNode(child);

                cameraDefinition.OnSave(child);
            }

            foreach (Actor actor in actors)
            {
                ConfigNode child = new ConfigNode(actor.GetType().Name);
                configNode.AddNode(child);

                actor.OnSave(child);
            }

            foreach (CutSceneAction action in actions)
            {
                ConfigNode child = new ConfigNode(action.GetType().Name);
                configNode.AddNode(child);

                action.OnSave(child);
            }
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:29,代码来源:CutSceneDefinition.cs

示例3: OnSave

 public override void OnSave(ConfigNode node)
 {
     try
     {
         if (!vessel.isEVA)
         {
             foreach (ProtoCrewMember crewmember in part.protoModuleCrew)
             {
                 if (VanAllen.crew_rad_exposure.ContainsKey(crewmember.name))
                 {
                     double current_rad = VanAllen.crew_rad_exposure[crewmember.name];
                     ConfigNode rad_node = new ConfigNode("KERBAL_RADIATION_" + crewmember.name);
                     rad_node.AddValue("lifetimeDose", current_rad);
                     node.AddNode(rad_node);
                 }
             }
         }
         else
         {
             if (VanAllen.crew_rad_exposure.ContainsKey(vessel.vesselName))
             {
                 double current_rad = VanAllen.crew_rad_exposure[vessel.vesselName];
                 ConfigNode rad_node = new ConfigNode("KERBAL_RADIATION_" + vessel.vesselName);
                 rad_node.AddValue("lifetimeDose", current_rad);
                 node.AddNode(rad_node);
             }
         }
     }
     catch (Exception ex) { }
 }
开发者ID:Yitscar,项目名称:KSPInterstellar,代码行数:30,代码来源:FNModuleRadiation.cs

示例4: test

        public static void test()
        {
            ConfigNode testNode = new ConfigNode("TESTNODE");
            testNode.AddValue("fooName", "fooValue");

            ConfigNode innerTestNode = new ConfigNode("INNERTESTNODE");
            ConfigNode innerInnerTestNode = new ConfigNode("SUPERINNERTESTNODE");
            innerInnerTestNode.AddValue("superFooName", "superFooValue");
            innerTestNode.AddValue("innerFooName", "innerFooValue");
            innerTestNode.AddNode(innerInnerTestNode);
            testNode.AddNode(innerTestNode);

            innerTestNode = new ConfigNode("INNERTESTNODE2");
            innerTestNode.AddValue("innerFooName2", "innerFooValue2");
            innerTestNode.AddValue("innerFooName2-2", "innerFooValue2-2");
            testNode.AddNode(innerTestNode);


            String data = testNode.ToString();
            MonoBehaviour.print("raw node string: " + data);
            ConfigNode reparsedNode = SSTUNodeUtils.parseConfigNode(data);
            MonoBehaviour.print("new node: " + reparsedNode);

            ConfigNode stockReparsedNode = ConfigNode.Parse(data);
            MonoBehaviour.print("stockNewNode: " + stockReparsedNode.nodes[0]);
        }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:26,代码来源:SSTUNodeUtils.cs

示例5: Save

        public void Save(ConfigNode resourceNode)
        {
            resourceNode.AddNode(generatorNode);

            foreach (var body in bodies)
            {
                var bodyNode = new ConfigNode("Body");
                bodyNode.AddValue("Name", body.Key.name);
                body.Value.Save(bodyNode);
                resourceNode.AddNode(bodyNode);
            }
        }
开发者ID:SiriusSam,项目名称:Kethane,代码行数:12,代码来源:ResourceData.cs

示例6: Commit

        /// <summary>
        /// Called when the game is saved, commits inventory values into save game.
        /// </summary>
        /// <param name="root">ConfigNode passed from GameEvent</param>
        public void Commit(ConfigNode root)
        {
            // Parts
            ConfigNode N = new ConfigNode(this.GetType().FullName);
            ConfigNode p = N.AddNode("PARTS");
            foreach (string P in Parts.Inventory.Keys.Where(x => Parts.Inventory[x] != 0)) p.AddValue(P, Parts.Inventory[P]);
            // Resources, load even if recover_resources = false
            ConfigNode r = N.AddNode("RESOURCES");
            foreach (string P in Resources.Inventory.Keys.Where(x => Resources.Get(x) != 0)) r.AddValue(P, Resources.Inventory[P]);

            root.AddNode(N);
        }
开发者ID:magico13,项目名称:TheScrapyard,代码行数:16,代码来源:Scrapyard.cs

示例7: Save

		public void Save (ConfigNode node)
		{
			var req = node.AddNode ("Required");
			foreach (var res in required) {
				var r = req.AddNode ("BuildResrouce");
				res.Save (r);
			}
			var opt = node.AddNode ("Optional");
			foreach (var res in optional) {
				var r = opt.AddNode ("BuildResrouce");
				res.Save (r);
			}
		}
开发者ID:tfischer4765,项目名称:Extraplanetary-Launchpads,代码行数:13,代码来源:CostReport.cs

示例8: SaveHallOfFame

         /***************************************************************************************************************
          * new persistence model
          ***************************************************************************************************************/

         public static void SaveHallOfFame(List<LogbookEntry> logbook, ConfigNode node)
         {
            Log.Info("saving hall of fame (" + logbook.Count + " logbook entries)");

            List<LogbookEntry> logbookCopy = new List<LogbookEntry>(logbook);

            Stopwatch sw = new Stopwatch();
            sw.Start();

            try
            {
               foreach (LogbookEntry entry in logbookCopy)
               {
                  ConfigNode entryNode = new ConfigNode(PERSISTENCE_NODE_ENTRY_NAME);
                  if (Log.IsLogable(Log.LEVEL.DETAIL)) Log.Detail("saving logbook entry " + entry);
                  entryNode.AddValue(Constants.CONFIGNODE_KEY_TIME, entry.UniversalTime.ToString());
                  entryNode.AddValue(Constants.CONFIGNODE_KEY_NAME, entry.Name);
                  entryNode.AddValue(Constants.CONFIGNODE_KEY_CODE, entry.Code);
                  entryNode.AddValue(Constants.CONFIGNODE_KEY_DATA, entry.Data);
                  node.AddNode(entryNode);
               }
            }
            catch
            {
               Log.Error("exception while saving hall of fame detected; hall of fame may be corrupt");
            }
            finally
            {
               sw.Stop();
               Log.Info("hall of fame saved in " + sw.ElapsedMilliseconds + "ms");
            }
         }
开发者ID:Kerbas-ad-astra,项目名称:FinalFrontier,代码行数:36,代码来源:Persistence.cs

示例9: Save

 /// <summary>
 /// Save settings to the underlying storage
 /// </summary>
 public void Save()
 {
     ConfigNode node = AsConfigNode;
     var clsNode = new ConfigNode (GetType ().Name);
     clsNode.AddNode (node);
     clsNode.Save (filePath);
 }
开发者ID:602p,项目名称:krpc,代码行数:10,代码来源:ConfigurationStorage.cs

示例10: DumpCurrentTreeToFile

        static public void DumpCurrentTreeToFile( string sFileName, string sTreeName )
        {
            // only attempt to dump if the current game mode has a tech tree, and the tech tree is present

            if ( HighLogic.CurrentGame != null && ( HighLogic.CurrentGame.Mode == Game.Modes.CAREER || HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX )
                && AssetBase.RnDTechTree != null && AssetBase.RnDTechTree.GetTreeNodes() != null )
            {
			    ConfigNode fileConfigNode = new ConfigNode();

			    ConfigNode treeConfigNode = new ConfigNode( "TECH_TREE" );

                treeConfigNode.AddValue( "name", sTreeName );

                AddAllTechNodesToTreeNode( treeConfigNode );

                AddPlanetScienceValuesToTreeNode( treeConfigNode );

                fileConfigNode.AddNode( treeConfigNode );

			    fileConfigNode.Save( KSPUtil.ApplicationRootPath.Replace( "\\", "/" ) + "GameData/ATC/" + sFileName, 
                    "Config file representing the stock tech tree\r\n" +
                    "// WARNING: This file should not be edited directly, but rather should either be altered using ModuleManager commands within your own .cfg files OR\r\n" +
                    "// a new tree .cfg should be created which settings.cfg can then be set to point to." );

                m_bHasTreeAlreadyBeenDumped = true;
            }
        }
开发者ID:FractalUK,项目名称:KSPAlternativeTechConfigurator,代码行数:27,代码来源:ATCTreeDumper.cs

示例11: CheckForDataNodes

        private bool CheckForDataNodes(ConfigNode node)
        {
            foreach (string type in KRESUtils.types.Values)
            {
                if (!node.HasNode(type)) { goto Incomplete; }
                ConfigNode t = node.GetNode(type);
                foreach (CelestialBody body in KRESUtils.GetRelevantBodies(type))
                {
                    if (!t.HasNode(body.bodyName)) { goto Incomplete; }
                }
            }
            return true;

            Incomplete:
            {
                print("no nodes");
                node.ClearNodes();
                foreach(string type in KRESUtils.types.Values)
                {
                    ConfigNode t = node.AddNode(type);
                    foreach(CelestialBody body in KRESUtils.GetRelevantBodies(type))
                    {
                        ConfigNode b = t.AddNode(body.bodyName);
                        b.AddValue("currentError", 1d);
                    }
                }
                return false;
            }
        }
开发者ID:CYBUTEK,项目名称:KRES,代码行数:29,代码来源:DataManager.cs

示例12: SaveCustomStressTemplates

        public static void SaveCustomStressTemplates()
        {
            ConfigNode node = new ConfigNode("@FARAeroStress[default]:FOR[FerramAerospaceResearch]");
            int i = 0;
            node.AddNode(new ConfigNode("!FARPartStressTemplate,*"));

            foreach (FARPartStressTemplate template in StressTemplates)
            {
                node.AddNode(CreateAeroStressConfigNode(template, i));
                i++;
            }

            ConfigNode saveNode = new ConfigNode();
            saveNode.AddNode(node);
            saveNode.Save(KSPUtil.ApplicationRootPath.Replace("\\", "/") + "GameData/FerramAerospaceResearch/CustomFARAeroStress.cfg");
        }
开发者ID:sarbian,项目名称:Ferram-Aerospace-Research,代码行数:16,代码来源:FARAeroStress.cs

示例13: Save

 /// <summary>
 /// Save settings to the underlying storage
 /// </summary>
 public void Save ()
 {
     ConfigNode node = AsConfigNode;
     var clsNode = new ConfigNode (nodeName);
     clsNode.AddNode (node);
     clsNode.Save (path);
 }
开发者ID:paperclip,项目名称:krpc,代码行数:10,代码来源:ConfigurationStorage.cs

示例14: OnSave

		public override void OnSave(ConfigNode config)
		{
			var settings = new ConfigNode ("Settings");
			config.AddNode (settings);

			//XXX fill in with config node stuff to save settings to the
			// settings config node
		}
开发者ID:aoighost,项目名称:ModularFuelSystem,代码行数:8,代码来源:Settings.cs

示例15: OnSave

        protected override void OnSave(ConfigNode configNode)
        {
            base.OnSave(configNode);

            ConfigNode child = new ConfigNode("CUTSCENE_DEFINITION");
            cutSceneDefinition.OnSave(child);
            configNode.AddNode(child);
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:8,代码来源:RunCutScene.cs


注:本文中的System.ConfigNode.AddNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。