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

C# System.ConfigNode类代码示例

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

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



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

示例1: Load

        public override bool Load(ConfigNode configNode)
        {
            // Load base class
            bool valid = base.Load(configNode);

            if (configNode.HasValue("passengerName"))
            {
                LoggingUtil.LogWarning(this, "The passengerName and gender attributes are obsolete since Contract Configurator 1.9.0, use kerbal instead.");
                valid &= ConfigNodeUtil.ParseValue<List<string>>(configNode, "passengerName", x => passengerName = x, this, new List<string>());
                valid &= ConfigNodeUtil.ParseValue<ProtoCrewMember.Gender>(configNode, "gender", x => gender = x, this, Kerbal.RandomGender());
                valid &= ConfigNodeUtil.ParseValue<string>(configNode, "experienceTrait", x => experienceTrait = x, this, Kerbal.RandomExperienceTrait());

                legacy = true;
            }
            else
            {
                valid &= ConfigNodeUtil.ParseValue<List<Kerbal>>(configNode, "kerbal", x => kerbals = x, this, new List<Kerbal>());
                legacy = false;
            }

            valid &= ConfigNodeUtil.ParseValue<int>(configNode, "count", x => count = x, this, 1, x => Validation.GE(x, 1));
            valid &= ConfigNodeUtil.ParseValue<ProtoCrewMember.KerbalType>(configNode, "kerbalType", x => kerbalType = x, this, ProtoCrewMember.KerbalType.Tourist);

            return valid;
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:25,代码来源:SpawnPassengersFactory.cs


示例2: MappedVariable

        public MappedVariable(ConfigNode node, RasterPropMonitorComputer rpmComp)
        {
            if (!node.HasValue("mappedVariable") || !node.HasValue("mappedRange") || !node.HasValue("sourceVariable") || !node.HasValue("sourceRange"))
            {
                throw new ArgumentException("MappedVariable missing required values");
            }

            string sourceVariableStr = node.GetValue("sourceVariable");
            string sourceRange = node.GetValue("sourceRange");
            string[] sources = sourceRange.Split(',');
            if (sources.Length != 2)
            {
                throw new ArgumentException("MappedVariable sourceRange does not have exactly two values");
            }

            sourceVariable = new VariableOrNumberRange(rpmComp, sourceVariableStr, sources[0], sources[1]);

            mappedVariable = node.GetValue("mappedVariable");
            string[] destinations = node.GetValue("mappedRange").Split(',');
            if (destinations.Length != 2)
            {
                throw new ArgumentException("MappedVariable mappedRange does not have exactly two values");
            }
            mappedExtent1 = rpmComp.InstantiateVariableOrNumber(destinations[0]);
            mappedExtent2 = rpmComp.InstantiateVariableOrNumber(destinations[1]);
        }
开发者ID:Kerbas-ad-astra,项目名称:RasterPropMonitor,代码行数:26,代码来源:MappedVariable.cs


示例3: ScriptV1

        public ScriptV1()
        {
            exception_raised = false;

             tool = new ExternalApp();
             files_to_glue = new List<FileName>();
             replace_list = new Dictionary<string, string>();
             tools_blocks = new Dictionary<string, ConfigNode>();
             practices_block = null;

             tool_fillmatrix_info = null;
             tool_interpolate_info = null;
             tool_glue_info = null;
             tool_jointimeseries_info = null;

             meteo_block = null;
             meteo_sources_blocks = null;
             meteo_file_name = null;
             meteo_backup_files = false;
             meteo_store_path = null;
             meteo_backup_interpolated_files = false;
             meteo_store_int_path = null;
             meteo_interpolation_path = null;
             meteo_max_contiguous_skips = 8;
             meteo_task = false;
             tool_glue = new HDFGlue();

             standard_names = true;
        }
开发者ID:JauchOnGitHub,项目名称:csharptoolbox,代码行数:29,代码来源:Script.v1.cs


示例4: OnRedecorateModule

        public override void OnRedecorateModule(ConfigNode templateNode, bool payForRedecoration)
        {
            Log("OnRedecorateModule called");

            //Load the modules
            loadModulesFromTemplate(templateNode);
        }
开发者ID:ozraven,项目名称:WildBlueTools,代码行数:7,代码来源:WBIModuleSwitcher.cs


示例5: Save

 /// <summary>
 /// Save settings to the underlying storage
 /// </summary>
 public void Save()
 {
     ConfigNode node = AsConfigNode;
     var clsNode = new ConfigNode (GetType ().Name);
     clsNode.AddNode (node);
     clsNode.Save (filePath);
 }
开发者ID:602p,项目名称:krpc,代码行数:10,代码来源:ConfigurationStorage.cs


示例6: ChuteTemplate

 /// <summary>
 /// Creates a new ChuteTemplate from the given ProceduralChute
 /// </summary>
 /// <param name="pChute">Module to create the object from</param>
 /// <param name="node">ConfigNode to load the data from</param>
 /// <param name="id">Index of the ChuteTemplate</param>
 public ChuteTemplate(ProceduralChute pChute, ConfigNode node, int id)
 {
     this.pChute = pChute;
     this.id = id;
     this.templateGUI = new TemplateGUI(this);
     if (node != null) { Load(node); }
 }
开发者ID:pcwilcox,项目名称:RealChute,代码行数:13,代码来源:ChuteTemplate.cs


示例7: Load

        public void Load(ConfigNode node)
        {
            unlocked = false;

            node.TryGetValue("name", ref name);

            double cost = 0d;
            node.TryGetValue("cost", ref cost);

            node.TryGetValue("entryCost", ref entryCost);
            if(double.IsNaN(entryCost))
                entryCost = Math.Max(0d, cost * RFSettings.Instance.configEntryCostMultiplier);

            node.TryGetValue("sciEntryCost", ref sciEntryCost);
            if(double.IsNaN(sciEntryCost))
                sciEntryCost = Math.Max(0d, cost * RFSettings.Instance.configScienceCostMultiplier);

            node.TryGetValue("unlocked", ref unlocked);

            node.TryGetValue("techRequired", ref techRequired);

            if (node.HasNode("entryCostMultipliers"))
                LoadMultipliers(node.GetNode("entryCostMultipliers"));

            if (node.HasNode("entryCostSubtractors"))
                LoadSubtractors(node.GetNode("entryCostSubtractors"));

            node.TryGetValue("maxSubtraction", ref maxSubtraction);
        }
开发者ID:Kerbas-ad-astra,项目名称:ModularFuelSystem,代码行数:29,代码来源:EngineConfigUpgrade.cs


示例8: GetValueDefault

 public static string GetValueDefault(ConfigNode node, string name, string vale)
 {
     if (node.HasValue(name))
         vale = (node.GetValue(name));
     //else Debug.Log("*MCEPC key not found: " + name);
     return vale;
 }
开发者ID:jwvanderbeck,项目名称:KSPMissionController,代码行数:7,代码来源:Tools.cs


示例9: OnParameterLoad

 protected override void OnParameterLoad(ConfigNode node)
 {
     duration = Convert.ToDouble(node.GetValue("duration"));
     endTime = Convert.ToDouble(node.GetValue("endTime"));
     timerType = ConfigNodeUtil.ParseValue<TimerType>(node, "timerType", TimerType.CONTRACT_ACCEPTANCE);
     parameter = ConfigNodeUtil.ParseValue<string>(node, "parameter", "");
 }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:7,代码来源:Timer.cs


示例10: OnSave

 protected sealed override void OnSave(ConfigNode node)
 {
     try
     {
         if (Root != null)
         {
             node.AddValue("ContractIdentifier", Root.ToString());
         }
         node.AddValue("title", title ?? "");
         node.AddValue("notes", notes ?? "");
         node.AddValue("completedMessage", completedMessage ?? "");
         if (completeInSequence)
         {
             node.AddValue("completeInSequence", completeInSequence);
         }
         if (hidden)
         {
             node.AddValue("hidden", hidden);
         }
         if (hideChildren)
         {
             node.AddValue("hideChildren", hideChildren);
         }
         if (fakeFailures)
         {
             node.AddValue("fakeFailures", fakeFailures);
         }
         OnParameterSave(node);
     }
     catch (Exception e)
     {
         LoggingUtil.LogException(e);
         ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.PARAMETER_SAVE, e, Root.ToString(), ID);
     }
 }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:35,代码来源:ContractConfiguratorParameter.cs


示例11: Load

        public override bool Load(ConfigNode configNode)
        {
            // Load base class
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue<List<VesselIdentifier>>(configNode, "vessel", x => vessels = x, this, new List<VesselIdentifier>());
            valid &= ConfigNodeUtil.ParseValue<VesselIdentifier>(configNode, "defineDockedVessel", x => defineDockedVessel = x, this, (VesselIdentifier)null);

            // Validate using the config node instead of the list as it may undergo deferred loading
            if (parent is VesselParameterGroupFactory)
            {
                if (configNode.GetValues("vessel").Count() > 1)
                {
                    LoggingUtil.LogError(this, ErrorPrefix() + ": When used under a VesselParameterGroup, no more than one vessel may be specified for the Docking parameter.");
                    valid = false;
                }
            }
            else
            {
                if (configNode.GetValues("vessel").Count() == 0)
                {
                    LoggingUtil.LogError(this, ErrorPrefix() + ": Need at least one vessel specified for the Docking parameter.");
                    valid = false;
                }
                if (configNode.GetValues("vessel").Count() > 2)
                {
                    LoggingUtil.LogError(this, ErrorPrefix() + ": Cannot specify more than two vessels for the Docking parameter.");
                    valid = false;
                }
            }

            return valid;
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:33,代码来源:DockingFactory.cs


示例12: OnLoad

        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[] efficiencyNodes = node.GetNodes(kEfficiencyData);
            ConfigNode[] toolTipsShown = node.GetNodes(kToolTip);
            string value = node.GetValue("reputationIndex");

            if (string.IsNullOrEmpty(value) == false)
                reputationIndex = int.Parse(value);

            foreach (ConfigNode efficiencyNode in efficiencyNodes)
            {
                EfficiencyData efficiencyData = new EfficiencyData();
                efficiencyData.Load(efficiencyNode);
                efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
            }

            foreach (ConfigNode toolTipNode in toolTipsShown)
            {
                if (toolTipNode.HasValue("name") == false)
                    continue;
                value = toolTipNode.GetValue("name");

                if (toolTips.ContainsKey(value))
                    toolTips[value] = toolTipNode;
                else
                    toolTips.Add(value, toolTipNode);
            }
        }
开发者ID:PalverZ,项目名称:Pathfinder,代码行数:29,代码来源:WBIPathfinderScenario.cs


示例13: OnSave

        public override void OnSave(ConfigNode node)
        {
            base.OnSave(node);
            node.AddValue("selectedObject", selectedObject.ToString());

            node.AddValue("showGui", showGui.ToString());
        }
开发者ID:ozraven,项目名称:WildBlueTools,代码行数:7,代码来源:WBIMeshHelper.cs


示例14: OnLoadFromConfig

        protected override void OnLoadFromConfig(ConfigNode node)
        {
            base.OnLoadFromConfig(node);

            rewardFunds = ConfigNodeUtil.ParseValue<double>(node, "rewardFunds");
            explorationType = ConfigNodeUtil.ParseValue<ExplorationType>(node, "explorationType");
        }
开发者ID:jrossignol,项目名称:Strategia,代码行数:7,代码来源:ExplorationFundingEffect.cs


示例15: ToConfigNode

        public static ConfigNode ToConfigNode(this HarddiskFile file, string nodeName)
        {
            var node = new ConfigNode(nodeName);
            node.AddValue(FilenameValueString, file.Name);

            FileContent content = file.ReadAll();

            if (content.Category == FileCategory.KSM)
            {
                node.AddValue("binary", PersistenceUtilities.EncodeBase64(content.Bytes));
            }
            else if (content.Category == FileCategory.BINARY)
            {
                node.AddValue("binary", PersistenceUtilities.EncodeBase64(content.Bytes));
            }
            else
            {
                if (SafeHouse.Config.UseCompressedPersistence)
                {
                    node.AddValue("binary", EncodeBase64(content.String));
                }
                else
                {
                    node.AddValue("ascii", PersistenceUtilities.EncodeLine(content.String));
                }
            }
            return node;
        }
开发者ID:KSP-KOS,项目名称:KOS,代码行数:28,代码来源:PersistenceExtensions.cs


示例16: Load

        public override bool Load(ConfigNode configNode)
        {
            // Load base class
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue<Vessel.Situations>(configNode, "situation", x => situation = x, this, Vessel.Situations.ORBITING, ValidateSituations);
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minAltitude", x => minAltitude = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxAltitude", x => maxAltitude = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minApA", x => minApoapsis = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxApA", x => maxApoapsis = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minPeA", x => minPeriapsis = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxPeA", x => maxPeriapsis = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minEccentricity", x => minEccentricity = x, this, 0.0, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxEccentricity", x => maxEccentricity = x, this, double.MaxValue, x => Validation.GE(x, 0.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "minInclination", x => minInclination = x, this, 0.0, x => Validation.Between(x, 0.0, 180.0));
            valid &= ConfigNodeUtil.ParseValue<double>(configNode, "maxInclination", x => maxInclination = x, this, 180.0, x => Validation.Between(x, 0.0, 180.0));
            valid &= ConfigNodeUtil.ParseValue<Duration>(configNode, "minPeriod", x => minPeriod = x, this, new Duration(0.0));
            valid &= ConfigNodeUtil.ParseValue<Duration>(configNode, "maxPeriod", x => maxPeriod = x, this, new Duration(double.MaxValue));

            // Validate target body
            valid &= ValidateTargetBody(configNode);

            // Validation minimum and groupings
            valid &= ConfigNodeUtil.AtLeastOne(configNode, new string[] { "minAltitude", "maxAltitude", "minApA", "maxApA", "minPeA", "maxPeA",
                "minEccentricity", "maxEccentricity", "minInclination", "maxInclination", "minPeriod", "maxPeriod" }, this);
            valid &= ConfigNodeUtil.MutuallyExclusive(configNode, new string[] { "minAltitude", "maxAltitude" },
                new string[] { "minApA", "maxApA", "minPeA", "maxPeA" }, this);

            return valid;
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:30,代码来源:OrbitFactory.cs


示例17: Load

 internal static AlarmInfo Load(ConfigNode node)
 {
     Guid vesselID = Utilities.GetNodeValue(node, "vesselID");
     string Name = Utilities.GetNodeValue(node, "Name", string.Empty);
     AlarmInfo info = new AlarmInfo(Name, vesselID);
     info.AlarmType = Utilities.GetNodeValue(node, "AlarmType", KACWrapper.KACAPI.AlarmTypeEnum.Raw);
     info.Notes = Utilities.GetNodeValue(node, "Notes", string.Empty);
     info.AlarmTime = Utilities.GetNodeValue(node, "AlarmTime", 0d);
     info.AlarmMargin = Utilities.GetNodeValue(node, "AlarmMargin", 0d);
     info.AlarmExecute = Utilities.GetNodeValue(node, "AlarmExecute", false);
     string frzkbllst = Utilities.GetNodeValue(node, "FrzKerbals", string.Empty);
     string thwkbllst = Utilities.GetNodeValue(node, "ThwKerbals", string.Empty);
     string[] frzStrings = frzkbllst.Split(',');
     if (frzStrings.Length > 0)
     {
         for (int i = 0; i < frzStrings.Length; i++)
         {
             info.FrzKerbals.Add(frzStrings[i]);
         }
     }
     string[] thwStrings = thwkbllst.Split(',');
     if (thwStrings.Length > 0)
     {
         for (int i = 0; i < thwStrings.Length; i++)
         {
             if (thwStrings[i].Length > 0)
                 info.ThwKerbals.Add(thwStrings[i]);
         }
     }
     return info;
 }
开发者ID:khr15714n,项目名称:DeepFreeze,代码行数:31,代码来源:DFAlarmInfo.cs


示例18: CustomVariable

        public CustomVariable(ConfigNode node)
        {
            name = node.GetValue("name");

            foreach (ConfigNode sourceVarNode in node.GetNodes("SOURCE_VARIABLE")) {
                SourceVariable sourceVar = new SourceVariable(sourceVarNode);

                sourceVariables.Add(sourceVar);
            }

            if(sourceVariables.Count == 0) {
                throw new ArgumentException("Did not find any SOURCE_VARIABLE nodes in RPM_CUSTOM_VARIABLE", name);
            }

            string oper = node.GetValue("operator");
            if (oper == Operator.NONE.ToString()) {
                op = Operator.NONE;
            } else if (oper == Operator.AND.ToString()) {
                op = Operator.AND;
            } else if (oper == Operator.OR.ToString()) {
                op = Operator.OR;
            } else if (oper == Operator.XOR.ToString()) {
                op = Operator.XOR;
            } else {
                throw new ArgumentException("Found an invalid operator type in RPM_CUSTOM_VARIABLE", oper);
            }
        }
开发者ID:Tahvohck,项目名称:RasterPropMonitor,代码行数:27,代码来源:CustomVariable.cs


示例19: BodyDeposits

            public BodyDeposits(GeneratorConfiguration resource, ConfigNode node)
            {
                if (node == null) { node = new ConfigNode(); }

                this.deposits = new List<Deposit>();
                this.seed = Misc.Parse(node.GetValue("Seed"), seedGenerator.Next());

                var random = new System.Random(seed);

                for (int i = 0; i < resource.DepositCount; i++)
                {
                    float R = random.Range(resource.MinRadius, resource.MaxRadius);
                    for (int j = 0; j < resource.NumberOfTries; j++)
                    {
                        Vector2 Pos = new Vector2(random.Range(R, 360 - R), random.Range(R, 180 - R));
                        var deposit = Deposit.Generate(Pos, R, random, resource);
                        if (!deposits.Any(d => d.Shape.Vertices.Any(v => deposit.Shape.PointInPolygon(new Vector2(v.x, v.y)))) && !deposit.Shape.Vertices.Any(v => deposits.Any(d => d.Shape.PointInPolygon(new Vector2(v.x, v.y)))))
                        {
                            deposits.Add(deposit);
                            break;
                        }
                    }
                }

                var depositValues = node.GetValues("Deposit");
                for (int i = 0; i < Math.Min(deposits.Count, depositValues.Length); i++)
                {
                    deposits[i].Quantity = Misc.Parse(depositValues[i], deposits[i].InitialQuantity);
                }

                MaxQuantity = resource.MaxQuantity;
            }
开发者ID:Redjokernoise,项目名称:Kethane,代码行数:32,代码来源:LegacyResourceGenerator.cs


示例20: Load

 /// <summary>
 /// Load the saved TargetCommand. Open a new ITargetable object by
 /// the objects id.
 /// </summary>
 /// <param name="n">Node with the command infos</param>
 /// <param name="fc">Current flightcomputer</param>
 /// <returns>true - loaded successfull</returns>
 public override bool Load(ConfigNode n, FlightComputer fc)
 {
     if(base.Load(n, fc))
     {
         switch (TargetType)
         {
             case "Vessel":
                 {
                     Guid Vesselid = new Guid(TargetId);
                     Target = RTUtil.GetVesselById(Vesselid);
                     break;
                 }
             case "CelestialBody":
                 {
                     Target = FlightGlobals.Bodies.ElementAt(int.Parse(TargetId));
                     break;
                 }
             default:
                 {
                     Target = null;
                     break;
                 }
         }
         return true;
     }
     return false;
 }
开发者ID:icedown,项目名称:RemoteTech,代码行数:34,代码来源:TargetCommand.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# System.ConsoleCancelEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# System.Condition类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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