private DbSetSettings GetSettings(bool cached) { if (cached) { if (_settingsCached == null) { _settingsCached = GetSettings(false); } return(_settingsCached); } var fileName = _fileManager.CombineDirectories(_inDir, FileEngineDefaults.SetSettingsName); if (!_fileManager.FileExists(fileName)) { ChangeSettings(new DbSetSettings(), false); } try { var serializer = new XmlSerializer(typeof(DbSetSettings)); var settings = new XmlReaderSettings(); using (var textReader = new StreamReader(_fileManager.FileReadStream(fileName))) { var xmlReader = XmlReader.Create(textReader, settings); return((serializer.Deserialize(xmlReader) as DbSetSettings) ?? new DbSetSettings()); } } catch (InvalidOperationException) // XML niet in juiste format { //ChangeSettings(nieuw, false); return(new DbSetSettings()); } }
private ZipArchive GetZip() { if (_archiveStream == null) { _archiveStream = _fileManager.FileReadStream(_fileManager.CombineDirectories(_atDir, _setName)); } return(_archive ?? (_archive = new ZipArchive(_archiveStream, ZipArchiveMode.Read))); }