public IGCSVLine SaveAsGCSV(IGCSVHeader header) { IGCSVLine line = new GCSVLine(header); this.Save(line); return(line); }
/// <summary> /// Creates a GCSVLine with the given fields. /// </summary> public GCSVLine(IGCSVHeader header, string[] fields) { m_header = header; if (fields.Length != m_header.Length) { m_values = new string[m_header.Length]; Array.Copy(fields, m_values, fields.Length); for (int i = fields.Length; i < m_header.Length; i++) { m_values[i] = string.Empty; } } else { m_values = fields; } }
private void StartGCSV() { m_headerLine = m_headerLine.Where(key => key != string.Empty).ToArray(); m_header = GCSVMain.CreateHeader(m_headerLine); m_gcsv = new GCSVTable(m_name, m_header); m_started = true; m_headerLine = null; m_name = null; }
public IGCSVLine SaveAsGCSV(IGCSVHeader header) { IGCSVLine line = new GCSVLine(header); this.Save(line); return line; }
public IndexedGCSVTable(string name, IGCSVHeader header) : base(name, header) { m_index = new Dictionary<string, int>(); m_indexKey = header.FirstField; }
public IndexedGCSVTable(string name, IGCSVHeader header, string mappingKey) : base(name, header) { m_index = new Dictionary<string, int>(); m_indexKey = mappingKey; }
/// <summary> /// Creates a GCSVLine where each field is the empty string. /// </summary> public GCSVLine(IGCSVHeader header) { m_header = header; // Initialize the array to empty strings m_values = Enumerable.Range(0, header.Length).Select(i => string.Empty).ToArray(); }
/// <summary> /// Copy this GCSVLine to a new format with the given header. /// Will fill the empty slots with the default values from /// the given header. /// </summary> public GCSVLine ChangeHeader(IGCSVHeader newHeader) { GCSVLine newLine = new GCSVLine(newHeader); foreach (var column in newHeader.Keys) { string key = column; if (this.m_header.ContainsKey(key)) newLine[key] = this[key]; else newLine[key] = ""; } return newLine; }