Beispiel #1
0
        /// <summary>
        ///     Can be called multiple times. Other methods calls must be after this initialization.
        ///     csvDb is used for queries resolving.
        /// </summary>
        /// <param name="map"></param>
        /// <param name="tags"></param>
        /// <param name="csvDb"></param>
        public void Initialize(CaseInsensitiveDictionary <List <string?> > map,
                               CaseInsensitiveDictionary <List <string?> > tags, CsvDb?csvDb = null)
        {
            Map    = map;
            Tags   = tags;
            _csvDb = csvDb;

            var values = Map.TryGetValue("%(GenericTag)");

            if (values is not null && values.Count > 1 && !String.IsNullOrEmpty(values[1]))
            {
                GenericTag = values[1] ?? @"";
            }

            values = Map.TryGetValue("%(TagTypeSeparator)");
            if (values is not null && values.Count > 1 && !String.IsNullOrEmpty(values[1]))
            {
                TagTypeSeparator = values[1] ?? @"";
            }

            values = Map.TryGetValue("%(TagAndPropertySeparator)");
            if (values is not null && values.Count > 1 && !String.IsNullOrEmpty(values[1]))
            {
                TagAndPropertySeparator = values[1] ?? @"";
            }
        }
Beispiel #2
0
 public static string?GetValue(CaseInsensitiveDictionary <List <string?> > data, string key, int column)
 {
     if (column < 0)
     {
         return(null);
     }
     if (!data.TryGetValue(key, out List <string?>?fileLine))
     {
         return(null);
     }
     if (column >= fileLine.Count)
     {
         return(null);
     }
     return(fileLine[column]);
 }