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


C# ConfigNode.ClearData方法代码示例

本文整理汇总了C#中ConfigNode.ClearData方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.ClearData方法的具体用法?C# ConfigNode.ClearData怎么用?C# ConfigNode.ClearData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigNode的用法示例。


在下文中一共展示了ConfigNode.ClearData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RealChuteSettings

 /// <summary>
 /// Loads the RealChute_Settings config to memory
 /// </summary>
 public RealChuteSettings()
 {
     ConfigNode node = new ConfigNode(), settings = new ConfigNode("REALCHUTE_SETTINGS");
     Debug.Log("[RealChute]: Loading settings file.");
     if (!System.IO.File.Exists(RCUtils.settingsURL))
     {
         Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing component. Creating new version.");
         settings.AddValue("autoArm", autoArm);
         settings.AddValue("jokeActivated", jokeActivated);
         node.AddNode(settings);
         node.Save(RCUtils.settingsURL);
     }
     else
     {
         node = ConfigNode.Load(RCUtils.settingsURL);
         node.TryGetNode("REALCHUTE_SETTINGS", ref settings);
         bool missing = false;
         if (!settings.TryGetValue("autoArm", ref _autoArm)) { missing = true; }
         if (!settings.TryGetValue("jokeActivated", ref _jokeActivated)) { missing = true; }
         if (missing)
         {
             Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing component. Fixing settings file.");
             settings.ClearValues();
             settings.AddValue("autoArm", autoArm);
             settings.AddValue("jokeActivated", jokeActivated);
             node.ClearData();
             node.AddNode(settings);
             node.Save(RCUtils.settingsURL);
         }
     }
 }
开发者ID:vosechu,项目名称:RealChute,代码行数:34,代码来源:RealChuteSettings.cs

示例2: RealChuteSettings

        /// <summary>
        /// Loads the RealChute_Settings config to memory
        /// </summary>
        public RealChuteSettings()
        {
            ConfigNode node = new ConfigNode(), settings = new ConfigNode("REALCHUTE_SETTINGS");
            Debug.Log("[RealChute]: Loading settings file.");
            if (!File.Exists(RCUtils.settingsURL))
            {
                Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing. Creating new.");
                settings.AddValue("autoArm", autoArm);
                settings.AddValue("jokeActivated", jokeActivated);
                settings.AddValue("hideIcon", hideIcon);
                node.AddNode(settings);
                node.Save(RCUtils.settingsURL);
            }
            else
            {
                node = ConfigNode.Load(RCUtils.settingsURL);
                if (!node.TryGetNode("REALCHUTE_SETTINGS", ref settings)) { goto missing; }
                if (!settings.TryGetValue("autoArm", ref _autoArm)) { goto missing; }
                if (!settings.TryGetValue("jokeActivated", ref _jokeActivated)) { goto missing; }
                if (settings.TryGetValue("hideIcon", ref _hideIcon)) { goto missing; }
                return;

                missing:
                {
                    Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing component. Fixing settings file.");
                    settings.ClearValues();
                    settings.AddValue("autoArm", autoArm);
                    settings.AddValue("jokeActivated", jokeActivated);
                    settings.AddValue("hideIcon", hideIcon);
                    node.ClearData();
                    node.AddNode(settings);
                    node.Save(RCUtils.settingsURL);
                }
            }
        }
开发者ID:kevin-ye,项目名称:RealChute,代码行数:38,代码来源:RealChuteSettings.cs


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