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


C# ConfigNode.SetNode方法代码示例

本文整理汇总了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);
        }
开发者ID:Kerbas-ad-astra,项目名称:WasdEditorCameraContinued,代码行数:79,代码来源:gui.cs

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

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

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

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

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


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