public void FindParserTest() { PluginFactory.Reset(); PluginFactory.LoadPlugins(pluginPath); Type factoryType = typeof(Sample_Crunch.StandardPanels.CsvParserFactory); IParserFactory lfp = PluginFactory.FindParser(factoryType.FullName); IsTypenameSame(lfp.GetType(), factoryType); }
public FileViewModel(IProjectViewModel parentProject, IFileModel fileData) { this.project = parentProject; this.fileData = fileData; try { // Try to use specified factory var parserFactory = PluginFactory.FindParser(fileData.DataParserType); // If not available use any other able to use open that format if (parserFactory == null) { parserFactory = PluginFactory.FindLogFileParser(fileData.FileName); } if (parserFactory == null) { throw new InvalidOperationException("No parser for " + fileData.FileName + " available."); } this.LogFile = parserFactory.Open(fileData.FileName, fileData.Settings); } catch (IOException ioe) { throw new IOException("Can no open file", ioe); } catch (Exception ex) { Trace.WriteLine(ex.ToString()); throw; } this.Icon = ResourceHelper.SetIconFromBitmap(Properties.Resources.folder); signalViewModels = new ObservableCollection <ISignalViewModel>(); foreach (Signal s in LogFile.Signals) { SignalViewModel subitem = new SignalViewModel(this, s); this.Signals.Add(subitem); } foreach (IMarkerModel m in fileData.Markers) { MarkerViewModel markerItem = new MarkerViewModel(m, false); this.Markers.Add(markerItem); } markerViewModels.CollectionChanged += MarkerViewModels_CollectionChanged; }