Ejemplo n.º 1
0
 public void Write(IFlatFileWriter writer)
 {
     if (Name.IsNotEmpty())
     {
         writer.WriteProperty(Name, Value.ToString());
     }
     else
     {
         writer.WriteProperty(toPropertyName(), Value.ToString());
     }
 }
Ejemplo n.º 2
0
        private void write(object directive, Type type)
        {
            _types.ForEachProperty(type, prop =>
            {
                var child = prop.GetValue(directive, null);

                if (prop.PropertyType.IsSimple())
                {
                    var stringValue = child == null ? string.Empty : child.ToString();
                    var name        = "{0}{1}".ToFormat(_prefix, prop.Name);

                    _writer.WriteProperty(name, stringValue);
                }
                else
                {
                    if (child != null)
                    {
                        setPrefix(x => x.Push(prop.Name));
                        write(child, child.GetType());
                        setPrefix(x => x.Pop());
                    }
                }
            });
        }