IMediaBasedReaderFactory CreateReaderFactory() { var repo = new ResourcesFormatsRepository(System.Reflection.Assembly.GetExecutingAssembly()); ILogProviderFactoryRegistry reg = new LogProviderFactoryRegistry(); IUserDefinedFormatsManager formatsManager = new UserDefinedFormatsManager(repo, reg, new TempFilesManager()); LogJoint.RegularGrammar.UserDefinedFormatFactory.Register(formatsManager); formatsManager.ReloadFactories(); return(reg.Find("David Marshall", "OSWtop") as IMediaBasedReaderFactory); }
private void ParseAndVerifyLog(ExpectedLog expectedLog, string logContent, XmlDocument formatDocument) { var formatXml = formatDocument.OuterXml; var repo = new TestFormatsRepository(XDocument.Parse(formatXml).Root); ILogProviderFactoryRegistry reg = new LogProviderFactoryRegistry(); IUserDefinedFormatsManager formatsManager = new UserDefinedFormatsManager(repo, reg, tempFilesManager); RegularGrammar.UserDefinedFormatFactory.Register(formatsManager); formatsManager.ReloadFactories(); ReaderIntegrationTest.Test(reg.Find("Test", "Test") as IMediaBasedReaderFactory, logContent, expectedLog, Encoding.UTF8); }
public static IMediaBasedReaderFactory CreateFactoryFromAssemblyResource(Assembly asm, string companyName, string formatName) { var repo = new ResourcesFormatsRepository(asm); ILogProviderFactoryRegistry reg = new LogProviderFactoryRegistry(); IUserDefinedFormatsManager formatsManager = new UserDefinedFormatsManager(repo, reg, tempFilesManager, new TraceSourceFactory()); LogJoint.RegularGrammar.UserDefinedFormatFactory.Register(formatsManager); LogJoint.XmlFormat.UserDefinedFormatFactory.Register(formatsManager); formatsManager.ReloadFactories(); var factory = reg.Find(companyName, formatName); Assert.IsNotNull(factory); return(factory as IMediaBasedReaderFactory); }
public static IMediaBasedReaderFactory CreateFactoryFromAssemblyResource(Assembly asm, string companyName, string formatName) { var repo = new DirectoryFormatsRepository(Path.Combine(Path.GetDirectoryName(asm.Location), "formats")); ILogProviderFactoryRegistry reg = new LogProviderFactoryRegistry(); IUserDefinedFormatsManager formatsManager = new UserDefinedFormatsManager(repo, reg, tempFilesManager, new TraceSourceFactory(), RegularExpressions.FCLRegexFactory.Instance, Mocks.SetupFieldsProcessorFactory()); LogJoint.RegularGrammar.UserDefinedFormatFactory.Register(formatsManager); LogJoint.XmlFormat.UserDefinedFormatFactory.Register(formatsManager); formatsManager.ReloadFactories(); var factory = reg.Find(companyName, formatName); Assert.IsNotNull(factory); return(factory as IMediaBasedReaderFactory); }