Пример #1
0
        /// <summary>
        /// Creates a string from an edge event.
        /// </summary>
        /// <param name="evt">The edge event to serialize.</param>
        /// <param name="eventType">CEP event type.</param>
        /// <param name="delimiter">Delimiter between event fields.</param>
        /// <returns>Serialized event.</returns>
        public static string CreateLineFromEvent(EdgeEvent evt, CepEventType eventType, char delimiter)
        {
            StringBuilder builder = new StringBuilder();

            if (EventKind.Cti == evt.EventKind)
            {
                builder
                    .Append("CTI")
                    .Append(delimiter)
                    .Append(evt.StartTime.ToString());
            }
            else
            {
                builder
                    .Append("INSERT")
                    .Append(delimiter)
                    .Append(evt.EdgeType.ToString())
                    .Append(delimiter)
                    .Append(evt.StartTime.ToString())
                    .Append(delimiter)
                    .Append((EdgeType.End == evt.EdgeType) ? evt.EndTime.ToString() : string.Empty)
                    .Append(delimiter);

                SerializePayload(evt, eventType, delimiter, ref builder);
            }

            return builder.ToString();
        }