本文整理汇总了C#中System.ConfigNode.SetNode方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.SetNode方法的具体用法?C# ConfigNode.SetNode怎么用?C# ConfigNode.SetNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.SetNode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: writeConfig
private void writeConfig(Config config)
{
ConfigNode root = new ConfigNode ();
ConfigNode top = new ConfigNode (WASD_NODENAME);
root.SetNode (WASD_NODENAME, top, true);
top.SetValue ("defaultCamera", config.defaultCamera.ToString (), true);
top.SetValue ("mouseWheelActive", config.mouseWheelActive.ToString (), true);
top.SetValue ("enableExperimentalEditorExtensionsCompatibility", config.enableExperimentalEditorExtensionsCompatibility.ToString (), true);
top.SetValue ("enforceBounds", config.enforceBounds.ToString (), true);
top.SetValue ("sensitivity", config.sensitivity.ToString (), true);
top.SetValue ("acceleration", config.acceleration.ToString (), true);
top.SetValue ("mouseWheelAcceleration", config.mouseWheelAcceleration.ToString (), true);
top.SetValue ("friction", config.friction.ToString (), true);
top.SetValue ("runMultiplier", config.runMultiplier.ToString (), true);
top.SetValue ("sneakMultiplier", config.sneakMultiplier.ToString (), true);
ConfigNode keysNode = new ConfigNode ("KEYS");
top.SetNode ("KEYS", keysNode, true);
keysNode.SetValue ("forward", config.keyForward.ToString (), true);
keysNode.SetValue ("back", config.keyBack.ToString (), true);
keysNode.SetValue ("right", config.keyRight.ToString (), true);
keysNode.SetValue ("left", config.keyLeft.ToString (), true);
keysNode.SetValue ("up", config.keyUp.ToString (), true);
keysNode.SetValue ("down", config.keyDown.ToString (), true);
keysNode.SetValue ("switchMode", config.keySwitchMode.ToString (), true);
keysNode.SetValue ("run", config.keyRun.ToString (), true);
keysNode.SetValue ("sneak", config.keySneak.ToString (), true);
ConfigNode editorsNode = new ConfigNode ("EDITORS");
top.SetNode ("EDITORS", editorsNode, true);
ConfigNode vabNode = new ConfigNode ("VAB");
editorsNode.SetNode ("VAB", vabNode, true);
string s;
s = config.vab.initialPosition.ToString ();
s = s.TrimStart ('(');
s = s.TrimEnd (')');
vabNode.SetValue ("initialPosition", s, true);
vabNode.SetValue ("initialPitch", config.vab.initialPitch.ToString (), true);
vabNode.SetValue ("initialYaw", config.vab.initialYaw.ToString (), true);
ConfigNode vabBoundsNode = new ConfigNode ("BOUNDS");
vabNode.SetNode ("BOUNDS", vabBoundsNode, true);
s = config.vab.bounds.min.ToString ();
s = s.TrimStart ('(');
s = s.TrimEnd (')');
vabBoundsNode.SetValue ("min", s, true);
s = config.vab.bounds.max.ToString ();
s = s.TrimStart ('(');
s = s.TrimEnd (')');
vabBoundsNode.SetValue ("max", s, true);
// need to do bounds
ConfigNode sphNode = new ConfigNode ("SPH");
editorsNode.SetNode ("SPH", sphNode, true);
s = config.sph.initialPosition.ToString ();
s = s.TrimStart ('(');
s = s.TrimEnd (')');
sphNode.SetValue ("initialPosition", s, true);
sphNode.SetValue ("initialPitch", config.sph.initialPitch.ToString (), true);
sphNode.SetValue ("initialYaw", config.sph.initialYaw.ToString (), true);
// need to do bounds
ConfigNode sphBoundsNode = new ConfigNode ("BOUNDS");
sphNode.SetNode ("BOUNDS", sphBoundsNode, true);
s = config.sph.bounds.min.ToString ();
s = s.TrimStart ('(');
s = s.TrimEnd (')');
sphBoundsNode.SetValue ("min", s, true);
s = config.sph.bounds.max.ToString ();
s = s.TrimStart ('(');
s = s.TrimEnd (')');
sphBoundsNode.SetValue ("max", s, true);
root.Save (WASD_CFG_FILE);
WasdEditorCameraBehaviour.setConfig (root);
}
示例2: Save
/// <summary>
/// Saves the original configNode <see cref="externalData"/> passed from the api
/// to the persistent
/// </summary>
/// <param name="node">Node with the command infos to save in</param>
/// <param name="computer">Current flightcomputer</param>
public override void Save(ConfigNode node, FlightComputer computer)
{
base.Save(node, computer);
node.AddNode("ExternalData");
node.SetNode("ExternalData", this.externalData);
}
示例3: saveData
public static bool saveData (Configuration.dataLevel type)
{
Log.Info ("saveData dataLevel: " + type.ToString ());
string path = getDataFile (type);
Log.Info ("saveData: " + path);
if (path == "")
return false;
ConfigNode root = new ConfigNode ();
ConfigNode top = new ConfigNode (FileOperations.TT_NODENAME);
root.SetNode (FileOperations.TT_NODENAME, top, true);
switch (type) {
case Configuration.dataLevel.game:
top.SetValue ("secInGame", TotalTime.secInGame.ToString (), true);
break;
case Configuration.dataLevel.install:
top.SetValue ("secInInstall", TotalTime.secInInstall.ToString (), true);
break;
case Configuration.dataLevel.global:
top.SetValue ("secTotal", TotalTime.secTotal.ToString (), true);
break;
}
root.Save (path);
return false;
}
示例4: OnSave
//save scenario
public override void OnSave(ConfigNode node)
{
if (!isInit)
return;
Debug.Log("StateFundingScenario saving to persistence");
ConfigNode saveNode = ConfigNode.CreateConfigFromObject(data);
node.SetNode(CONFIG_NODENAME, saveNode, true);
}
示例5: OnSave
public override void OnSave(ConfigNode node)
{
this.Log("Saving settings...");
if (node.HasNode("SETTINGS"))
{
node.SetNode("SETTINGS", CurrentSettings.ToNode());
}
else
{
node.AddNode(CurrentSettings.ToNode());
}
}
示例6: SaveConfiguration
public void SaveConfiguration()
{
Log.Info ("SaveConfiguration");
ConfigNode root = new ConfigNode ();
ConfigNode top = new ConfigNode (FileOperations.TT_NODENAME);
root.SetNode (FileOperations.TT_NODENAME, top, true);
top.SetValue ("totalTimeDataPath", totalTimeDataPath.ToString (), true);
top.SetValue ("logGameTime", logGameTime.ToString (), true);
top.SetValue ("logInstallTime", logInstallTime.ToString (), true);
top.SetValue ("logGlobalTime", logGlobalTime.ToString (), true);
top.SetValue ("updateInterval", interval.ToString (), true);
top.SetValue ("displayGameTime", displayGameTime.ToString (), true);
top.SetValue ("displayInstallTime", displayInstallTime.ToString (), true);
top.SetValue ("displayGlobalTime", displayGlobalTime.ToString (), true);
top.SetValue ("displaySessionTime", displaySessionTime.ToString (), true);
top.SetValue ("includePauseTime", includePauseTime.ToString (), true);
top.SetValue ("enableEscapePause", enableEscapePause.ToString (), true);
top.SetValue ("displayOnScreen", displayOnScreen.ToString (), true);
top.SetValue ("displayInWindow", displayInWindow.ToString (), true);
root.Save (FileOperations.TT_CFG_FILE);
TotalTime.setConfig (root);
}