Reputation: 293
I want to read Attributes of a jpg file. Following is what I have done so far but I am not able to get attribute "A" as shown in the image. All I get from below function is list of strings with ASCII & numerical values.
static void ReadProperties(Image imgImage)
{
var listImageProperties =new List<string>();
try
{
PropertyItem[] propItems = imgImage.PropertyItems;
foreach (PropertyItem propItem in propItems)
{
listImageProperties.Add("0x" + propItem.Id.ToString("x"));
listImageProperties.Add(propItem.Type.ToString());
listImageProperties.Add(propItem.Len.ToString());
}
}
catch (Exception ex)
{
}
}
Upvotes: 0
Views: 1382
Reputation: 293
I got the answer after a bit of debugging. Following code reads the file attribute.
var info = new FileInfo(path);
var att= info.Attributes;//Attributes are enum for ReadOnly, Archive... & so on.
Upvotes: 1