public TulPackageParser(string rootPath) { _rootPath = rootPath; var manifest_file = Path.Join(rootPath, "manifest.xml"); Xmanifest = XDocument.Load(manifest_file); using var fileStream = File.Open(manifest_file, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(ServiceEditionVersion)); _manifest = (ServiceEditionVersion)serializer.Deserialize(fileStream); }
/// <summary> /// Set up InfoPath parser, extract /// </summary> /// <param name="zipPath">Path to service zip file</param> /// <param name="outputPath">Path to store output files</param> /// <param name="command">The command that was used</param> /// <param name="tmpDir">The temporary directory where extracted files are stored</param> public static ServiceEditionVersion RunSetup(string zipPath, string outputPath, string command, string tmpDir) { if (File.Exists(zipPath)) { ZipFile.ExtractToDirectory(zipPath, tmpDir); SetupOutputDir(outputPath, command); using var fileStream = File.Open(Path.Join(tmpDir, "manifest.xml"), FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(ServiceEditionVersion)); ServiceEditionVersion serviceEditionVersion = (ServiceEditionVersion)serializer.Deserialize(fileStream); return(serviceEditionVersion); } throw new Exception("Unable to extract service from provided zip file path. Please check that the path is correct."); }