private void FileListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selectedFile = FileListBox.SelectedItem as CodeAnalyzerFile; if (selectedFile == null) { return; } var ownerUsername = selectedFile.Username; var selectedFolder = FolderListBox.SelectedItem as string; // Create a memory stream from the file so we can feed it to the parser var fileStream = _Client.CheckOut(ownerUsername, selectedFile.Name, selectedFolder); var stream = new MemoryStream(); fileStream.CopyTo(stream); stream.Position = 0; var list = new List <Stream>(); list.Add(stream); // Generate report var reportFilename = (Path.GetFileNameWithoutExtension(selectedFile.Name) + "-report.xml");; var xmlFileStream = File.Create(reportFilename); var parsed = ParserProcess.ParseFiles(list); try { var xs = new XmlSerializer(typeof(List <ElementProperty>)); xs.Serialize(xmlFileStream, parsed.ToList()); xmlFileStream.Close(); } catch (Exception ex) { MessageBox.Show("There was a problem writing the XML report file", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBox.Show("Report was successfully written to file.", "XML Report", MessageBoxButton.OK, MessageBoxImage.Information); //var doc = new XmlDocument(); //doc.Load("sample.xml"); //var root = doc.DocumentElement; if (fileDetails == null) { fileDetails = new FileDetails { ParentWindow = this, ReportFileName = reportFilename }; fileDetails.Show(); } }
public List <CargoModel> GetExcel() { logger.Debug("Запущен метод GetExcel"); ParserProcess Pars = new ParserProcess(); logger.Debug("Вызван ParsExcel"); Pars.ParsExcel(); logger.Debug("Вызван Saver"); Pars.Saver(); logger.Debug("Метод GetExcel завершён"); return(null); }
public ParserWorker(ParserProcess parserProcess, IOptions <ParserConfig> config) { this.parserProcess = parserProcess; this.config = config.Value; }