///<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="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>
        ///<param name="compatibilityMode"></param>
        public static LdmlInFolderWritingSystemRepository Initialize(
            string basePath,
            LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler,
            WritingSystemLoadProblemHandler loadProblemHandler,
            WritingSystemCompatibility compatibilityMode
            )
        {
            var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(basePath, migrationHandler, compatibilityMode);

            migrator.Migrate();

            var instance = new LdmlInFolderWritingSystemRepository(basePath, compatibilityMode);

            instance.LoadAllDefinitions();

            // 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>
		/// 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="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>
		public static LdmlInFolderWritingSystemRepository Initialize(
			string basePath,
			LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler,
			WritingSystemLoadProblemHandler loadProblemHandler
		)
		{
			return Initialize(basePath, migrationHandler, loadProblemHandler, WritingSystemCompatibility.Strict);
		}
 ///<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="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>
 public static LdmlInFolderWritingSystemRepository Initialize(
     string basePath,
     LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler,
     WritingSystemLoadProblemHandler loadProblemHandler
     )
 {
     return(Initialize(basePath, migrationHandler, loadProblemHandler, WritingSystemCompatibility.Strict));
 }
Example #4
0
 public WritingSystemSetupDialog(
     string writingSystemRepositoryPath,
     LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler,
     WritingSystemLoadProblemHandler loadProblemHandler
     ) : this(LdmlInFolderWritingSystemRepository.Initialize(
                  writingSystemRepositoryPath,
                  migrationHandler,
                  loadProblemHandler
                  ))
 {
 }
		public WritingSystemSetupDialog(
			string writingSystemRepositoryPath,
			LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler,
			WritingSystemLoadProblemHandler loadProblemHandler
		) : this(LdmlInFolderWritingSystemRepository.Initialize(
			writingSystemRepositoryPath,
			migrationHandler,
			loadProblemHandler
		))
		{
		}
		///<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="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>
		///<param name="compatibilityMode"></param>
		public static LdmlInFolderWritingSystemRepository Initialize(
			string basePath,
			LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler,
			WritingSystemLoadProblemHandler loadProblemHandler,
			WritingSystemCompatibility compatibilityMode
		)
		{
			var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(basePath, migrationHandler, compatibilityMode);
			migrator.Migrate();

			var instance = new LdmlInFolderWritingSystemRepository(basePath, compatibilityMode);
			instance.LoadAllDefinitions();

			// 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;
		}