public static bool TryOpen(Stream stream, bool ownsStream, out PAKFileSystem archive) { var version = DetectVersion(stream); if (version == FormatVersion.Unknown) { archive = null; return(false); } archive = new PAKFileSystem(stream, ownsStream, version); return(true); }
public static bool TryOpen(string filepath, out PAKFileSystem archive) { var stream = File.OpenRead(filepath); bool success = TryOpen(stream, true, out archive); if (!success) { stream.Dispose(); } else { archive.FilePath = filepath; } return(success); }