當前位置: 首頁>>代碼示例>>C#>>正文


C# ConfigNode.AddValue方法代碼示例

本文整理匯總了C#中System.ConfigNode.AddValue方法的典型用法代碼示例。如果您正苦於以下問題:C# ConfigNode.AddValue方法的具體用法?C# ConfigNode.AddValue怎麽用?C# ConfigNode.AddValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.ConfigNode的用法示例。


在下文中一共展示了ConfigNode.AddValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: OnParameterSave

        protected override void OnParameterSave(ConfigNode node)
        {
            base.OnParameterSave(node);

            node.AddValue("minSignalDelay", minSignalDelay);
            node.AddValue("maxSignalDelay", maxSignalDelay);
        }
開發者ID:linuxgurugamer,項目名稱:ContractConfigurator,代碼行數:7,代碼來源:SignalDelayParameter.cs

示例3: OnParameterSave

        protected override void OnParameterSave(ConfigNode node)
        {
            base.OnParameterSave(node);

            node.AddValue("hasConnectivity", hasConnectivity);
            node.AddValue("vesselKey", vesselKey);
        }
開發者ID:linuxgurugamer,項目名稱:ContractConfigurator,代碼行數:7,代碼來源:VesselConnectivityParameter.cs

示例4: AddPlanetScienceValuesToTreeNode

        static private void AddPlanetScienceValuesToTreeNode( ConfigNode treeConfigNode )
        {
            foreach ( CelestialBody tempBody in FlightGlobals.Bodies )
			{
                ConfigNode bodyConfigNode = new ConfigNode( "BODY_SCIENCE_PARAMS" );

                bodyConfigNode.AddValue( "name", tempBody.name );

	            bodyConfigNode.AddValue( "LandedDataValue", tempBody.scienceValues.LandedDataValue );
                bodyConfigNode.AddValue( "SplashedDataValue", tempBody.scienceValues.SplashedDataValue );

                bodyConfigNode.AddValue( "FlyingLowDataValue", tempBody.scienceValues.FlyingLowDataValue );
                bodyConfigNode.AddValue( "FlyingHighDataValue", tempBody.scienceValues.FlyingHighDataValue );

                bodyConfigNode.AddValue( "InSpaceLowDataValue", tempBody.scienceValues.InSpaceLowDataValue );
                bodyConfigNode.AddValue( "InSpaceHighDataValue", tempBody.scienceValues.InSpaceHighDataValue );

                bodyConfigNode.AddValue( "flyingAltitudeThreshold", tempBody.scienceValues.flyingAltitudeThreshold );
                bodyConfigNode.AddValue( "spaceAltitudeThreshold" , tempBody.scienceValues.spaceAltitudeThreshold );

                bodyConfigNode.AddValue( "RecoveryValue", tempBody.scienceValues.RecoveryValue );

                treeConfigNode.AddNode( bodyConfigNode );
            }
        }
開發者ID:FractalUK,項目名稱:KSPAlternativeTechConfigurator,代碼行數:25,代碼來源:ATCTreeDumper.cs

示例5: OnSave

 public override void OnSave(ConfigNode configNode)
 {
     base.OnSave(configNode);
     configNode.AddValue("latitude", latitude);
     configNode.AddValue("longitude", longitude);
     configNode.AddValue("altitude", altitude);
 }
開發者ID:linuxgurugamer,項目名稱:ContractConfigurator,代碼行數:7,代碼來源:FixedCamera.cs

示例6: OnSave

        protected override void OnSave(ConfigNode node)
        {
            int bodyID = targetBody.flightGlobalsIndex;
            node.AddValue(KEESExperimentContract.TARGET_BODY, bodyID);

            node.AddValue(KEESExperimentContract.EXPERIMENT_STRING, experiment.name);
        }
開發者ID:N3h3miah,項目名稱:OrbitalMaterialScience,代碼行數:7,代碼來源:KEESDoExperimentParameter.cs

示例7: 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

示例8: OnSave

        public override void OnSave(ConfigNode node)
        {
            base.OnSave(node);
            node.AddValue("selectedObject", selectedObject.ToString());

            node.AddValue("showGui", showGui.ToString());
        }
開發者ID:ozraven,項目名稱:WildBlueTools,代碼行數:7,代碼來源:WBIMeshHelper.cs

示例9: OnSave

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

            configNode.AddValue("url", url);
            configNode.AddValue("craftType", craftType);
        }
開發者ID:linuxgurugamer,項目名稱:ContractConfigurator,代碼行數:7,代碼來源:CopyCraftFile.cs

示例10: Save

		public void Save()
		{
			ConfigNode settings = new ConfigNode("SmartStage");
			settings.AddValue("autoUpdateStaging", autoUpdateStaging);
			settings.AddValue("showInFlight", plugin.showInFlight);
			settings.Save(KSP.IO.IOUtils.GetFilePathFor(typeof(MainWindow), "settings.cfg"));
		}
開發者ID:pjwerneck,項目名稱:SmartStage,代碼行數:7,代碼來源:MainWindow.cs

示例11: 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

示例12: Save

        public bool Save(ConfigNode node)
        {
            node.AddValue("%enable", Enable);
            node.AddValue("%unit", Unit);

            return true;
        }
開發者ID:nanathan,項目名稱:HotSpot,代碼行數:7,代碼來源:MetricNode.cs

示例13: Load

        public override bool Load(ConfigNode configNode)
        {
            // Ignore the targetBody in the base class
            configNode.AddValue("ignoreTargetBody", true);

            // Load base class
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue<bool>(configNode, "failWhenUnmet", x => failWhenUnmet = x, this, false);
            valid &= ConfigNodeUtil.ParseValue<Biome>(configNode, "biome", x => biome = x, this, (Biome)null);
            valid &= ConfigNodeUtil.ParseValue<List<Vessel.Situations>>(configNode, "situation", x => situation = x, this, new List<Vessel.Situations>());
            valid &= ConfigNodeUtil.ParseValue<float>(configNode, "minAltitude", x => minAltitude = x, this, float.MinValue);
            valid &= ConfigNodeUtil.ParseValue<float>(configNode, "maxAltitude", x => maxAltitude = x, this, float.MaxValue);
            valid &= ConfigNodeUtil.ParseValue<float>(configNode, "minTerrainAltitude", x => minTerrainAltitude = x, this, 0.0f, x => Validation.GE(x, 0.0f));
            valid &= ConfigNodeUtil.ParseValue<float>(configNode, "maxTerrainAltitude", x => maxTerrainAltitude = x, this, float.MaxValue, x => Validation.GE(x, 0.0f));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minSpeed", x => minSpeed = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxSpeed", x => maxSpeed = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minRateOfClimb", x => minRateOfClimb = x, this, double.MinValue);
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxRateOfClimb", x => maxRateOfClimb = x, this, double.MaxValue);
            valid &= ConfigNodeUtil.ParseValue<float>(configNode, "minAcceleration", x => minAcceleration = x, this, 0.0f, x => Validation.GE(x, 0.0f));
            valid &= ConfigNodeUtil.ParseValue<float>(configNode, "maxAcceleration", x => maxAcceleration = x, this, float.MaxValue, x => Validation.GE(x, 0.0f));

            // Overload targetBody
            if (!configNode.HasValue("targetBody"))
            {
                configNode.AddValue("targetBody", "[ @/targetBody ]");
            }
            valid &= ConfigNodeUtil.ParseValue<List<CelestialBody>>(configNode, "targetBody", x => targetBodies = x, this);

            // Validation minimum set
            valid &= ConfigNodeUtil.AtLeastOne(configNode, new string[] { "targetBody", "biome", "situation", "minAltitude", "maxAltitude",
                "minTerrainAltitude", "maxTerrainAltitude", "minSpeed", "maxSpeed", "minRateOfClimb", "maxRateOfClimb", "minAcceleration", "maxAcceleration" }, this);

            return valid;
        }
開發者ID:Kerbas-ad-astra,項目名稱:ContractConfigurator,代碼行數:35,代碼來源:ReachStateFactory.cs

示例14: OnSave

 protected sealed override void OnSave(ConfigNode node)
 {
     try
     {
         if (Root != null)
         {
             node.AddValue("ContractIdentifier", Root.ToString());
         }
         node.AddValue("title", title ?? "");
         node.AddValue("notes", notes ?? "");
         node.AddValue("completedMessage", completedMessage ?? "");
         if (completeInSequence)
         {
             node.AddValue("completeInSequence", completeInSequence);
         }
         if (hidden)
         {
             node.AddValue("hidden", hidden);
         }
         if (hideChildren)
         {
             node.AddValue("hideChildren", hideChildren);
         }
         if (fakeFailures)
         {
             node.AddValue("fakeFailures", fakeFailures);
         }
         OnParameterSave(node);
     }
     catch (Exception e)
     {
         LoggingUtil.LogException(e);
         ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.PARAMETER_SAVE, e, Root.ToString(), ID);
     }
 }
開發者ID:linuxgurugamer,項目名稱:ContractConfigurator,代碼行數:35,代碼來源:ContractConfiguratorParameter.cs

示例15: OnParameterSave

 protected override void OnParameterSave(ConfigNode node)
 {
     node.AddValue("coverage", coverage);
     node.AddValue("scanName", scanName);
     node.AddValue("scanType", scanType);
     node.AddValue("targetBody", targetBody.name);
 }
開發者ID:linuxgurugamer,項目名稱:ContractConfigurator,代碼行數:7,代碼來源:SCANsatCoverage.cs


注:本文中的System.ConfigNode.AddValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。