public CsvEndpoint(ImportEngine engine, XmlNode node) : base(engine, node, ActiveMode.Lazy | ActiveMode.Local) { MaxGenerations = node.ReadInt("@generations", int.MinValue); if (MaxGenerations != int.MinValue) { generations = new FileGenerations(); } String tmp = MaxGenerations == int.MinValue ? node.ReadStr("@file") : node.ReadStr("@file", null); FileNameBase = engine.Xml.CombinePath(tmp == null ? "csvOutput" : tmp); fileName = FileNameBase; trim = node.ReadBool("@trim", true); lenient = node.ReadBool("@lenient", false); delimChar = CsvDatasource.readChar(node, "@dlm", ','); quoteChar = CsvDatasource.readChar(node, "@quote", '"'); commentChar = CsvDatasource.readChar(node, "@comment", '#'); //Predefine field orders if requested (implies linient mode) String fields = node.ReadStr("@fields", null); String fieldsOrder = node.ReadStr("@fieldorder", null); if (fields != null && fieldsOrder != null) { throw new BMNodeException(node, "Attributes [fields] and [fieldorder] cannot be specified together."); } String[] order; if (fields != null) { order = fields.SplitStandard(); } else if (fieldsOrder != null) { order = fieldsOrder.SplitStandard(); } else { order = null; } if (order != null) { lenient = true; foreach (var fld in order) { keyToIndex(fld); } selectiveExport = fields != null; } }
public TextEndpoint(ImportEngine engine, XmlNode node) : base(engine, node, ActiveMode.Lazy | ActiveMode.Local) { MaxGenerations = node.ReadInt("@generations", int.MinValue); if (MaxGenerations != int.MinValue) { generations = new FileGenerations(); } String tmp = MaxGenerations == int.MinValue ? node.ReadStr("@file") : node.ReadStr("@file", null); FileNameBase = engine.Xml.CombinePath(tmp == null ? "textOutput" : tmp); fileName = FileNameBase; rawTokens = node.ReadBool("@rawtokens", false); Format = node.ReadStr("@format", null); if (Format == null) { Format = node.ReadStr("format"); } if (Format == "*") { Format = null; } Header = node.ReadStr("@header", null); if (Header == null) { Header = node.ReadStr("header", null); } Footer = node.ReadStr("@footer", null); if (Footer == null) { Footer = node.ReadStr("footer", null); } String cs = node.ReadStr("@encoding", null); Encoding = cs == null ? Encoding.Default : Encoding.GetEncoding(cs); //Predefine field orders if requested (implies linient mode) fields = node.ReadStr("@fieldorder", null).SplitStandard(); if (fields != null && fields.Length > 0) { formatParms = new Object[fields.Length]; } else { fields = null; } }