public static Dictionary <int, string> GetValuesInt32(byte[] bytes, bool bigEndian) { Dictionary <int, string> dict = new Dictionary <int, string>(); int length = bytes.Length; int index = 0; for (int i = 0; i < length; i = i + 4) { byte[] intByte = { bytes[i], bytes[i + 1], bytes[i + 2], bytes[i + 3] }; string value = ConverterFactory.ByteToInt64(intByte, bigEndian).ToString(); dict.Add(index, value); index++; } return(dict); }
public static Dictionary <int, string> GetValuesInt8(byte[] bytes) { Dictionary <int, string> dict = new Dictionary <int, string>(); int length = bytes.Length; int index = 0; for (int i = 0; i < length; i++) { byte[] intByte = { bytes[i] }; int value = ConverterFactory.ByteToInt8(intByte); dict.Add(index, value.ToString()); index++; } return(dict); }
public static void PrintCameraSettings(Makernote camerasettings, string filename, string outputfile) { string tagName = null; string value = null; string seperator = "----------------------------------------------------------------------"; int index; string output = "Camera Settings für Bild: " + Path.GetFileName(outputfile) + Environment.NewLine + Environment.NewLine; for (int i = 0; i < camerasettings.Length - 1; i++) { index = i + 1; tagName = CameraSettingsFactory.GetCameraSettingName(index); string firstPart = "Index: " + index.ToString() + Environment.NewLine + "Tagname: " + tagName + Environment.NewLine + "Wert: "; value = camerasettings.Values[index].ToString(); value = ConverterFactory.HexstringToInt32(value).ToString(); output = output + seperator + Environment.NewLine + firstPart + value + Environment.NewLine + Environment.NewLine; } File.WriteAllText(outputfile, output); }
public static string GetValuesString(Makernote makernote, int length) { string values = null; if (makernote.Type == 2) { return(makernote.Values[0]); } for (int i = 0; i < makernote.Values.Count; i++) { string value = makernote.Values[i]; if (makernote.IsHex) { value = ConverterFactory.HexstringToInt32(value).ToString(); } string blanks = ""; blanks = blanks.PadRight(length, ' '); if (values == null) { values = value; } else if (i % 12 == 0) { values = values + ", " + Environment.NewLine + blanks + value; } else { values = values + ", " + value; } } return(values); }
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 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); }
//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 #region GetMakernotes public static List <Makernote> GetMakernotes(Byte[] allBytes) { List <Makernote> listMakernotes = new List <Makernote>(); byte[] makernotes = allBytes; Makernote makernote = new Makernote(); //bool bigEndian = false; int lengthByte = 2; int numberBadBytes = 2; int endMakernotes = 542; int beginningDataBytes = 992; string message = ""; //for (int i = 2; i < 35 * 12; i++) for (int i = 2; i < 47 * 12; i++) { makernote = new Makernote(); byte[] bytesMakernote = new byte[12]; for (int n = 0; n < 12; n++) { bytesMakernote[n] = makernotes[i + n]; } // ID byte[] bytesID = { bytesMakernote[0], bytesMakernote[1] }; string id = ConverterFactory.ByteToHex(bytesID, false); makernote.Id = id; // Type byte[] bytesType = { bytesMakernote[2], bytesMakernote[3] }; Int16 type = ConverterFactory.ByteToInt16(bytesType, true); makernote.Type = type; // isHex / Name bool isHex = false; bool bigEndian = false; string name = GetNameMakernote(id, out isHex, out bigEndian); // Length byte[] bytesLength = { bytesMakernote[4], bytesMakernote[5], bytesMakernote[6], bytesMakernote[7] }; Int16 length = ConverterFactory.ByteToInt16(bytesLength, true); makernote.Length = length; // Offest byte[] bytesOffset = { bytesMakernote[8], bytesMakernote[9], bytesMakernote[10], bytesMakernote[11] }; Int16 offset = ConverterFactory.ByteToInt16(bytesOffset, true); makernote.Offset = offset; if (id == "0027") { int l = 0; } Dictionary <int, string> dictValues = new Dictionary <int, string>(); if (offset == 0) { dictValues = ConverterFactory.GetValues(allBytes, bytesMakernote, bigEndian, type, isHex, length, offset); } else { dictValues = ConverterFactory.GetValues(allBytes, bytesMakernote, bigEndian, type, isHex, length, offset); } makernote.Values = dictValues; listMakernotes.Add(makernote); i = i + 11; } File.WriteAllText(@"c:\temp\tags.txt", message); return(listMakernotes); }