public static bool CanLoadBinary(Uri uri) { try { using (FileStream fs = File.OpenRead(Path.GetFullPath(uri.LocalPath))) { return(PE.CheckPEMagicBytes(fs)); } } catch (IOException) { return(false); } catch (UnauthorizedAccessException) { return(false); } }