public static bool IsPkg(string pkgFilePath) { try { PkgHeader header = new PkgHeader(pkgFilePath); return(header.IsValid()); } catch (Exception ex) { // If an exception is received, assume that the header could not be parsed successfully return(false); } }
/// <summary> /// Whether the given path is a valid .pkg file. /// </summary> /// <param name="pkgFilePath">path to the .pkg file to validate.</param> /// <returns>true if value, false otherwise.</returns> public static bool IsPkg(string pkgFilePath) { try { PkgHeader header = new PkgHeader(pkgFilePath); return(header.IsValid()); } catch (Exception ex) { // If an exception is received, assume that the header could not be parsed successfully Console.WriteLine("Could not parse pkg header, this is likely not a pkg: {0}", ex.Message); return(false); } }