Ejemplo n.º 1
0
        private void getExifInfo(string strFilename)
        {
            try
            {
                if (File.Exists(strFilename) && strFilename.ToLower().EndsWith(".jpg"))
                {
                    HybridDictionary hd    = ImageInfo.ExifReader.GetAllProperties(strFilename);
                    string           strTD = "";
                    PhotoInfoList.Clear();
                    Lat = ""; Lon = "";
                    List <PhotoInfo> _PhotoInfoList = new List <PhotoInfo>();
                    foreach (object obj in hd.Keys)
                    {
                        if (obj.ToString().ToLower().Equals("thumbnail data"))
                        {
                            strTD = hd[obj].ToString();
                        }
                        if (obj.ToString().Equals("Latitude"))
                        {
                            Lat = hd[obj].ToString();//.Replace(",", ".");
                        }
                        if (obj.ToString().Equals("Longitude"))
                        {
                            Lon = hd[obj].ToString();//.Replace(",", ".");
                        }
                        PhotoInfo pi = new PhotoInfo()
                        {
                            InfoName = obj.ToString(), InfoValue = getRealValue(obj, hd)
                        };
                        _PhotoInfoList.Add(pi);
                    }

                    if (Lat != "" && Lon != "")
                    {
                        this.Invoke((MethodInvoker) delegate
                        {
                            RefreshMap();
                        });
                    }
                    this.Invoke((MethodInvoker) delegate
                    {
                        PhotoInfoList.AddRange(_PhotoInfoList.OrderBy(x => x.InfoName));
                        dGVExif.DataSource = null;
                        dGVExif.DataSource = PhotoInfoList;
                        dGVExif.Refresh();
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        private void getExifInfo(string strFilename)
        {
            try
            {
                if (File.Exists(strFilename) && strFilename.ToLower().EndsWith(".jpg"))
                {
                    HybridDictionary hd = ImageInfo.ExifReader.GetAllProperties(strFilename);
                    string strTD = "";
                    PhotoInfoList.Clear();
                    Lat = ""; Lon = "";
                    List<PhotoInfo> _PhotoInfoList = new List<PhotoInfo>();
                    foreach (object obj in hd.Keys)
                    {
                        if (obj.ToString().ToLower().Equals("thumbnail data"))
                        {
                            strTD = hd[obj].ToString();
                        }
                        if (obj.ToString().Equals("Latitude"))
                        {
                            Lat = hd[obj].ToString();//.Replace(",", ".");
                        }
                        if (obj.ToString().Equals("Longitude"))
                        {
                            Lon = hd[obj].ToString();//.Replace(",", ".");
                        }
                        PhotoInfo pi = new PhotoInfo() { InfoName = obj.ToString(), InfoValue = getRealValue(obj, hd) };
                        _PhotoInfoList.Add(pi);
                    }

                    if (Lat != "" && Lon != "")
                    {
                        this.Invoke((MethodInvoker)delegate
                        {
                            RefreshMap();
                        });
                    }
                    this.Invoke((MethodInvoker)delegate
                    {
                        PhotoInfoList.AddRange(_PhotoInfoList.OrderBy(x => x.InfoName));
                        dGVExif.DataSource = null;
                        dGVExif.DataSource = PhotoInfoList;
                        dGVExif.Refresh();
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }