private static byte[] FileToByteArray(string FilePath)
{
byte[] Buffer = null;
try
{
System.IO.FileStream FileStream = new System.IO.FileStream(FilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.IO.BinaryReader BinaryReader = new System.IO.BinaryReader(FileStream);
long TotalBytes = new System.IO.FileInfo(FilePath).Length;
Buffer = BinaryReader.ReadBytes((Int32)TotalBytes);
FileStream.Close();
FileStream.Dispose();
BinaryReader.Close();
}
catch (Exception ex)
{
Utils.Log("File Provider FileToByArray", ex);
}
return Buffer;
}