public void SingleZipInZipProcess(string sourcePath) { try { var zipEntryNameList = new List <string>(); using (var firstLevelZipFile = ZipFile.Read(sourcePath)) { foreach (var zipEntry in firstLevelZipFile.Where(x => x.FileName.ToUpper().EndsWith(".ZIP"))) { using (var ms = new MemoryStream()) { zipEntry.Extract(ms); ms.Position = 0; using (var zipFile = ZipFile.Read(ms)) { foreach (var entry in zipFile.Where(x => x.FileName.ToUpper().EndsWith(".XML"))) { try { _log.Trace($"{zipEntry.FileName}"); Console.SetCursorPosition(0, Console.CursorTop - 1); using (StreamReader sr = new StreamReader(entry.OpenReader())) { var el = XElement.Parse(sr.ReadToEnd()); var newWOFullText = new NewWOFullText(_woFullTextDataSource, sourcePath, zipEntry.FileName); if (newWOFullText.Parse(el)) { insert(newWOFullText, sourcePath, entry.FileName); } } } catch (Exception e) { _log.Error(sourcePath); _log.Error(zipEntry.FileName); _log.Error(entry.FileName); _log.Error(e.Message); } } } } } } } catch (Exception e) { _log.Error(sourcePath); _log.Error(e.Message); } Conn.Close(); }
private void SingleZipProcess(string sourcePath) { try { using (var zipFile = ZipFile.Read(sourcePath)) { foreach (var entry in zipFile.Where(x => x.FileName.ToUpper().EndsWith(".XML"))) { try { _log.Trace($"{entry.FileName}"); Console.SetCursorPosition(0, Console.CursorTop - 1); using (StreamReader sr = new StreamReader(entry.OpenReader())) { var el = XElement.Parse(sr.ReadToEnd()); var newWOFullText = new NewWOFullText(_woFullTextDataSource, sourcePath, entry.FileName); if (newWOFullText.Parse(el)) { insert(newWOFullText, sourcePath, entry.FileName); } } } catch (Exception e) { _log.Error(sourcePath); _log.Error(entry.FileName); _log.Error(e.Message); } } } } catch (Exception e) { _log.Error(sourcePath); _log.Error(e.Message); } }