Revision: 63575
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 18, 2013 05:02 by jprochazka
Initial Code
bool CheckIsExecutable(string filePath) { var firstBytes = new byte[2]; using(var fileStream = File.Open(filePath, FileMode.Open)) { fileStream.Read(firstBytes, 0, 2); } return Encoding.UTF8.GetString(firstBytes) == "MZ"; }
Initial URL
Initial Description
A function to check the first two bytes to see if they match "MZ" marking it as an executable.
Initial Title
Check if a file is an executable.
Initial Tags
validation
Initial Language
C#