コード例 #1
0
        /// <summary>
        /// Generates xml element containing the settings.
        /// </summary>
        /// <param name="rootElemName">Name to be used as a name of the root element.</param>
        /// <param name="suppressDefaults">Specifies whether to ommit optional nodes having set default values</param>
        /// <returns>XElement containing the settings</returns>
        public override XElement GetXml(string rootElemName, bool suppressDefaults)
        {
            XElement rootElem = new XElement(rootElemName,
                                             FeedingCfg.GetXml(suppressDefaults),
                                             VaryingFieldsCfg.GetXml(suppressDefaults)
                                             );

            if (!suppressDefaults || !CoordinatesCfg.ContainsOnlyDefaults)
            {
                rootElem.Add(CoordinatesCfg.GetXml(suppressDefaults));
            }
            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }
コード例 #2
0
        //Methods
        /// <summary>
        /// Checks consistency
        /// </summary>
        protected override void Check()
        {
            //Uniqueness of all input field names
            if (FeedingCfg.FeedingType == InputEncoder.InputFeedingType.Patterned)
            {
                FeedingPatternedSettings patternedCfg = (FeedingPatternedSettings)FeedingCfg;
                if (patternedCfg.SteadyFieldsCfg != null)
                {
                    //There are steady fields defined
                    foreach (SteadyFieldSettings sf in patternedCfg.SteadyFieldsCfg.FieldCfgCollection)
                    {
                        if (VaryingFieldsCfg.GetFieldID(sf.Name, false) != -1)
                        {
                            throw new InvalidOperationException($"Steady field name {sf.Name} found among varying fields.");
                        }
                    }
                }
            }

            return;
        }