Пример #1
0
        XAttributeList Assign(IXAttributable element, XAttributeList definedAttribute)
        {
            XAttributeList attr = (XAttributeList)definedAttribute.Clone();

            element.GetAttributes().Add(definedAttribute.Key, attr);
            return(attr);
        }
Пример #2
0
 private void dlgAttributes_Load(object sender, EventArgs e)
 {
     if (_InputAttributes == null)
     {
         _InputAttributes = new XAttributeList();
     }
     dgvAttributes.Rows.Clear();
     foreach (DomAttribute item in _InputAttributes)
     {
         int index = dgvAttributes.Rows.Add(item.Name, item.Value, "...");
     }
 }
Пример #3
0
        XAttributeLiteral AssignToValues(XAttributeList list, XAttribute definedAttribute, string value)
        {
            if (value != null)
            {
                XAttributeLiteral attr = (XAttributeLiteral)definedAttribute.Clone();

                attr.Value = value;
                list.AddToCollection(attr);

                return(attr);
            }
            return(null);
        }
Пример #4
0
 public XAttributeLiteral addParamValue(XAttributeList attribute, string paramValue)
 {
     return(AssignToValues(attribute, ATTR_PARAM_VALUE, paramValue));
 }
Пример #5
-1
        /// <summary>
        /// Composes the appropriate attribute type from the string-based information
        /// found, e.g., in XML serializations.
        /// </summary>
        /// <returns>An appropriate attribute.</returns>
        /// <param name="factory">Factory to use for creating the attribute.</param>
        /// <param name="key">Key of the attribute.</param>
        /// <param name="value">Value of the attribute.</param>
        /// <param name="type">Type string of the attribute.</param>
        /// <param name="extension">Extension of the attribute (can be <code>null</code>).</param>
        public static XAttribute ComposeAttribute(IXFactory factory, string key, string value, string type,
                                                  XExtension extension)
        {
            type = type.Trim();
            if (type.Equals("LIST", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeList attr = factory.CreateAttributeList(key, extension);
                return(attr);
            }
            if (type.Equals("CONTAINER", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeContainer attr = factory.CreateAttributeContainer(key, extension);
                return(attr);
            }
            if (type.Equals("LITERAL", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeLiteral attr = factory.CreateAttributeLiteral(key, value, extension);

                return(attr);
            }
            if (type.Equals("BOOLEAN", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeBoolean attr = factory.CreateAttributeBoolean(key, bool.Parse(value), extension);

                return(attr);
            }
            if (type.Equals("CONTINUOUS", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeContinuous attr = factory.CreateAttributeContinuous(key, double.Parse(value), extension);

                return(attr);
            }
            if (type.Equals("DISCRETE", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeDiscrete attr = factory.CreateAttributeDiscrete(key, long.Parse(value), extension);

                return(attr);
            }
            if (type.Equals("TIMESTAMP", StringComparison.CurrentCultureIgnoreCase))
            {
                IXAttributeTimestamp attr;
                try
                {
                    attr = factory.CreateAttributeTimestamp(key, DateTime.Parse(value), extension);
                }
                catch (FormatException)
                {
                    throw new InvalidOperationException("OpenXES: could not parse date-time attribute. Value: " + value);
                }

                return((XAttributeTimestamp)attr);
            }
            if (type.Equals("ID", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeID attr = factory.CreateAttributeID(key, XID.Parse(value), extension);
                return(attr);
            }
            throw new InvalidOperationException("OpenXES: could not parse attribute type!");
        }