public static List <LanguageWithResourcesAndLinks> GetLinksToFiles(List <LanguageWithResources> lwr, List <string> languages, List <string> shortcuts) { List <LanguageWithResourcesAndLinks> result = new List <LanguageWithResourcesAndLinks>(); foreach (var language in languages) { List <ResourceWithLinks> resourcesWithLinks = new List <ResourceWithLinks>(); int index = languages.IndexOf(language); foreach (var item in lwr[index].Resources) { ResourceWithLinks rwl = new ResourceWithLinks() { Name = item, PDFLink = "", ODTLink = "" }; resourcesWithLinks.Add(rwl); } var languageWithRes = new LanguageWithResourcesAndLinks() { Name = lwr[index].Name, Resources = resourcesWithLinks }; if (language != "English") { GetPdfLinks(languageWithRes, shortcuts[languages.IndexOf(language)]); } else { GetPdfLinks(languageWithRes, "de"); } result.Add(languageWithRes); } return(result); }
static void GetPdfLinks(LanguageWithResourcesAndLinks languageWithResourcesAndLinks, string shortcut) { foreach (var item in languageWithResourcesAndLinks.Resources) { Root root = GetRoot(item.Name, shortcut); if (root == null) { item.PDFLink = ""; item.ODTLink = ""; } else { item.PDFLink = GetFileName(root, ".pdf", languageWithResourcesAndLinks.Name); item.ODTLink = GetFileName(root, ".odt", languageWithResourcesAndLinks.Name); } } }