public override FileInformation ExtractInformation(FilePath file)
        {
            var informations = new FileInformation();

            _logger.Debug("Extracting informations from filename (not Path) with regex '{1}' from file '{0}'", file.FullPath, _configuration.GroupRegex);

            var match = _regex.Match(file.FileName);

            if (match.Success)
            {
                foreach (var groupName in _regex.GetGroupNames())
                {
                    var group = match.Groups[groupName];
                    if (group.Success)
                    {
                        informations.AddInformation($"regexG{groupName}", group.Value);
                    }
                }
            }
            else
            {
                _logger.Warn("Extracting informations from filename (not Path) with regex '{1}' from file '{0}' not possible, because regex is not matching",
                             file.FullPath,
                             _configuration.GroupRegex);
            }

            return(informations);
        }
Beispiel #2
0
        public override FileInformation MapInformation(FileInformation information)
        {
            foreach (var cur in information.ToArray())
            {
                if (_mapping.ContainsKey(cur.Key) &&
                    _mapping[cur.Key].ContainsKey(cur.Value.ToString()))
                {
                    var newKey = cur.Key + "Mapped";
                    information.AddInformation(newKey, _mapping[cur.Key][cur.Value.ToString()]);
                }
            }

            return(information);
        }