private static PackageProject ExtractPackageProject(string fileName) { PackageProject packageProject = null; using (var packageReader = ZipFile.Open(fileName, ZipArchiveMode.Read)) { var packageEntry = packageReader.GetEntry("package.zip"); if (packageEntry == null) { return(null); } using (var memoryStream = new MemoryStream()) { StreamUtils.CopyStream(packageEntry.Open(), memoryStream, 0x4000); memoryStream.Seek(0, SeekOrigin.Begin); using (var reader = new ZipArchive(memoryStream)) { foreach (var entry in reader.Entries) { if (!entry.FullName.Is(Constants.ProjectKey)) { continue; } packageProject = IOUtils.LoadSolution(StreamUtil.LoadString(entry.Open())); break; } } } } return(packageProject); }
private static PackageProject ExtractPackageProject(string fileName) { PackageProject packageProject = null; using (var packageReader = new ZipReader(fileName)) { var packageEntry = packageReader.GetEntry("package.zip"); using (var memoryStream = new MemoryStream()) { StreamUtils.CopyStream(packageEntry.GetStream(), memoryStream, 0x4000); memoryStream.Seek(0, SeekOrigin.Begin); using (var reader = new ZipReader(memoryStream)) { foreach (var entry in reader.Entries) { if (!entry.Name.Is("installer/project")) { continue; } packageProject = IOUtils.LoadSolution(StreamUtil.LoadString(entry.GetStream())); break; } } } } return(packageProject); }