Ejemplo n.º 1
0
        /// <summary>
        /// Adds a parameter to this <see cref="BroEvent"/>.
        /// </summary>
        /// <param name="value">The <see cref="BroValue"/> to add to this <see cref="BroEvent"/>.</param>
        /// <returns><c>true</c> if operation was successful; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentNullException">Cannot add a <c>null</c> <see cref="BroValue"/>.</exception>
        /// <exception cref="ObjectDisposedException">Cannot add parameter, <see cref="BroEvent"/> is disposed.</exception>
        public bool AddParameter(BroValue value)
        {
            if ((object)value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (m_eventPtr.IsInvalid())
            {
                throw new ObjectDisposedException("Cannot add value, Bro event is disposed.");
            }

            if (value.ExecuteWithFixedPtr(ptr => BroApi.bro_event_add_val(m_eventPtr, value.Type, value.TypeName, ptr) == 0))
            {
                return(false);
            }

            m_parameters.Add(value);
            return(true);
        }