/// <summary> /// Returns an instance of an ldml in folder writing system reposistory. /// </summary> /// <param name="basePath">base location of the global writing system repository</param> /// <param name="customDataMappers">The custom data mappers.</param> /// <param name="globalRepository">The global repository.</param> /// <param name="migrationHandler">Callback if during the initialization any writing system id's are changed</param> /// <param name="loadProblemHandler">Callback if during the initialization any writing systems cannot be loaded</param> /// <returns></returns> public static LdmlInFolderWritingSystemRepository Initialize( string basePath, IEnumerable <ICustomDataMapper <WritingSystemDefinition> > customDataMappers, GlobalWritingSystemRepository globalRepository = null, Action <int, IEnumerable <LdmlMigrationInfo> > migrationHandler = null, Action <IEnumerable <WritingSystemRepositoryProblem> > loadProblemHandler = null ) { var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(basePath, migrationHandler); migrator.Migrate(); var instance = new LdmlInFolderWritingSystemRepository(basePath, customDataMappers, globalRepository); migrator.ResetRemovedProperties(instance); // Call the loadProblemHandler with both migration problems and load problems var loadProblems = new List <WritingSystemRepositoryProblem>(); loadProblems.AddRange(migrator.MigrationProblems); loadProblems.AddRange(instance.LoadProblems); if (loadProblems.Count > 0 && loadProblemHandler != null) { loadProblemHandler(loadProblems); } return(instance); }
public LdmlInFolderWritingSystemFactory(LdmlInFolderWritingSystemRepository <WritingSystemDefinition> writingSystemRepository) : base(writingSystemRepository) { }