/// <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); }
///<summary> /// This initializer is intended for tests as it allows setting of the basePath explicitly. ///</summary> internal static GlobalWritingSystemRepository InitializeWithBasePath(string basePath, Action <int, IEnumerable <LdmlMigrationInfo> > migrationHandler) { var migrator = new GlobalWritingSystemRepositoryMigrator(basePath, migrationHandler); if (migrator.NeedsMigration()) { migrator.Migrate(); } var globalRepo = new GlobalWritingSystemRepository(basePath); migrator.ResetRemovedProperties(globalRepo); return(globalRepo); }
protected internal LdmlInFolderWritingSystemRepository(string basePath, IEnumerable <ICustomDataMapper <WritingSystemDefinition> > customDataMappers, GlobalWritingSystemRepository globalRepository = null) : base(basePath, customDataMappers, globalRepository) { }
protected internal LdmlInFolderWritingSystemRepository(string basePath, GlobalWritingSystemRepository <WritingSystemDefinition> globalRepository = null) : base(basePath, globalRepository) { }