public byte[] GetContent()
{
byte[] content =null;
if ( this.fileInfo != null && this.fileInfo.Exists)
{
using (Stream stream = this.fileInfo.OpenRead())
{
content = new byte[stream.Length];
stream.Read(content, 0, this.content.Length);
}
}
return content;
}
public static string GetFileSuffix(byte[] fileData)
{
string result;
if (fileData == null || fileData.Length < 10)
{
result = null;
}
else
{
if (fileData[0] == 71 && fileData[1] == 73 && fileData[2] == 70)
{
result = "GIF";
}
else
{
if (fileData[1] == 80 && fileData[2] == 78 && fileData[3] == 71)
{
result = "PNG";
}
else
{
if (fileData[6] == 74 && fileData[7] == 70 && fileData[8] == 73 && fileData[9] == 70)
{
result = "JPG";
}
else
{
if (fileData[0] == 66 && fileData[1] == 77)
{
result = "BMP";
}
else
{
result = null;
}
}
}
}
}
return result;
}