static void writeHashToExif(string fileName, string hash)
        {
            PictureMetaInformation instance;

            if (PictureMetaInformation.TryGet(fileName, out instance))
            {
                instance.Caption = hash;
                instance.Write();
            }
        }
        static string readHashFromExif(string fileName)
        {
            PictureMetaInformation instance;

            if (!PictureMetaInformation.TryGet(fileName, out instance))
            {
                return(string.Empty);
            }
            return(instance.Caption);
        }
Exemple #3
0
 public static bool TryGet(string filename, out PictureMetaInformation instance)
 {
     try
     {
         instance = new PictureMetaInformation(filename);
         return(true);
     }
     catch
     {
         instance = null;
         return(false);
     }
 }
        static DateTime getImageDate(string path)
        {
            PictureMetaInformation instance;

            if (PictureMetaInformation.TryGet(path, out instance))
            {
                var result = instance.DateTimeOriginal;
                if (result.HasValue)
                {
                    return(result.Value);
                }
            }
            return(new FileInfo(path).CreationTime.Date);
        }