ZeroInstall.Publish.EntryPoints.PosixBinary.HasMagicBytes C# (CSharp) Method

HasMagicBytes() private static method

private static HasMagicBytes ( FileInfo file ) : bool
file System.IO.FileInfo
return bool
        private static bool HasMagicBytes(FileInfo file)
        {
            using (var stream = file.OpenRead())
            {
                try
                {
                    var magic = stream.Read(4);
                    if (magic[0] != 0x7f || magic[1] != 0x45 || magic[2] != 0x4c || magic[3] != 0x46) return false;
                }
                catch (IOException)
                {
                    return false;
                }
            }
            return true;
        }