Exemplo n.º 1
0
        public IGCSVLine SaveAsGCSV(IGCSVHeader header)
        {
            IGCSVLine line = new GCSVLine(header);

            this.Save(line);
            return(line);
        }
Exemplo n.º 2
0
        /// <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;
            }
        }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 public IGCSVLine SaveAsGCSV(IGCSVHeader header)
 {
     IGCSVLine line = new GCSVLine(header);
     this.Save(line);
     return line;
 }
Exemplo n.º 5
0
 public IndexedGCSVTable(string name, IGCSVHeader header)
     : base(name, header)
 {
     m_index = new Dictionary<string, int>();
     m_indexKey = header.FirstField;
 }
Exemplo n.º 6
0
 public IndexedGCSVTable(string name, IGCSVHeader header, string mappingKey)
     : base(name, header)
 {
     m_index = new Dictionary<string, int>();
     m_indexKey = mappingKey;
 }
Exemplo n.º 7
0
 /// <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();
 }
Exemplo n.º 8
0
 /// <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;
 }