本文整理汇总了C#中System.ConfigNode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.ToString方法的具体用法?C# ConfigNode.ToString怎么用?C# ConfigNode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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]);
}
示例2: Load
public void Load(ConfigNode node)
{
Debug.Log("FlightData Load");
Debug.Log(node.ToString());
if (node.HasValue("dataDeepSpace"))
dataDeepSpace = float.Parse(node.GetValue("dataDeepSpace"));
else
dataDeepSpace = 0.0f;
if (node.HasValue("flightTimeDeepSpace"))
flightTimeDeepSpace = int.Parse(node.GetValue("flightTimeDeepSpace"));
else
flightTimeDeepSpace = 0;
if (node.HasNode("bodyData"))
{
if (dataBodies == null)
dataBodies = new List<FlightDataBody>();
else
dataBodies.Clear();
foreach (ConfigNode bodyNode in node.GetNodes("bodyData"))
{
FlightDataBody body = new FlightDataBody();
body.Load(bodyNode);
dataBodies.Add(body);
}
}
}
示例3: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (node.HasNode("RENAME") || node.HasNode("DISABLE"))
{
configNodeData = node.ToString();
}
}
示例4: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (node.HasNode("TEXTURESET"))
{
configNodeData = node.ToString();
}
initialize();
}
示例5: OnLoad
public override void OnLoad(ConfigNode node)
{
if (configString == null) {
configString = node.ToString ();
} else {
node = ConfigNode.Parse (configString).GetNode ("MODULE");
}
CreateSwitchInfos (node);
}
示例6: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { configNodeData = node.ToString(); }
if (!loadedConfig)
{
loadedConfig = true;
loadConfigData(SSTUConfigNodeUtils.parseConfigNode(configNodeData));
}
}
示例7: OnLoad
public override void OnLoad(ConfigNode config)
{
if (this.configString == null)
{
this.configString = config.ToString();
}
config = Misc.Parse(configString).GetNode("MODULE");
resources = config.GetNodes("Resource").Select(n => new Resource(n)).ToList();
}
示例8: OnLoad
public override void OnLoad(ConfigNode node)
{
if (configString == null) {
configString = node.ToString ();
CreateNodeInfos (node);
} else {
ConfigNode n = ConfigNode.Parse (configString).GetNode("MODULE");
CreateNodeInfos (n);
LoadNodeInfos (node);
}
}
示例9: Load
/// <summary>
/// Loads the BehaviourFactory from the given ConfigNode.
/// </summary>
/// <param name="configNode">ConfigNode to load from</param>
/// <returns>Whether the load was successful</returns>
public virtual bool Load(ConfigNode configNode)
{
bool valid = true;
ConfigNodeUtil.SetCurrentDataNode(dataNode);
// Get name and type
valid &= ConfigNodeUtil.ParseValue<string>(configNode, "type", x => type = x, this);
valid &= ConfigNodeUtil.ParseValue<string>(configNode, "name", x => name = x, this, type);
// Load targetBody
valid &= ConfigNodeUtil.ParseValue<CelestialBody>(configNode, "targetBody", x => _targetBody = x, this, (CelestialBody)null);
config = configNode.ToString();
return valid;
}
示例10: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (node.HasNode("LOOK_CONST") || node.HasNode("POS_CONST"))
{
configNodeData = node.ToString();
}
if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
{
initialize();
}
else
{
initializePrefab();
}
}
示例11: Awake
internal override void Awake()
{
String FilePath = System.IO.Path.Combine(
System.Reflection.Assembly.GetExecutingAssembly().Location,
"Settings.cfg").Replace("\\", "/");
ConfigNode cnLoad = new ConfigNode();
cnLoad = ConfigNode.Load(FilePath);
ConfigNode.LoadObjectFromConfig(settings, cnLoad);
settings.TestString = "Hello again";
ConfigNode cnToPrint = new ConfigNode("settings");
cnToPrint= ConfigNode.CreateConfigFromObject(settings);
LogFormatted(cnToPrint.ToString());
cnToPrint.Save(FilePath);
}
示例12: Load
/// <summary>
/// Loads the ContractRequirement from the given ConfigNode. The base version loads the following:
/// - child nodes
/// - invertRequirement
/// </summary>
/// <param name="configNode">Config node to load from</param>
/// <returns>Whether the load was successful or not.</returns>
public virtual bool Load(ConfigNode configNode)
{
bool valid = true;
ConfigNodeUtil.SetCurrentDataNode(dataNode);
// Get name and type
valid &= ConfigNodeUtil.ParseValue<string>(configNode, "type", x => type = x, this);
valid &= ConfigNodeUtil.ParseValue<string>(configNode, "name", x => name = x, this, type);
if (!configNode.HasValue("targetBody"))
{
configNode.AddValue("targetBody", "@/targetBody");
}
valid &= ConfigNodeUtil.ParseValue<CelestialBody>(configNode, "targetBody", x => _targetBody = x, this, (CelestialBody)null);
// By default, do not check the requirement for active contracts
valid &= ConfigNodeUtil.ParseValue<bool>(configNode, "checkOnActiveContract", x => checkOnActiveContract = x, this, false);
// Load invertRequirement flag
valid &= ConfigNodeUtil.ParseValue<bool>(configNode, "invertRequirement", x => invertRequirement = x, this, false);
config = configNode.ToString();
return valid;
}
示例13: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (!HighLogic.LoadedSceneIsFlight && !HighLogic.LoadedSceneIsEditor)
{
mapLoaded = false;
}
if (node.HasNode("MOUNT"))
{
configNodeData = node.ToString();
}
initialize();
}
示例14: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
{
initialize();
}
else
{
configNodeString = node.ToString();
onPrefabLoad(node);//only occurs on database load (loading screen, reload on space-center screen)
}
}
示例15: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (string.IsNullOrEmpty(configNodeData)) { configNodeData = node.ToString(); }
init(false);
}