Exemple #1
0
        private static void SetSimpleAttribute(AttributeSet attributeSet, SetParameterGroup setParameterGroup)
        {
            ArrayList attributeValuesAsStrings = new ArrayList();
            bool      validStringValues        = true;

            foreach (Object parameter in setParameterGroup.values)
            {
                if (parameter is ValidValues)
                {
                    ValidValues validValues = parameter as ValidValues;

                    for (int valueIndex = 1; valueIndex <= validValues.Count; valueIndex++)
                    {
                        attributeValuesAsStrings.Add(validValues.GetString(valueIndex));
                    }
                }
                else if (parameter is InvalidValues)
                {
                    InvalidValues invalidValues = parameter as InvalidValues;
                    // InterfaceLogging.WriteError("Setting an attribute with tag " + setParameterGroup.tagAsString + " fails because one of the supplied values is from a non-existing attribute with tag " + invalidValues.TagSequence);
                    validStringValues = false;
                    break;
                }
                else
                {
                    attributeValuesAsStrings.Add(parameter.ToString());
                }
            }

            if (validStringValues)
            {
                ValidAttribute validAttribute = new ValidAttribute(setParameterGroup.tagAsUInt32, setParameterGroup.vR, attributeValuesAsStrings.ToArray());
                attributeSet.Set(validAttribute);
            }
        }
Exemple #2
0
        /// <summary>
        /// Check if the supplied values are equal to the content of this object.
        /// </summary>
        /// <param name="values">Values to compare with.</param>
        /// <returns>Boolean indicating if the Values are equal.</returns>
        public override bool EqualTo(Values values)
        {
            // Start Interface logging.
            // InterfaceLogging.Start(this, values);

            bool equalTo = true;

            if (values is InvalidValues)
            {
                InvalidValues invalidValues = values as InvalidValues;
                // InterfaceLogging.WriteError("the values to compare with are from a non-existing attribute with tag sequence" + invalidValues.TagSequence + ".\r\nReturning false.");
                equalTo = false;
            }
            else if (values is ValidValues)
            {
                ValidValues validValues = values as ValidValues;

                if (Count == validValues.Count)
                {
                    for (int index = 1; index <= Count; index++)
                    {
                        if (GetString(index) != validValues.GetString(index))
                        {
                            equalTo = false;
                            break;
                        }
                    }
                }
                else
                {
                    equalTo = false;
                }
            }
            else
            {
                // InterfaceLogging.WriteError("This type of Values descendant object not expected.\r\n Returning false.");
                equalTo = false;
            }

            // End Interface logging.
            // InterfaceLogging.End(equalTo);

            return(equalTo);
        }