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 void FindLogFileParserTest()
        {
            PluginFactory.Reset();
            PluginFactory.LoadPlugins(pluginPath);

            IParserFactory lfp = PluginFactory.FindLogFileParser("dummy.csv");

            IsTypenameSame(lfp.GetType(), typeof(Sample_Crunch.StandardPanels.CsvParserFactory));
        }
Exemple #3
0
        private FileModel MockAddFile(string filename, IParserFactory parser)
        {
            FileModel file = new FileModel();

            file.FileName       = filename;
            file.Title          = System.IO.Path.GetFileNameWithoutExtension(file.FileName);
            file.DataParserType = parser.GetType().FullName;

            // Show settings dialog and exit if canceled
            file.Settings.Write("Delimiter", ';');
            file.Settings.Write("TimeVector", 0);

            return(file);
        }
Exemple #4
0
        public void AddLogFile(string filename, IParserFactory parser)
        {
            FileModel file = new FileModel();

            file.FileName = filename;
            file.Title    = System.IO.Path.GetFileNameWithoutExtension(file.FileName);

            int count = Files.Count(f => f.Title == file.Title);

            if (count > 0)
            {
                file.Title += $" ({count+1})";
            }

            try
            {
                ParserSettings settings = file.Settings;
                // Show settings dialog and exit if canceled
                if (!parser.ShowSettingsDialog(filename, ref settings))
                {
                    return;
                }
                file.Settings = settings;
            }
            catch (IOException ioe)
            {
                throw new IOException("Can no open file", ioe);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
                throw;
            }

            file.DataParserType = parser.GetType().FullName;
            this.ProjectModel.Files.Add(file);
        }