private void OK_Button_Click(object sender, EventArgs e) { if (!textBox2.Text.Equals("")) { List <string> pliki = new List <string>(); pliki.AddRange(Directory.GetFiles(textBox2.Text, "*.jpg")); pliki.AddRange(Directory.GetFiles(textBox2.Text, "*.jpeg")); PropertyItem[] items; string iiphotoTag; foreach (string plik in pliki) { items = Zdjecie.PobierzDaneExif(plik); foreach (PropertyItem item in items) { if (item.Id == PropertyTags.IIPhotoTag) { iiphotoTag = PropertyTags.ParseProp(item); if (long.Parse(iiphotoTag) == id) { plikOdnaleziony = plik; this.Close(); return; } } } } } MessageBox.Show("Nie znaleziono szukanego pliku w podanej lokalizacji!"); this.Close(); return; }
public string GetProperty(int propID) { PropertyItem i; string val; foreach (int id in miniatura.PropertyIdList) { if (id == propID) { i = miniatura.GetPropertyItem(propID); switch (i.Type) { case 1: val = Encoding.Unicode.GetString(i.Value); break; case 2: val = Encoding.ASCII.GetString(i.Value); break; case 3: val = BitConverter.ToUInt16(i.Value, 0).ToString(); break; default: val = "Value not supported"; break; } return(PropertyTags.ParseProp(propID, val)); } } return(""); }
/// <summary> /// Metoda pobierajaca dane Exif ze zdjecia i dodajaca je do wyswietlenia /// </summary> private void fillExif() { PropertyItem[] propertyItems = zdjecie.PobierzDaneExif(); Dictionary <int, string> d = PropertyTags.defaultExifIds; string propertyValue; foreach (PropertyItem pItem in propertyItems) { if (d.ContainsKey(pItem.Id)) { propertyValue = PropertyTags.ParseProp(pItem); if (!propertyValue.Equals("")) { Exif.Items.Add(new ListViewItem(new string[] { d[pItem.Id], propertyValue })); } } } }
/// <summary> /// Metoda zwraca slownik z danymi Exif, ktore zostana wpisane do bazy danych /// </summary> /// <returns>Slownik z danymi Exif</returns> public Dictionary <string, string> PobierzExifDoBazy() { PropertyItem[] propertyItems = Zdjecie.PobierzDaneExif(Path); Dictionary <int, string> defaults = PropertyTags.defaultExifDoBazy; Dictionary <string, string> d = new Dictionary <string, string>(); string propertyValue; foreach (PropertyItem pItem in propertyItems) { if (defaults.ContainsKey(pItem.Id)) { propertyValue = PropertyTags.ParseProp(pItem); if (!d.ContainsKey(defaults[pItem.Id]) && !propertyValue.Equals("")) { d.Add(defaults[pItem.Id], propertyValue); } } } return(d); }