public override void Consume(object sender, GetEntityEventArgs args)
        {
            Entity entity = args.CurrentEntity;

            if (_Model != null)
            {
                entity.AddDefaultInfo(_Model);
            }

            string content = TemplateRegex.Replace(Template, (match) =>
            {
                object value = null;
                if (entity.TryGetValue(match.Groups[1].Value, out value))
                {
                    if (value != null)
                    {
                        return(value.ToString());
                    }
                }

                return(match.Value);
            });

            _Writer.WriteLine(content);
        }
Exemplo n.º 2
0
 protected void GetNewEntity(object sender, GetEntityEventArgs args)
 {
     if (SpiltColumns == null)
     {
         string content = args.CurrentEntity.GetValue <string>(Column);
         SpiltColumns = Regex.Split(content, Separator);
     }
 }
Exemplo n.º 3
0
        public override void Consume(object sender, GetEntityEventArgs args)
        {
            var currentEntity = args.CurrentEntity;

            currentEntity.ToStandradEntity(Model);

            object[] values = new object[Model.Columns.Length];
            for (int i = 0; i < Model.Columns.Length; ++i)
            {
                currentEntity.TryGetValue(Model.Columns[i], out values[i]);
            }

            _Writer.WriteLine(string.Join(Separator, values).Replace('\r', ' ').Replace('\n', ' '));
        }
Exemplo n.º 4
0
 public override void Consume(object sender, GetEntityEventArgs args)
 {
     MonitorFunc(sender, args);
 }
Exemplo n.º 5
0
 public abstract void Consume(object sender, GetEntityEventArgs args);
Exemplo n.º 6
0
        public override void Consume(object sender, GetEntityEventArgs args)
        {
            IFormatter formatter = new BinaryFormatter();

            formatter.Serialize(_Stream, args.CurrentEntity);
        }