public PsaTrace Create() { PsaTrace trace = new PsaTrace(); GetGeneralTraceProperties(trace); foreach (PsaParametersSet set in LexiaScreensToPsaParametersSetConverter.Convert( LexiaScreensExtractor.GetScreens(traceFile))) { trace.ParametersSets.Add(set); } UnrecognizedDataKeeper.AnalyseTrace(trace, relatedFiles); return(trace); }
private void CheckTraceRecognized(PsaTrace trace, FileInfo file) { if (trace.ParametersSets.Any(ps => ps.Parameters.Any(p => p.Type == PsaParameterType.Unsupported))) { string fileName = file.FullName; PeugeotAdditionalFilePathSearcher searcher = new PeugeotAdditionalFilePathSearcher( PsaConnectorSubtype.Trace, file.FullName); IList <string> files = new List <string>(searcher.Search()); files.Add(fileName); UnrecognizedDataKeeper.AnalyseTrace(trace, files); } }
public IEnumerable <PsaTraceInfo> Retrieve() { DirectoryInfo dataDirectory = new DirectoryInfo(dataPath); foreach (FileInfo traceFile in dataDirectory.EnumerateFiles("*.xml")) { CitroenTracePsaTraceFactory factory = new CitroenTracePsaTraceFactory(traceFile.FullName); PsaTrace result = factory.Create(); UnrecognizedDataKeeper.AnalyseTrace(result, traceFile.FullName); PsaTraceMetadata md = new PsaTraceMetadata { SourceXmlPath = traceFile.FullName, Connector = DiagnosticSystemType.Lexia, Subtype = PsaConnectorSubtype.Trace }; foreach (string add in GetAdditionalFilePaths(dataDirectory, traceFile.FullName)) { md.AdditionalFilePaths.Add(add); } yield return(new PsaTraceInfo(result, md)); } }
public PsaTrace Create() { LexiaGraphSessionRawData rawData = LexiaScanDataFactory.CreateWithCsv(xmlFile, csvFile); PsaTrace result = LexiaGraphSessionToPsaTraceConverter.Convert(rawData); UpdateWithMetadataIfAvailable(xmlFile, result); IList <string> relatedFiles = new List <string>(); relatedFiles.Add(xmlFile); relatedFiles.Add(csvFile); LexiaAdditionalFilePathSearcher searcher = new LexiaAdditionalFilePathSearcher(xmlFile); foreach (string relatedFile in searcher.Search()) { if (!relatedFiles.Contains(relatedFile)) { relatedFiles.Add(relatedFile); } } UnrecognizedDataKeeper.AnalyseTrace(result, relatedFiles); return(result); }
private void ExportUnrecognized() { UnrecognizedDataExportTypeSelectionWindow w = new UnrecognizedDataExportTypeSelectionWindow(); w.Owner = MainWindowKeeper.MainWindowInstance as Window; bool?result = w.ShowDialog(); if (result.HasValue && result.Value) { if (w.IsManually) { string file = SelectFile(); if (String.IsNullOrEmpty(file)) { return; } UnrecognizedDataKeeper.ExportUnrecognizedData(file); UnrecognizedDataExportedWindow window = new UnrecognizedDataExportedWindow(); window.Owner = MainWindowKeeper.MainWindowInstance as Window; window.ShowDialog(); } else if (w.IsAutomatically) { Stream dataStream = null; MemoryStream str = null; try { dataStream = UnrecognizedDataKeeper.GetDataStream(); str = new MemoryStream(); dataStream.Position = 0; dataStream.CopyTo(str); str.Position = 0; } catch (Exception) { if (dataStream != null) { dataStream.Close(); } str.Close(); throw; } try { VtsWebServiceClient client = new VtsWebServiceClient(); client.ReportUnrecognizedData(str); if (!(MainWindowKeeper.MainWindowInstance is Window)) { throw new ApplicationException("Main window should have already been here!"); } MessageBox.Show(MainWindowKeeper.MainWindowInstance as Window, CodeBehindStringResolver.Resolve( "UnrecognizedDataReportedSuccessfullyMessage"), "Success", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception e) { ErrorWindow wnd = new ErrorWindow(e, e.Message); wnd.Owner = MainWindowKeeper.MainWindowInstance as Window; wnd.ShowDialog(); } } else { throw new ArgumentException(); } } }