private static int StageLocalizationDataForCulture(DeploymentContext SC, string CultureName, string SourceDirectory, string DestinationDirectory = null, bool bRemap = true) { int FilesAdded = 0; string[] LocaleTags = CultureName.Split('_'); List <string> PotentialParentCultures = new List <string>(); if (LocaleTags.Length > 0) { if (LocaleTags.Length > 1 && LocaleTags.Length > 2) { PotentialParentCultures.Add(string.Join("_", LocaleTags[0], LocaleTags[1], LocaleTags[2])); } if (LocaleTags.Length > 2) { PotentialParentCultures.Add(string.Join("_", LocaleTags[0], LocaleTags[2])); } if (LocaleTags.Length > 1) { PotentialParentCultures.Add(string.Join("_", LocaleTags[0], LocaleTags[1])); } PotentialParentCultures.Add(LocaleTags[0]); } string[] FoundDirectories = CommandUtils.FindDirectories(true, "*", false, new string[] { SourceDirectory }); foreach (string FoundDirectory in FoundDirectories) { string DirectoryName = CommandUtils.GetLastDirectoryName(FoundDirectory); string CanonicalizedPotentialCulture = DirectoryName.Replace('-', '_'); if (PotentialParentCultures.Contains(CanonicalizedPotentialCulture)) { FilesAdded += SC.StageFiles(StagedFileType.UFS, CombinePaths(SourceDirectory, DirectoryName), "*.locres", true, null, DestinationDirectory != null ? CombinePaths(DestinationDirectory, DirectoryName) : null, true, bRemap); } } return(FilesAdded); }