Exemplo n.º 1
0
        private static FileMetaInfo ReadJpegMetaInfo(string fullName)
        {
            ExifTags.ExifValue dtValue;
            using (var image = Image.Load(fullName))
            {
                if (image.MetaData.ExifProfile == null)
                {
                    return null;
                }
                var exif = image.MetaData.ExifProfile;
                
                if (!exif.TryGetValue(ExifTags.ExifTag.DateTime, out dtValue))
                {
                    return null;
                }
            }

            var dtS = (String)dtValue.Value;
            
            var dt = Filename2Datetime.MakeDatetime(dtS, Filename2Datetime.RegexType.Exif);
            if (dt != null)
            {
                return new FileMetaInfo(dt.Value);
            }
            Console.WriteLine($"{fullName} has EXIF, however could not parse {dtS}");
            
            return null;
        }
Exemplo n.º 2
0
 public FileMetaInfo(string fileName)
 {
     var dt = Filename2Datetime.MakeDatetime(fileName);
     if (dt != null)
     {
         InitMembers(dt.Value); 
     }
     else 
     {
         Console.WriteLine($"Could not parse {fileName}");
         InitMembers(DateTime.MinValue);
     }
     
 }