• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ConfigNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ConfigObjectNode

        internal ConfigObjectNode(dynamic n, KeyType key, ConfigNode parent)
            : base(key, parent)
        {
            _children = new Dictionary<string, ConfigNode>();

            var expando = n as IDictionary<string, object>;
            foreach (var kvp in expando)
            {
                ConfigNode valueNode;
                var newKey = new StringKey(kvp.Key);

                if (kvp.Value is ExpandoObject)
                {
                    valueNode = ConfigNodeFactory.CreateConfigObjectNode(kvp.Value, newKey, this);
                }
                else if (kvp.Value is IList<object>)
                {
                    valueNode = ConfigNodeFactory.CreateConfigListNode(kvp.Value, newKey, this);
                }
                else
                {
                    valueNode = ConfigNodeFactory.CreateConfigLeafNode(kvp.Value, newKey, this);
                }

                _children.Add(kvp.Key, valueNode);
            }
        }
开发者ID:yikliu,项目名称:DynamicConfig,代码行数:27,代码来源:ConfigObjectNode.cs


示例2: OnSave

        public override void OnSave(ConfigNode node)
        {
            PluginConfiguration config = PluginConfiguration.CreateForType<AntennaPrototype>();

            config.SetValue("Window Position", windowPosition);
            config.save();
        }
开发者ID:Skoth,项目名称:KSPCommEngr,代码行数:7,代码来源:RCSPrototype.cs


示例3: saveText

 public void saveText(ConfigNode node)
 {
     saveMonoOverlay(node);
     node.AddValue("text", _text);
     node.AddValue("fontName", _fontName);
     node.AddValue("fontSize", _fontSize);
 }
开发者ID:panteras1000,项目名称:TheWriteStuff,代码行数:7,代码来源:IM_Text.cs


示例4: Load

        public static Layout Load(string name, ConfigNode node)
        {
            try
            {
                var layout = new Layout(name);

                foreach (var child in node.GetNodes())
                {
                    IElement element = Element.Create(child.name);

                    if (element != null)
                    {
                        element.Load(child);
                        layout.AddElement(element);
                    }
                    else
                    {
                        Historian.Print("Failed to load layout element of type '{0}'.", child.name);
                    }
                }

                return layout;
            }
            catch
            {
                Historian.Print("Failed to load layout '{0}'.", name);
            }

            return Empty;
        }
开发者ID:linuxgurugamer,项目名称:Historian,代码行数:30,代码来源:Layout.cs


示例5: ResourceInfo

 public ResourceInfo(ConfigNode node)
 {
     node.TryGetValue("name", ref this.name);
     resource = PartResourceLibrary.Instance.GetDefinition(this.Name);
     node.TryGetValue("realName", ref this.realName);
     node.TryGetValue("colour", ref this.colour);
 }
开发者ID:CYBUTEK,项目名称:KRES,代码行数:7,代码来源:ResourceInfoLibrary.cs


示例6: HandleSettings

    public void HandleSettings()
    {
        if (!File.Exists<KineTechAnimationModuleLoader>(SETTINGS_FILE_NAME))
        {
            ConfigNode node = new ConfigNode();
            node.AddValue("DumpDocumentationOnStartup", false);
            node.Save(IOUtils.GetFilePathFor(typeof(KineTechAnimationModuleLoader), SETTINGS_FILE_NAME));
        }

        if (File.Exists<KineTechAnimationModuleLoader>(SETTINGS_FILE_NAME))
        {
            ConfigNode node = ConfigNode.Load(
                IOUtils.GetFilePathFor(typeof(KineTechAnimationModuleLoader), SETTINGS_FILE_NAME));

            if(node == null)
                return;

            //Dump Documentation
            if(node.HasValue("DumpDocumentationOnStartup"))
            {
                bool working = false;
                if(bool.TryParse(node.GetValue("DumpDocumentationOnStartup"), out working))
                {
                    GameObject dumperObject = new GameObject("Kine-Tech Animation - ConfigDocumentationGenerator");
                    dumperObject.AddComponent<KConfigDocumentationGenerator>();
                    GameObject.DontDestroyOnLoad(dumperObject);
                }
            }

        }
    }
开发者ID:KineMorto,项目名称:KineTechAnimationLibrary,代码行数:31,代码来源:KineTechAnimationModuleLoader.cs


示例7: Configure

        public void Configure(ConfigNode node)
        {
            ConfigNode[] pages = node.GetNodes("PAGE_DEFINITION");

            if (pages != null && pages.Length > 0)
            {
                definitions = new PageDefinition[pages.Length];

                for (int i = 0; i < pages.Length; ++i)
                {
                    string variableName = pages[i].GetValue("variableName");
                    string range = pages[i].GetValue("range");
                    string page = pages[i].GetValue("page");
                    if (string.IsNullOrEmpty(variableName) || string.IsNullOrEmpty(range) || string.IsNullOrEmpty(page))
                    {
                        JUtil.LogErrorMessage(this, "Incorrect page definition for page {0}", i);
                        definitions = null;
                        if (string.IsNullOrEmpty(definitionIn))
                        {
                            // Make sure we aren't crashing later.
                            definitionIn = definitionOut;
                        }
                        return;
                    }
                    definitions[i] = new PageDefinition(variableName, range, page);
                }
            }
        }
开发者ID:ndevenish,项目名称:RasterPropMonitor,代码行数:28,代码来源:JSIVariablePageTextSwitcher.cs


示例8: LoadItems

 internal IEnumerator<YieldInstruction> LoadItems(ConfigNode settings, System.Random random)
 {
     foreach (string type in KRESUtils.types.Values)
     {
         if (KRESUtils.GetRelevantBodies(type).Any(b => b.bodyName == this.Name))
         {
             foreach (ConfigNode data in settings.GetNode(type).GetNode(this.Name).GetNodes("KRES_DATA"))
             {
                 string resourceName = string.Empty;
                 data.TryGetValue("name", ref resourceName);
                 if (!PartResourceLibrary.Instance.resourceDefinitions.Contains(resourceName)) { continue; }
                 if (type == "ore")
                 {
                     string path = Path.Combine(KRESUtils.GetSavePath(), "KRESTextures/" + name + "/" + resourceName + ".png");
                     if (File.Exists(path))
                     {
                         ResourceItem item = new ResourceItem(data, resourceName, this.Name, random);
                         resourceItems.Add(item);
                     }
                 }
                 else if (type == "gas" || type == "liquid")
                 {
                     ResourceItem item = new ResourceItem(data, resourceName, this.Name, type, random);
                     resourceItems.Add(item);
                 }
                 yield return null;
             }
         }
     }
 }
开发者ID:CYBUTEK,项目名称:KRES,代码行数:30,代码来源:ResourceBody.cs


示例9: OnLoad

 protected override void OnLoad(ConfigNode node)
 {
     if (node.HasValue("FIELD"))
     {
         matchFields.AddRange(node.GetValues("FIELD"));
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:TarsierSpaceTechnology,代码行数:7,代码来源:TSTScienceParam.cs


示例10: OnSave

        public override void OnSave(ConfigNode node)
        {
            PluginConfiguration config = PluginConfiguration.CreateForType<PluginTutorial>();

            config.SetValue("Window Position", _windowPosition);
            config.save();
        }
开发者ID:Kerbal007,项目名称:PluginTutorial,代码行数:7,代码来源:PluginTutorial.cs


示例11: saveMonoOverlay

 protected void saveMonoOverlay(ConfigNode node)
 {
     saveOverlay(node);
     node.AddValue("red", _red);
     node.AddValue("green", _green);
     node.AddValue("blue", _blue);
 }
开发者ID:panteras1000,项目名称:TheWriteStuff,代码行数:7,代码来源:IM_MonoOverlay.cs


示例12: OnLoad

        private GUIStyle _windowStyle, _labelStyle; // Setup Gui Style

        #endregion Fields

        #region Methods

        public override void OnLoad(ConfigNode node)
        {
            PluginConfiguration config = PluginConfiguration.CreateForType<PluginTutorial>();

            config.load();
            _windowPosition = config.GetValue<Rect>("Window Position");
        }
开发者ID:Kerbal007,项目名称:PluginTutorial,代码行数:13,代码来源:PluginTutorial.cs


示例13: MaterialDefinition

 /// <summary>
 /// Creates a material definition from a config node
 /// </summary>
 /// <param name="node">Node to initiate the material from</param>
 public MaterialDefinition(ConfigNode node)
 {
     node.TryGetValue("name", ref _name);
     node.TryGetValue("description", ref _description);
     node.TryGetValue("areaDensity", ref _areaDensity);
     node.TryGetValue("dragCoefficient", ref _dragCoefficient);
 }
开发者ID:vosechu,项目名称:RealChute,代码行数:11,代码来源:MaterialDefinition.cs


示例14: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     //deprecated config conversion//
     ModuleConfig = node.HasValue("base_mass")? node : null;
     //****************************//
 }
开发者ID:pjslauta,项目名称:hangar,代码行数:7,代码来源:Hangar.cs


示例15: Save

 public void Save(ConfigNode node)
 {
     ConfigNode newNode = new ConfigNode("Resource");
     newNode.AddValue("name", resource.name);
     newNode.AddValue("ratio", ratio);
     node.AddNode(newNode);
 }
开发者ID:RichardDastardly,项目名称:pWingsMerged,代码行数:7,代码来源:WingTankResource.cs


示例16: OnSave

 protected override void OnSave(ConfigNode node)
 {
     foreach (string field in matchFields)
     {
         node.AddValue("FIELD", field);
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:TarsierSpaceTechnology,代码行数:7,代码来源:TSTScienceParam.cs


示例17: Save

        public void Save(ConfigNode node)
        {
            if (node.HasNode("KOLONIZATION"))
            {
                SettingsNode = node.GetNode("KOLONIZATION");
            }
            else
            {
                SettingsNode = node.AddNode("KOLONIZATION");
            }

            foreach (KolonizationEntry r in _LogInfo)
            {
                var rNode = new ConfigNode("KOLONY_ENTRY");
                rNode.AddValue("BodyIndex", r.BodyIndex);
                rNode.AddValue("VesselId", r.VesselId);
                rNode.AddValue("LastUpdate", r.LastUpdate);
                rNode.AddValue("KolonyDate", r.KolonyDate);
                rNode.AddValue("GeologyResearch", r.GeologyResearch);
                rNode.AddValue("BotanyResearch", r.BotanyResearch);
                rNode.AddValue("KolonizationResearch", r.KolonizationResearch);
                rNode.AddValue("Science", r.Science);
                rNode.AddValue("Rep", r.Rep);
                rNode.AddValue("Funds", r.Funds);
                SettingsNode.AddNode(rNode);
            }

            //Reset cache
            KolonizationManager.Instance.ResetCache();
        }
开发者ID:nanathan,项目名称:Kolonization,代码行数:30,代码来源:KolonizationPersistance.cs


示例18: TextureConfig

        /// <summary>
        /// Initiates all the texture and model nodes in this model config
        /// </summary>
        public TextureConfig(ConfigNode node)
        {
            node.TryGetValue("name", ref _name);
            foreach(ConfigNode cfg in node.nodes)
            {
                if (cfg.name == "CASE_TEXTURE")
                {
                    CaseConfig parachuteCase = new CaseConfig(cfg);
                    _cases.Add(parachuteCase);
                    continue;
                }

                if (cfg.name == "CANOPY_TEXTURE")
                {
                    CanopyConfig canopy = new CanopyConfig(cfg);
                    _canopies.Add(canopy);
                    continue;
                }

                if (cfg.name == "CANOPY_MODEL")
                {
                    ModelConfig model = new ModelConfig(cfg);
                    _models.Add(model);
                    continue;
                }
            }
            if (_cases.Count > 0) { _caseNames = _cases.Select(c => c.name).ToArray(); }
            if (_canopies.Count > 0) { _canopyNames = _canopies.Select(c => c.name).ToArray(); }
            if (_models.Count > 0) { _modelNames = _models.Select(m => m.name).ToArray(); }
        }
开发者ID:vosechu,项目名称:RealChute,代码行数:33,代码来源:TextureConfig.cs


示例19: Grid2DControler

 public Grid2DControler(int width, int height, int numberOfClasses, ConfigNode node)
     : base(width * height, numberOfClasses, node)
 {
     _width = width;
     _height = height;
     this.StructureBuilder = new DefaultGrid2DStructureBuilder(width, height, NumberOfClasses);
 }
开发者ID:sagarbatchu,项目名称:rssilocalizer,代码行数:7,代码来源:GridControler.cs


示例20: TextureConfig

 /// <summary>
 /// Initiates all the texture and model nodes in this model config
 /// </summary>
 public TextureConfig(ConfigNode node)
 {
     node.TryGetValue("name", ref _name);
     _cases = node.GetNodes("CASE_TEXTURE").Select(n => new CaseConfig(n)).ToDictionary(c => c, c => c.name);
     _canopies = node.GetNodes("CANOPY_TEXTURE").Select(n => new CanopyConfig(n)).ToDictionary(c => c, c => c.name);
     _models = node.GetNodes("CANOPY_MODEL").Select(n => new ModelConfig(n)).ToDictionary(m => m, m => m.name);
 }
开发者ID:kevin-ye,项目名称:RealChute,代码行数:10,代码来源:TextureConfig.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConfigSection类代码示例发布时间:2022-05-24
下一篇:
C# ConfigManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap