private void button8_Click(object sender, EventArgs e) { string outputFile = @"c:\temp\makernotes.txt"; List <Makernote> makernotes = MakernoteFactory.GetMakernotes(s_Imagefilename); MakernoteFactory.PrintMakernotes(makernotes, s_Imagefilename, outputFile); Form3 tagsForm = new Form3(); tagsForm.LoadMakernotes(); tagsForm.Show(); }
private void button1_Click(object sender, EventArgs e) { string outputFile = @"c:\temp\camerasettings.txt"; List <Makernote> makernotes = MakernoteFactory.GetMakernotes(s_Imagefilename); Makernote camerasettings = makernotes[0]; CameraSettingsFactory.PrintCameraSettings(camerasettings, s_Imagefilename, outputFile); //MakernoteFactory.PrintMakernotes(makernotes, s_Imagefilename, outputFile); Form3 tagsForm = new Form3(); tagsForm.LoadCameraSettings(); tagsForm.Show(); }
public static List <Makernote> GetMakernotes(string filename) { List <Makernote> makernotes = null; Byte[] bytesMakernote = null; try { using (ExifReader reader = new ExifReader(filename)) { reader.GetTagValue <Byte[]>(ExifTags.MakerNote, out bytesMakernote); } } catch (Exception err) { MessageBox.Show("Fehler beim Einlesen der Exif-Tags." + Environment.NewLine + err); } makernotes = MakernoteFactory.GetMakernotes(bytesMakernote); return(makernotes); }
public void LoadAllTags() { this.Text = "All Tags"; string filename = Form1.Filename; if (string.IsNullOrEmpty(filename)) { MessageBox.Show("Kein Bild geladen;"); return; } listView1.View = View.Details; //Image image = Image.FromFile(filename); Image image = Form1.Image; PropertyItem[] prop = image.PropertyItems; List <Makernote> makernotes = null; using (ExifReader reader = new ExifReader(filename)) { listView1.Items.Add(new ListViewItem(new string[] { "--------", "------", "--------------Exif-Tags---------------", "----------------------------------------", "----------------------------------------", "------" })); int i = 0; foreach (var item in prop) { string id = string.Format("{0:x}", item.Id); string tagName; string type; ExifTags tag = ExifFactory.GetTag(id, out tagName, out type); string value; if (id == "927c") { Byte[] bytesMAkernote; if (reader.GetTagValue <Byte[]>(ExifTags.MakerNote, out bytesMAkernote)) { ; } { makernotes = MakernoteFactory.GetMakernotes(bytesMAkernote); string messageout = ""; foreach (byte b in bytesMAkernote) { messageout = messageout + b + Environment.NewLine; } File.WriteAllText(@"c:\temp\bytes.txt", messageout); } } // PropertyItem propItem = image.GetPropertyItem(37500); if (tag != null) { value = ExifFactory.GetValue(tag, reader, type); if (tagName == null) { tagName = "<unbekannt>"; } if (value != null) { listView1.Items.Add(new ListViewItem(new string[] { item.Id.ToString(), id, tagName, value, type })); } else { listView1.Items.Add(new ListViewItem(new string[] { item.Id.ToString(), id, tagName, "", "" })); } } } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } listView1.Items.Add(new ListViewItem(new string[] { "--------", "------", "-----------Canon Makernotes-----------", "----------------------------------------", "----------------------------------------", "------" })); //1 = BYTE An 8-bit unsigned integer., //2 = ASCII An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL., //3 = SHORT A 16-bit (2-byte) unsigned integer, //4 = LONG A 32-bit (4-byte) unsigned integer, //5 = RATIONAL Two LONGs. The first LONG is the numerator and the second LONG expresses the //denominator., //7 = UNDEFINED An 8-bit byte that can take any value depending on the field definition, //9 = SLONG A 32-bit (4-byte) signed integer (2's complement notation), //10 = SRATIONAL Two SLONGs. The first SLONG is the numerator and the second SLONG is the if (makernotes != null && makernotes.Count > 0) { foreach (Makernote makernote in makernotes) { Dictionary <int, string> dicValues = makernote.Values; string value = null; for (int i = 0; i < dicValues.Count; i++) { if (i == 4) { if (dicValues.Count > 4) { value = value + ", ..."; } } else if (i > 4) { break; } else { if (value == null) { value = dicValues[i].ToString(); } else { value = value + ", " + dicValues[i]; } } } string id = makernote.Id; bool isHex; bool bigEndian; listView1.Items.Add(new ListViewItem(new string[] { "", id, MakernoteFactory.GetNameMakernote(id, out isHex, out bigEndian), value, makernote.Type.ToString() })); } } }
public void LoadCameraSettings() { this.Text = "Canon CameraSettings Tags"; string filename = Form1.Filename; if (string.IsNullOrEmpty(filename)) { MessageBox.Show("Kein Bild geladen"); return; } listView1.View = View.Details; List <Makernote> makernotes = MakernoteFactory.GetMakernotes(filename); //------------------------------------------------------- //Canon CameraSettings Tags Makernote cameraSettings = makernotes[0]; int index; string tagName = null; string value = null; for (int i = 0; i < cameraSettings.Length - 1; i++) { index = i + 1; tagName = CameraSettingsFactory.GetCameraSettingName(index); value = cameraSettings.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); if (index == 1) { tagName = "Makro Mode"; value = CameraSettingsFactory.GetValueMacroMode(value); } else if (index == 3) { tagName = "Quality"; value = CameraSettingsFactory.GetValueQuality(value); } else if (index == 4) { tagName = "Canon Flash Mode"; value = CameraSettingsFactory.GetValueFlashMode(value); } else if (index == 5) { tagName = "Continuous Drive"; value = CameraSettingsFactory.GetValueContinuousDrive(value); } else if (index == 7) { tagName = "Focus Mode"; value = CameraSettingsFactory.GetValueFocusMode(value); } else if (index == 9) { tagName = "Record Mode"; value = CameraSettingsFactory.GetValueRecordMode(value); } else if (index == 10) { tagName = "Canon Image Size"; value = CameraSettingsFactory.GetValueImageSize(value); } else if (index == 11) { tagName = "Easy Mode"; value = CameraSettingsFactory.GetValueEasyMode(value); } else if (index == 12) { tagName = "Digital Zoom"; value = CameraSettingsFactory.GetValueDigitalZoom(value); } else if (index == 13) { tagName = "Contrast"; value = CameraSettingsFactory.GetValueContrast(value); } else if (index == 14) { tagName = "Saturation"; value = CameraSettingsFactory.GetValueSaturation(value); } else if (index == 16) { tagName = "Camera ISO"; value = CameraSettingsFactory.GetValueCameraISO(value); } else if (index == 17) { tagName = "Metering Mode"; value = CameraSettingsFactory.GetValueMeteringMode(value); } else if (index == 18) { tagName = "Focus Range"; value = CameraSettingsFactory.GetValueFocusRange(value); } else if (index == 19) { tagName = "Manual AF point selection"; value = cameraSettings.Values[index].ToString(); value = CameraSettingsFactory.GetValueManualAFPointSelection(value); } else if (index == 20) { tagName = "Canon Exposure Mode"; value = CameraSettingsFactory.GetValueCanonExposureMode(value); } else if (index == 22) { tagName = "Lens Type"; value = CameraSettingsFactory.GetValueLensType(value); } else if (index == 23) { tagName = "Max Focal Length"; value = value + " mm"; } else if (index == 24) { tagName = "Mim Focal Length"; value = value + " mm"; } else if (index == 25) { tagName = "Focal Units"; value = value + "/mm"; } else if (index == 26) { tagName = "Max Aperture"; } else if (index == 27) { tagName = "Min Aperture"; } else if (index == 29) { tagName = "Flash Bits"; value = CameraSettingsFactory.GetValueLensType(value); } else if (index == 32) { tagName = "Focus Continuous"; value = CameraSettingsFactory.GetValueFocusContinuous(value); } else if (index == 34) { tagName = "Image Stabilization"; } else { continue; } ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); //int index = 0; //string tagName = null; //string value; //// MacroMode - 1 //index = index + 1; //tagName = "MacroMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// SelfTimer - 2 //index = index + 1; //tagName = "SelfTimer"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// Quality - 3 //index = index + 1; //tagName = "Quality"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// CanonFlashMode - 4 //index = index + 1; //tagName = "CanonFlashMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// ContinuousDrive - 5 //index = index + 1; //tagName = "ContinuousDrive"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// unknown - 6 //index = index + 1; //tagName = "unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// FocusMode - 7 //index = index + 1; //tagName = "FocusMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// unknown - 8 //index = index + 1; //tagName = "unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknwon"); //// RecordMode - 9 //index = index + 1; //tagName = "RecordMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// CanonImageSize - 10 //index = index + 1; //tagName = "CanonImageSize"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// EasyMode - 11 //index = index + 1; //tagName = "EasyMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// DigitalZoom - 12 //index = index + 1; //tagName = "DigitalZoom"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// Contrast - 13 //index = index + 1; //tagName = "Contrast"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// Saturation - 14 //index = index + 1; //tagName = "Saturation"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// Sharpness - 15 //index = index + 1; //tagName = "Sharpness"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// CameraISO - 16 //index = index + 1; //tagName = "CameraISO"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// MeteringMode - 17 //index = index + 1; //tagName = "MeteringMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// FocusRange - 18 //index = index + 1; //tagName = "FocusRange"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// AFPoint - 19 //index = index + 1; //tagName = " AFPoint"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// CanonExposureMode - 20 //index = index + 1; //tagName = " CanonExposureMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// unknown - 21 //index = index + 1; //tagName = " unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// LensType - 22 //index = index + 1; //tagName = " LensType"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16u"); //// MaxFocalLength - 23 //index = index + 1; //tagName = " MaxFocalLength"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16u"); //// MinFocalLength - 24 //index = index + 1; //tagName = " MinFocalLength"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16u"); //// FocalUnits - 25 //index = index + 1; //tagName = " FocalUnits"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// MaxAperture - 26 //index = index + 1; //tagName = " MaxAperture"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// MinAperture - 27 //index = index + 1; //tagName = " MinAperture"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// FlashActivity - 28 //index = index + 1; //tagName = " FlashActivity"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// FlashBits - 29 //index = index + 1; //tagName = " FlashBits"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// unknown - 30 //index = index + 1; //tagName = " unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// unknown - 31 //index = index + 1; //tagName = " unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// FocusContinuous - 32 //index = index + 1; //tagName = " FocusContinuous"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// AESetting - 33 //index = index + 1; //tagName = " AESetting"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// ImageStabilization - 34 //index = index + 1; //tagName = " ImageStabilization"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// DisplayAperture - 35 //index = index + 1; //tagName = " DisplayAperture"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// ZoomSourceWidth - 36 //index = index + 1; //tagName = " ZoomSourceWidth"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// ZoomTargetWidth - 37 //index = index + 1; //tagName = "ZoomTargetWidth"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// unknown - 38 //index = index + 1; //tagName = "unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// SpotMeteringMode - 39 //index = index + 1; //tagName = "SpotMeteringMode"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// PhotoEffect - 40 //index = index + 1; //tagName = "PhotoEffect"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// ManualFlashOutput - 41 //index = index + 1; //tagName = "ManualFlashOutput"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// ColorTone - 42 //index = index + 1; //tagName = "ColorTone"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); //// unknown - 43 //index = index + 1; //tagName = "unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// unknown - 44 //index = index + 1; //tagName = "unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// unknown - 45 //index = index + 1; //tagName = "unknown"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); //// SRAWQuality - 46 //index = index + 1; //tagName = "SRAWQuality"; //value = cameraSettings.Values[index].ToString(); //ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); ////Aufnahmemodus //string aufnamemodus = FormFactory.GetNamesAufnamemodus(cameraSettings.Values[11]); //if (aufnamemodus != "") // Form1.Textbox13 = aufnamemodus; ////AF-Betriebsart //string afBetriebsart = FormFactory.GetNamesAFBetriebsart(Convert.ToInt32(cameraSettings.Values[7])); ////AF-Bereich-Auswahlmodus //string afBereichAuswahlmodus = FormFactory.GetNamesAFBereichAuswahlmodus(Convert.ToInt32(cameraSettings.Values[32])); //////Kontrast //Form1.Textbox16_3 = cameraSettings.Values[13].Substring(3); ////Farbsättigung //Form1.Textbox16_2 = cameraSettings.Values[14].Substring(3); ////Farbton //Form1.Textbox16_4 = cameraSettings.Values[42].Substring(3); }
public void LoadMakernotes() { this.Text = "Canon ShotInfo Tags"; string filename = Form1.Filename; if (string.IsNullOrEmpty(filename)) { MessageBox.Show("Kein Bild geladen"); return; } listView1.View = View.Details; Image image = Form1.Image; PropertyItem[] prop = image.PropertyItems; Byte[] bytesMakernote = null; try { using (ExifReader reader = new ExifReader(filename)) { reader.GetTagValue <Byte[]>(ExifTags.MakerNote, out bytesMakernote); } } catch (Exception err) { MessageBox.Show("Fehler beim Einlesen der Exif-Tags." + Environment.NewLine + err); } List <Makernote> makernotes = MakernoteFactory.GetMakernotes(bytesMakernote); int index = -1; string tagName = null; string value = null; string type = null; //Makernote makernote = null; bool isHex; bool bigEndian; foreach (Makernote makernote in makernotes) { index = index + 1; tagName = MakernoteFactory.GetNameMakernote(makernote.Id, out isHex, out bigEndian); type = "unknown"; //value = MakernoteFactory.GetValuesString(makernote); ListViewFactory.AddItem(listView1, makernote.Id, "", tagName, value, makernote.Type.ToString()); } //index = index + 1; //tagName = MakernoteFactory.GetNameMakernote(makernote.Id, out isHex, out bigEndian); //type = "unknown"; //makernote = makernotes[index]; //value = MakernoteFactory.GetValuesString(makernote); //ListViewFactory.AddItem(listView1, makernote.Id, "", tagName, value, type); //// CanonCameraSettings - 1 //index = index + 1; //tagName = "CanonCameraSettings"; //type = "unknown"; //makernote = makernotes[index]; //value = MakernoteFactory.GetValuesString(makernote); //ListViewFactory.AddItem(listView1, makernote.Id, "", tagName, value, type); //// CanonFocalLength - 2 //index = index + 1; //tagName = "CanonFocalLength"; //type = "unknown"; //makernote = makernotes[index]; //value = MakernoteFactory.GetValuesString(makernote); //ListViewFactory.AddItem(listView1, makernote.Id, "", tagName, value, type); // CanonFocalLength - 2 //tagName = MakernoteFactory.GetNameMakernote(makernote.Id, out isHex, out bigEndian); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); }
public void LoadShotInfo() { this.Text = "Canon ShotInfo Tags"; string filename = Form1.Filename; if (string.IsNullOrEmpty(filename)) { MessageBox.Show("Kein Bild geladen"); return; } listView1.View = View.Details; Image image = Form1.Image; PropertyItem[] prop = image.PropertyItems; Byte[] bytesMakernote = null; try { using (ExifReader reader = new ExifReader(filename)) { reader.GetTagValue <Byte[]>(ExifTags.MakerNote, out bytesMakernote); } } catch (Exception err) { MessageBox.Show("Fehler beim Einlesen der Exif-Tags." + Environment.NewLine + err); } List <Makernote> makernotes = MakernoteFactory.GetMakernotes(bytesMakernote); //------------------------------------------------------- //Canon CameraSettings Tags Makernote shotInfo = makernotes[2]; int index = 0; string tagName = null; string value; // AutoISO - 1 index = index + 1; tagName = "AutoISO"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // BaseISO - 2 index = index + 1; tagName = "BaseISO"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // MeasuredEV - 3 index = index + 1; tagName = "MeasuredEV"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // TargetAperture - 4 index = index + 1; tagName = "TargetAperture"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // TargetExposureTime - 5 index = index + 1; tagName = "TargetExposureTime"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // ExposureCompensation - 6 index = index + 1; tagName = "ExposureCompensation"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // WhiteBalance - 7 index = index + 1; tagName = "WhiteBalance"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // SlowShutter - 8 index = index + 1; tagName = "SlowShutter"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // SequenceNumber - 9 index = index + 1; tagName = "SequenceNumber"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // OpticalZoomCode - 10 index = index + 1; tagName = "OpticalZoomCode"; value = shotInfo.Values[index].ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // unknown - 11 index = index + 1; tagName = "unknown"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); // CameraTemperature - 12 index = index + 1; tagName = "CameraTemperature"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // FlashGuideNumber - 13 index = index + 1; tagName = "FlashGuideNumber"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // AFPointsInFocus - 14 index = index + 1; tagName = "AFPointsInFocus"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // FlashExposureComp - 15 index = index + 1; tagName = "FlashExposureComp"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // AutoExposureBracketing - 16 index = index + 1; tagName = "AutoExposureBracketing"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // AEBBracketValue - 17 index = index + 1; tagName = "AEBBracketValue"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // ControlMode - 18 index = index + 1; tagName = "ControlMode"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // FocusDistanceUpper - 19 index = index + 1; tagName = " FocusDistanceUpper"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // FocusDistanceLower - 20 index = index + 1; tagName = " FocusDistanceLower"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // FNumber - 21 index = index + 1; tagName = " FNumber"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // ExposureTime - 22 index = index + 1; tagName = " ExposureTime"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // MeasuredEV2 - 23 index = index + 1; tagName = " MeasuredEV2"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // BulbDuration - 24 index = index + 1; tagName = " BulbDuration"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // unknown - 25 index = index + 1; tagName = " unknown"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); // CameraType - 26 index = index + 1; tagName = " CameraType"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // AutoRotate - 27 index = index + 1; tagName = " AutoRotate"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // NDFilter - 28 index = index + 1; tagName = " NDFilter"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // SelfTimer2 - 29 index = index + 1; tagName = " SelfTimer2"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); // unknown - 30 index = index + 1; tagName = " unknown"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); // unknown - 31 index = index + 1; tagName = " unknown"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); // unknown - 32 index = index + 1; tagName = " unknown"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "unknown"); // FlashOutput - 33 index = index + 1; tagName = " FlashOutput"; value = shotInfo.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); ListViewFactory.AddItem(listView1, index.ToString(), "", tagName, value, "int16s"); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); }
public static void FillForm(string filenameImage, out UInt16 orientation) { orientation = 1; Byte[] bytesMakernote = null; try { using (ExifReader reader = new ExifReader(filenameImage)) { //Dateiname string filename; filename = Path.GetFileNameWithoutExtension(filenameImage); Form1.Textbox0 = filename; //Datum & Uhrzeit DateTime dateTime; if (reader.GetTagValue <DateTime>(ExifTags.DateTime, out dateTime)) { Form1.Datetime = dateTime; string date = dateTime.ToShortDateString(); string time = dateTime.ToShortTimeString(); Form1.Textbox1 = date; Form1.Textbox2 = time; } else { Form1.Textbox1 = ""; Form1.Textbox2 = ""; } //Breitengrad Double[] latitude; if (reader.GetTagValue <Double[]>(ExifTags.GPSLatitude, out latitude)) { string adjustedlatitude = ToolsFactory.DMStoDegrees(latitude).ToString(); int length = adjustedlatitude.Length; int index = adjustedlatitude.IndexOf(','); if (length - index > 6) { adjustedlatitude = adjustedlatitude.Substring(0, index + 6); } Form1.Textbox3 = adjustedlatitude; } else { Form1.Textbox3 = ""; } //Längengrad Double[] longitude; if (reader.GetTagValue <Double[]>(ExifTags.GPSLongitude, out longitude)) { string longitudeRef; if (reader.GetTagValue <string>(ExifTags.GPSLongitudeRef, out longitudeRef)) { } string adjustedlongitude; adjustedlongitude = ToolsFactory.DMStoDegrees(longitude).ToString(); int length = adjustedlongitude.Length; int index = adjustedlongitude.IndexOf(','); if (length - index > 6) { adjustedlongitude = adjustedlongitude.Substring(0, index + 6); } if (longitudeRef == "W") { adjustedlongitude = "-" + adjustedlongitude; } Form1.Textbox4 = adjustedlongitude; } else { Form1.Textbox4 = ""; } //Blendenzahl 0x9202 Double apertureValue; if (reader.GetTagValue <Double>(ExifTags.FNumber, out apertureValue)) { Form1.Textbox5 = "f/" + apertureValue.ToString(); } else { Form1.Textbox5 = ""; } //Belichtungszeit Double exposureTime; if (reader.GetTagValue <Double>(ExifTags.ExposureTime, out exposureTime)) { exposureTime = 1 / exposureTime; Form1.Textbox6 = "1/" + exposureTime.ToString() + " Sek"; } else { Form1.Textbox6 = ""; } //Filmempfindlichkeit (ISO) UInt16 isoSpeed; if (reader.GetTagValue <UInt16>(ExifTags.ISOSpeedRatings, out isoSpeed)) { Form1.Textbox7 = isoSpeed.ToString(); } else { Form1.Textbox7 = ""; } //Brennweite Double focalLength; if (reader.GetTagValue <Double>(ExifTags.FocalLength, out focalLength)) { Form1.Textbox8 = focalLength + " mm"; } else { Form1.Textbox8 = ""; } //Belichtungskorrektur Double exposureBiasValue; if (reader.GetTagValue <Double>(ExifTags.ExposureBiasValue, out exposureBiasValue)) { Form1.Textbox9 = exposureBiasValue.ToString("0.0") + " Schritt(e)"; } else { Form1.Textbox9 = ""; } //Messmethode UInt16 meteringMode; if (reader.GetTagValue <UInt16>(ExifTags.MeteringMode, out meteringMode)) { Form1.Textbox12 = GetNamesMessmethode(meteringMode); } else { Form1.Textbox12 = ""; } //Belichtungsprogramm UInt16 exposureProgram; if (reader.GetTagValue <UInt16>(ExifTags.ExposureProgram, out exposureProgram)) { Form1.Textbox13 = GetNamesBelichtungsprogramm(exposureProgram); } else { Form1.Textbox11 = ""; } //Objektiv string lensModel; if (reader.GetTagValue <string>(ExifTags.LensModel, out lensModel)) { Form1.Textbox20 = lensModel; } else { Form1.Textbox20 = ""; } // Orientierung reader.GetTagValue <UInt16>(ExifTags.Orientation, out orientation); //Makernote reader.GetTagValue <Byte[]>(ExifTags.MakerNote, out bytesMakernote); } } catch (Exception e) { MessageBox.Show("Fehler beim Einlesen der Exif-Tags." + Environment.NewLine + e); } try { List <Makernote> makernotes = MakernoteFactory.GetMakernotes(bytesMakernote); //------------------------------------------------------- //Canon CameraSettings Tags Makernote cameraSettings = makernotes[0]; //Aufnahmemodus string aufnamemodus = GetNamesAufnamemodus(cameraSettings.Values[11]); if (aufnamemodus != "") { Form1.Textbox13 = aufnamemodus; } if (aufnamemodus == "HDR") { MessageBox.Show("HDR"); } //AF-Betriebsart Form1.Textbox10 = GetNamesAFBetriebsart(Convert.ToInt32(cameraSettings.Values[7])); //AF-Bereich-Auswahlmodus Form1.Textbox11 = GetNamesAFBereichAuswahlmodus(Convert.ToInt32(cameraSettings.Values[32])); //Kontrast Form1.Textbox16_3 = cameraSettings.Values[13].Substring(3); //Farbsättigung Form1.Textbox16_2 = cameraSettings.Values[14].Substring(3); //Farbton Form1.Textbox16_4 = cameraSettings.Values[42].Substring(3); //------------------------------------------------------- //Canon ShotInfo Tags Makernote shotInfoTags = makernotes[2]; //auto ISO if (shotInfoTags.Values[1] != "0000") { Form1.Checkbox2 = true; } else { Form1.Checkbox2 = false; } //------------------------------------------------------- //CanonCameraInfo10D Makernote canonCameraInfo10D = makernotes[32]; //Bildstil int valInt = Convert.ToInt32(canonCameraInfo10D.Values[10]); Form1.Textbox15 = GetNamesBildstil(valInt); //Schärfe Form1.Textbox16_1 = canonCameraInfo10D.Values[2].Substring(3); } catch (Exception e) { MessageBox.Show("Fehler beim Einlesen der Exif-Tags." + Environment.NewLine + e); } }