Exemplo n.º 1
0
        internal static IEnumerable <Frame> FromPath(DirectoryInfo diri)
        {
            Regex dir_rx = new Regex(@"[1](?<number>[\d][\d\$])");

            foreach (var fi in diri.EnumerateFiles("???.tif"))
            {
                string filename    = fi.Name;
                string dirname     = fi.Directory.Name;
                string dirfullname = fi.Directory.FullName;
                Match  match       = dir_rx.Match(filename);
                if (!match.Success)
                {
                    continue;
                }
                string number = match.Groups["number"].Value;
                if (number == null)
                {
                    continue;
                }
                EXIF _exif = null;
                try
                {
                    _exif = TIFF.exif(dirfullname, filename);
                }
                catch (InvalidOperationException)
                {
                    continue;
                }
                Frame frame = new Frame()
                {
                    number      = toNumber(number),
                    filename    = filename,
                    copyright   = _exif.copyright,
                    description = _exif.description,
                    height      = _exif.height,
                    width       = _exif.width,
                    photometric = _exif.photometric,
                    resolutionX = _exif.resolutionX,
                    resolutionY = _exif.resolutionY,
                    unit        = _exif.unit,
                    software    = _exif.software,
                    make        = _exif.make,
                    model       = _exif.model,
                };
                yield return(frame);
            }
        }