示例#1
0
        /// <inheritdoc />
        public override sealed bool ExecuteCommand(String args)
        {
            int    index = args.IndexOf('=');
            String dots  = args.Substring(0, (index) - (0)).Trim();
            String v     = args.Substring(index + 1).Trim();

            PropertyEntry entry = PropertyConstraints.Instance
                                  .FindEntry(dots);

            if (entry == null)
            {
                throw new AnalystError("Unknown property: " + args.ToUpper());
            }

            // strip quotes
            if (v[0] == '\"')
            {
                v = v.Substring(1);
            }
            if (v.EndsWith("\""))
            {
                v = v.Substring(0, (v.Length - 1) - (0));
            }

            String[] cols       = dots.Split('.');
            String   section    = cols[0];
            String   subSection = cols[1];
            String   name       = cols[2];

            entry.Validate(section, subSection, name, v);
            Prop.SetProperty(entry.Key, v);

            return(false);
        }
示例#2
0
        /// <summary>
        ///     Validate a property.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="subSection">The sub section.</param>
        /// <param name="name">The name of the property.</param>
        /// <param name="value_ren">The new value for the property.</param>
        private void ValidateProperty(String section,
                                      String subSection, String name, String value_ren)
        {
            PropertyEntry entry = PropertyConstraints.Instance.GetEntry(
                section, subSection, name);

            if (entry == null)
            {
                throw new AnalystError("Unknown property: "
                                       + PropertyEntry.DotForm(section, subSection, name));
            }
            entry.Validate(section, subSection, name, value_ren);
        }