本文整理汇总了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");
}
}
示例2: OnParameterSave
protected override void OnParameterSave(ConfigNode node)
{
base.OnParameterSave(node);
node.AddValue("minSignalDelay", minSignalDelay);
node.AddValue("maxSignalDelay", maxSignalDelay);
}
示例3: OnParameterSave
protected override void OnParameterSave(ConfigNode node)
{
base.OnParameterSave(node);
node.AddValue("hasConnectivity", hasConnectivity);
node.AddValue("vesselKey", vesselKey);
}
示例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 );
}
}
示例5: OnSave
public override void OnSave(ConfigNode configNode)
{
base.OnSave(configNode);
configNode.AddValue("latitude", latitude);
configNode.AddValue("longitude", longitude);
configNode.AddValue("altitude", altitude);
}
示例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);
}
示例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);
}
}
示例8: OnSave
public override void OnSave(ConfigNode node)
{
base.OnSave(node);
node.AddValue("selectedObject", selectedObject.ToString());
node.AddValue("showGui", showGui.ToString());
}
示例9: OnSave
protected override void OnSave(ConfigNode configNode)
{
base.OnSave(configNode);
configNode.AddValue("url", url);
configNode.AddValue("craftType", craftType);
}
示例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"));
}
示例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]);
}
示例12: Save
public bool Save(ConfigNode node)
{
node.AddValue("%enable", Enable);
node.AddValue("%unit", Unit);
return true;
}
示例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;
}
示例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);
}
}
示例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);
}