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


C# ConfigNode.ToString方法代码示例

本文整理汇总了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]);
        }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:26,代码来源:SSTUNodeUtils.cs

示例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);
                }
            }
        }
开发者ID:Corax,项目名称:TestFlight,代码行数:28,代码来源:FlightDataConfig+(copy).cs

示例3: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasNode("RENAME") || node.HasNode("DISABLE"))
     {
         configNodeData = node.ToString();
     }
 }
开发者ID:Joshg213,项目名称:SSTULabs,代码行数:8,代码来源:SSTUEventRename.cs

示例4: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasNode("TEXTURESET"))
     {
         configNodeData = node.ToString();
     }
     initialize();
 }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:9,代码来源:SSTUTextureSwitch.cs

示例5: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     if (configString == null) {
         configString = node.ToString ();
     } else {
         node = ConfigNode.Parse (configString).GetNode ("MODULE");
     }
     CreateSwitchInfos (node);
 }
开发者ID:taniwha,项目名称:DynamicIVA,代码行数:9,代码来源:PartModelSwitch.cs

示例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));
     }
 }
开发者ID:Joshg213,项目名称:SSTULabs,代码行数:10,代码来源:SSTUPartModuleConfigEnabled.cs

示例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();
        }
开发者ID:kjoenth,项目名称:Kethane,代码行数:10,代码来源:KethaneExtractor.cs

示例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);
     }
 }
开发者ID:taniwha,项目名称:DynamicIVA,代码行数:11,代码来源:NodeChecker.cs

示例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;
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:20,代码来源:BehaviourFactory.cs

示例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();
     }
 }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:16,代码来源:SSTUModelConstraint.cs

示例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);
        }
开发者ID:Kerbas-ad-astra,项目名称:KSPPluginFramework,代码行数:18,代码来源:ComparisonExample.cs

示例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;
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:31,代码来源:ContractRequirement.cs

示例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();
 }
开发者ID:Joshg213,项目名称:SSTULabs,代码行数:13,代码来源:SSTUEngineCluster.cs

示例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)
     }
 }
开发者ID:Joshg213,项目名称:SSTULabs,代码行数:13,代码来源:SSTUMeshSwitch.cs

示例15: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (string.IsNullOrEmpty(configNodeData)) { configNodeData = node.ToString(); }
     init(false);
 }
开发者ID:shadowmage45,项目名称:SSTULabs,代码行数:6,代码来源:SSTUModularStationCore.cs


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