示例#1
0
        static void writeHashToExif(string fileName, string hash)
        {
            PictureMetaInformation instance;

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

            if (!PictureMetaInformation.TryGet(fileName, out instance))
            {
                return(string.Empty);
            }
            return(instance.Caption);
        }
示例#3
0
 public static bool TryGet(string filename, out PictureMetaInformation instance)
 {
     try
     {
         instance = new PictureMetaInformation(filename);
         return(true);
     }
     catch
     {
         instance = null;
         return(false);
     }
 }
示例#4
0
        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);
        }