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


C# ConfigNode.GetValue方法代码示例

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


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

示例1: SelectVariable

        internal SelectVariable(ConfigNode node, RasterPropMonitorComputer rpmComp)
        {
            name = node.GetValue("name");

            foreach (ConfigNode sourceVarNode in node.GetNodes("VARIABLE_DEFINITION"))
            {
                bool reverseVal;
                VariableOrNumberRange vonr = ProcessSourceNode(sourceVarNode, rpmComp, out reverseVal);

                sourceVariables.Add(vonr);
                reverse.Add(reverseVal);

                VariableOrNumber val = rpmComp.InstantiateVariableOrNumber(sourceVarNode.GetValue("value"));
                result.Add(val);
            }

            if (node.HasValue("defaultValue"))
            {
                VariableOrNumber val = rpmComp.InstantiateVariableOrNumber(node.GetValue("defaultValue"));
                result.Add(val);
            }
            else
            {
                throw new Exception(string.Format("Select variable {0} is missing its defaultValue", name));
            }

            if (sourceVariables.Count == 0)
            {
                throw new ArgumentException("Did not find any VARIABLE_DEFINITION nodes in RPM_SELECT_VARIABLE", name);
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:RasterPropMonitor,代码行数:31,代码来源:SelectVariable.cs

示例2: Load

 public void Load(ConfigNode node)
 {
     if(node.HasValue("ConversionRate"))
         ConversionRate = float.Parse(node.GetValue("ConversionRate"));
     if(node.HasValue("ConsumptionRate"))
         ConsumptionRate = float.Parse(node.GetValue("ConsumptionRate"));
 }
开发者ID:kevin-ye,项目名称:hangar,代码行数:7,代码来源:HangarGenericInflatable.cs

示例3: MappedVariable

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

            sourceVariable = 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");
            }

            if (!float.TryParse(sources[0].Trim(), out sourceMin))
            {
                sourceMinStr = sources[0].Trim();
            }
            if (!float.TryParse(sources[1].Trim(), out sourceMax))
            {
                sourceMaxStr = sources[1].Trim();
            }

            mappedVariable = node.GetValue("mappedVariable");
            mappedRange = ConfigNode.ParseVector2(node.GetValue("mappedRange"));
        }
开发者ID:Tahvohck,项目名称:RasterPropMonitor,代码行数:27,代码来源:MappedVariable.cs

示例4: KIS_Item

 /// <summary>Creates a new part from save.</summary>
 public KIS_Item(AvailablePart availablePart, ConfigNode itemNode, ModuleKISInventory inventory,
           float quantity = 1)
 {
     // Get part node
     this.availablePart = availablePart;
     partNode = new ConfigNode();
     itemNode.GetNode("PART").CopyTo(partNode);
     // init config
     this.InitConfig(availablePart, inventory, quantity);
     // Get mass
     if (itemNode.HasValue("resourceMass")) {
       resourceMass = float.Parse(itemNode.GetValue("resourceMass"));
     } else {
       resourceMass = availablePart.partPrefab.GetResourceMass();
     }
     if (itemNode.HasValue("contentMass")) {
       contentMass = float.Parse(itemNode.GetValue("contentMass"));
     }
     if (itemNode.HasValue("contentCost")) {
       contentCost = float.Parse(itemNode.GetValue("contentCost"));
     }
     if (itemNode.HasValue("inventoryName")) {
       inventoryName = itemNode.GetValue("inventoryName");
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:KIS,代码行数:26,代码来源:KIS_Item.cs

示例5: SatSettingNode

        public SatSettingNode(ProtoPartModuleSnapshot s, Vessel v, ProtoPartSnapshot sn)
        {
            this.protoPartModule = s;
            this.vessel = v;
            this.snapshot = sn;
            isLoaded = false;

            ConfigNode n = new ConfigNode();
            protoPartModule.Save(n);

            if (n.HasValue("pointedAt"))
                this.pointedAt = new Target(n.GetValue("pointedAt"));
            else
                this.pointedAt = new Target();

            if (n.HasValue("dishRange"))
                this.dishRange = float.Parse(n.GetValue("dishRange"));
            else
                this.dishRange = 0;

            if (n.HasValue("antennaName"))
                this.antennaName = n.GetValue("antennaName");

            for (int i = 0; i < RTGlobals.targets.Count; i++)
            {
                if (pointedAt.Equals(RTGlobals.targets[i])) { selectedTarget = i; break; }
            }
        }
开发者ID:JDPKSP,项目名称:RemoteTechLegacy,代码行数:28,代码来源:SatSettings.cs

示例6: 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

示例7: Load

        /// <summary>
        /// Load the saved CancelCommand and find the element to cancel, based on the saved queue position
        /// </summary>
        /// <returns>true - loaded successfull</returns>
        public override bool Load(ConfigNode n, FlightComputer computer)
        {
            if(base.Load(n, computer))
            {
                if (n.HasValue("CancelCmdGuid"))
                {
                    this.CancelCmdGuid = new Guid(n.GetValue("CancelCmdGuid"));
                }

                // old way to cancel a command
                if (n.HasValue("queueIndex"))
                {
                    try
                    {
                        int queueIndex = int.Parse(n.GetValue("queueIndex"));
                        // try to find the command to cancel
                        this.CancelCmdGuid = computer.QueuedCommands.ElementAt(queueIndex).CmdGuid;
                    }
                    catch (Exception)
                    { }
                }

                // loaded successfull
                if (this.CancelCmdGuid != Guid.Empty)
                    return true;
            }
            return false;
        }
开发者ID:RemoteTechnologiesGroup,项目名称:RemoteTech,代码行数:32,代码来源:CancelCommand.cs

示例8: Awake

        public void Awake()
        {
            //            Debug.Log("********************************************************************" + HighLogic.LoadedScene + "*********************************************************************");
            settings = ConfigNode.Load("GameData/CustomerSatisfactionProgram/Config.cfg");

            if (settings.HasNode("SETTINGS")) {
                Debug.Log("Loading Settings");
                settings = settings.GetNode("SETTINGS");

                if (settings.HasValue("VERSION")) {
                    version = (settings.GetValue("VERSION"));
                }
                if (settings.HasValue("CAP")) {
                    cap = (int.Parse(settings.GetValue("CAP")));
                }
                if (settings.HasValue("CLEANUP")) {
                    cleanup = (int.Parse(settings.GetValue("CLEANUP")));
                    if (cleanup == 2) {
                        settings.AddValue("CLEANUP", 0);
                    }
                }
            }

            GameEvents.onKerbalRemoved.Add(OnKerbalRemoved);
            GameEvents.onKerbalAdded.Add(OnKerbalAdded);
            GameEvents.onKerbalTypeChange.Add(OnKerbalTypeChange);
            GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequested);
        }
开发者ID:SpareToast,项目名称:CustomerSatisfactionProgram,代码行数:28,代码来源:CustomerManager.cs

示例9: BitmapFont

        public BitmapFont(ConfigNode node, string nodeUrl)
        {
            id = node.GetValue("id");
            name = node.GetValue("name");
            displayName = node.GetValue("displayName");
            size = int.Parse(node.GetValue("size"));

            UnityEngine.Texture2D texture = Utils.LoadTexture("GameData/" + nodeUrl + ".pngmap", false);

            characterMap = new Dictionary<char, BitmapChar>();
            float h = 0;
            foreach(ConfigNode n in node.GetNodes("ASP_BITMAP_CHAR"))
            {
                BitmapChar cMap = new BitmapChar(n, texture);

                characterMap[cMap.character] = cMap;

                // vh is -ve
                if (cMap.vh < height) h = cMap.vh;
            }

            height = (int) Math.Abs(h);

            UnityEngine.Object.Destroy(texture);
        }
开发者ID:panteras1000,项目名称:TheWriteStuff,代码行数:25,代码来源:BitmapFont.cs

示例10: ReactorFuel

 public ReactorFuel(ConfigNode node) 
 {
     _fuel_name = node.GetValue("FuelName");
     _fuel_usege_per_mw = Convert.ToDouble(node.GetValue("UsagePerMW"));
     _unit = node.GetValue("Unit");
     _density = PartResourceLibrary.Instance.GetDefinition(_fuel_name).density;
 }
开发者ID:Yitscar,项目名称:KSPInterstellar,代码行数:7,代码来源:ReactorFuel.cs

示例11: OnLoad

        /// <summary>
        /// Loads any additional fields not loaded automatically.
        /// </summary>
        /// <param name="node">The config node for this module.</param>
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            if (node.HasValue("chanceToFailPerfect")) { chanceToFailPerfect = double.Parse(node.GetValue("chanceToFailPerfect")); }
            if (node.HasValue("chanceToFailTerrible")) { chanceToFailTerrible = double.Parse(node.GetValue("chanceToFailTerrible")); }
        }
开发者ID:panarchist,项目名称:KerbalMechanics,代码行数:11,代码来源:ModuleReliabilityInstrument.cs

示例12: 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

示例13: ProtoAntenna

        public ProtoAntenna(Vessel v, ProtoPartSnapshot p, ProtoPartModuleSnapshot ppms)
        {
            ConfigNode n = new ConfigNode();
            ppms.Save(n);
            Name = p.partInfo.title;
            try {
                mTarget = new Guid(n.GetValue("RTAntennaTarget"));
                DishRange = Single.Parse(n.GetValue("RTDishRange"));
                DishFactor = Double.Parse(n.GetValue("RTDishFactor"));
                OmniRange = Single.Parse(n.GetValue("RTOmniRange"));
            }
            catch (ArgumentException) {
                mTarget = Guid.Empty;
                DishRange = 0.0f;
                DishFactor = 1.0f;
                OmniRange = 0.0f;
                RTUtil.Log("ProtoAntenna parsing error. Default values assumed.");
            }

            mProtoPart = p;
            mProtoModule = ppms;
            Vessel = v;
            RTUtil.Log("ProtoAntenna: DishRange: {0}, OmniRange: {1}, Name: {2}, DishTarget: {3})",
                DishRange, OmniRange, Vessel.vesselName, DishTarget);
        }
开发者ID:Guardian259,项目名称:RemoteTechExtended,代码行数:25,代码来源:ProtoAntenna.cs

示例14: 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

示例15: Beacon

 public Beacon(ConfigNode node)
 {
     name = node.GetValue("name");
     double.TryParse(node.GetValue("latitude"), out latitude);
     double.TryParse(node.GetValue("longitude"), out longitude);
     double.TryParse(node.GetValue("range"), out range);
 }
开发者ID:magico13,项目名称:NIMBY,代码行数:7,代码来源:Beacon.cs


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