public void Initialise() { _isInitialised = true; using (ICompressedConfigFile tempFile = new ZipCompressedConfigFile(_configFile)) { if (tempFile.HasEntry("export.config")) { Stream stream = tempFile.GetEntry("export.config"); _xmlDocument = new XmlDocument(); _xmlDocument.LoadXml(new StreamReader(stream).ReadToEnd()); stream.Close(); ReadConfigurationDetails(); CheckIsValid(tempFile); } } }
/// <summary> /// Saves all of the registered output files in the export configuration file /// to the specified location. /// </summary> /// <param name="location">The location.</param> public virtual void SaveOutputFilesTo(string location) { CheckIfInitialised(); using (ICompressedConfigFile compressedFile = new ZipCompressedConfigFile(_configFile)) { XmlNodeList files = _xmlDocument.SelectNodes("export/outputfiles/file"); foreach (XmlNode current in files) { string from = current.Attributes["internal"] == null ? string.Empty : current.Attributes["internal"].Value; string to = current.Attributes["output"] == null ? string.Empty : current.Attributes["output"].Value; if (string.IsNullOrEmpty(from) || string.IsNullOrEmpty(to)) { continue; } if (compressedFile.HasEntry(from)) { compressedFile.ExtractEntry(from, location); } } } }
public virtual List <string> GetOutputFileURLs() { CheckIfInitialised(); List <string> urls = new List <string>(); using (ICompressedConfigFile compressedFile = new ZipCompressedConfigFile(_configFile)) { XmlNodeList files = _xmlDocument.SelectNodes("/export/outputfiles/file"); foreach (XmlNode current in files) { string from = current.Attributes["internal"] == null ? string.Empty : current.Attributes["internal"].Value; string to = current.Attributes["output"] == null ? string.Empty : current.Attributes["output"].Value; if (string.IsNullOrEmpty(from) || string.IsNullOrEmpty(to)) { continue; } if (compressedFile.HasEntry(from)) { CompressedFileEntry details = compressedFile.GetEntryDetails(from); if (details.IsDirectory) { urls.Add(details.FileName + "*.*"); } else { urls.Add(details.FileName); } } } } return(urls); }