public List <DataGridViewGenericRowAndValue> Read(string fullFileName) { List <DataGridViewGenericRowAndValue> dataGridViewGenericRowsAndValueList = new List <DataGridViewGenericRowAndValue>(); string fileExtension = Path.GetExtension(fullFileName); Dictionary <PropertyKey, PropVariant> filePropertiesAndVariant = new Dictionary <WinProps.PropertyKey, PropVariant>(); Dictionary <PropertyKey, bool> filePropertiesReadOnly = new Dictionary <WinProps.PropertyKey, bool>(); try { using (PropertyStore propertyStoreExtension = new PropertyStore()) { propertyStoreExtension.AddDefaultsByExtension(fileExtension); foreach (PropertyKey propertyKey in propertyStoreExtension) { try { using (PropertyDescription propertyDescription = new PropertyDescription(propertyKey)) { PropVariant propVariant = propertyStoreExtension.GetValue(propertyKey); filePropertiesAndVariant[propertyKey] = propVariant; } } catch { } } } } catch { } try { using (PropertyStore propertyStoreFile = new PropertyStore(fullFileName, PropertyStore.GetFlags.Default)) { foreach (PropertyKey propertyKey in propertyStoreFile) { try { using (PropertyDescription propertyDescription = new PropertyDescription(propertyKey)) { PropVariant propVariant = propertyStoreFile.GetValue(propertyKey); filePropertiesAndVariant[propertyKey] = propVariant; filePropertiesReadOnly[propertyKey] = !propertyStoreFile.IsEditable(propertyKey); } } catch { } } } } catch { } PropertyDescriptionList propertyDescriptionList = null; try { propertyDescriptionList = new PropertyDescriptionList(fileExtension, PropertyKey.Keys["System.PropList.FullDetails"]); } catch { } if (propertyDescriptionList != null) { string groupName = "Unknown"; bool isReadOnlyGroup = false; for (int i = 0; i < propertyDescriptionList.Count; ++i) { using (PropertyDescription propertyDescription = propertyDescriptionList[i]) { using (PropertyKey key = propertyDescription.PropertyKey) { if (propertyDescription.TypeFlags.IsGroup) { isReadOnlyGroup = true; if (key.Equals(PropertyKey.Keys["System.PropGroup.Origin"])) { isReadOnlyGroup = false; } if (key.Equals(PropertyKey.Keys["System.PropGroup.Description"])) { isReadOnlyGroup = false; } //isReadOnlyGroup = key.Equals(PropertyKey.Keys["System.PropGroup.FileSystem"]); groupName = propertyDescription.DisplayName; dataGridViewGenericRowsAndValueList.Add(new DataGridViewGenericRowAndValue(propertyDescription.DisplayName, key, isReadOnlyGroup)); } else { bool readOnly = isReadOnlyGroup; bool isIsMultiValued = propertyDescription.TypeFlags.IsMultiValued; string textValue = ""; if (filePropertiesAndVariant.ContainsKey(key)) // && !isFileGroup) { if (propertyDescription.TypeFlags.IsMultiValued) { if (filePropertiesAndVariant[key].IsVector) { textValue = string.Join(Environment.NewLine, filePropertiesAndVariant[key].ToType <string>().Split(new[] { "; ", ";" }, StringSplitOptions.RemoveEmptyEntries)); } else { textValue = propertyDescription.FormatForDisplay(filePropertiesAndVariant[key], PropertyDescription.FormatFlags.Default); } } else { textValue = propertyDescription.FormatForDisplay(filePropertiesAndVariant[key], PropertyDescription.FormatFlags.Default); } string test = ""; if (!filePropertiesReadOnly.ContainsKey(key) || filePropertiesReadOnly[key]) { readOnly = true; test = "*"; } else { // propertyDescription.CanonicalName "System.Image.ImageID" string /*File/Properties C:\Users\nordl\OneDrive\Pictures JTNs OneDrive\TestTags\IMG_1267.jpg * Metering mode Pattern * Flash mode No flash, compulsory */ } if (key.Equals(PropertyKey.Keys["System.Image.ImageID"])) { readOnly = true; } if (key.Equals(PropertyKey.Keys["System.Photo.ISOSpeed"])) { readOnly = true; } if (key.Equals(PropertyKey.Keys["System.Photo.MeteringMode"])) { readOnly = true; } if (key.Equals(PropertyKey.Keys["System.Photo.Flash"])) { readOnly = true; } dataGridViewGenericRowsAndValueList.Add( new DataGridViewGenericRowAndValue( groupName, propertyDescription.DisplayName + test, key, readOnly ? ReadWriteAccess.ForceCellToReadOnly : ReadWriteAccess.DefaultReadOnly, isIsMultiValued, readOnly, textValue)); } } } } } } return(dataGridViewGenericRowsAndValueList); }