private void GetProjectInfos() { var potentialReadMes = Directory.EnumerateFiles(Path.GetDirectoryName(_coreConfigSection.InputPath), "*readme*"); if (potentialReadMes.Any()) { foreach (var readme in potentialReadMes) { var splitted = Path.GetFileName(readme).Split('.'); if (splitted.Length > 0 && CultureInfo.GetCultures(CultureTypes.NeutralCultures).Any(c => c.TwoLetterISOLanguageName == splitted[0].ToLower())) { if (!_repository.ProjectInfo.Description.ContainsKey(splitted[0].ToLower())) { _repository.ProjectInfo.Description.Add(splitted[0].ToLower(), File.ReadAllText(readme)); _repository.AddDocumentationLanguage(splitted[0].ToLower()); } } else if (splitted.Length > 0 && splitted[0].ToLower() == "readme" && !_repository.ProjectInfo.Description.ContainsKey("default")) { _repository.ProjectInfo.Description.Add("default", File.ReadAllText(readme)); } } } else { _repository.ProjectInfo.Description.Add("default", _coreConfigSection.Description); } _repository.ProjectInfo.DocLanguage = _coreConfigSection.DocLanguage; _repository.ProjectInfo.LogoPath = _coreConfigSection.LogoPath; _repository.ProjectInfo.Author = _coreConfigSection.Author; _repository.ProjectInfo.ProjectName = _coreConfigSection.ProjectName; _repository.ProjectInfo.VersionNumber = _coreConfigSection.VersionNumber; }
public Dictionary <string, SDDocumentation> ParseDocumentation(IEntity entity) { var docDic = new Dictionary <string, SDDocumentation>(); try { if (entity != null) { var xmlDoc = XmlDocumentationElement.Get(entity); if (xmlDoc != null) { foreach (XmlDocumentationElement child in xmlDoc.Children) { if (CultureInfo.GetCultures(CultureTypes.NeutralCultures).Any(c => c.TwoLetterISOLanguageName == child.Name.ToLower()) || child.Name.ToLower() == "default") { _sdRepository.AddDocumentationLanguage(child.Name.ToLower()); var languageDoc = ParseDocumentation(child.Children); docDic.Add(child.Name.ToLower(), languageDoc); } } //Es wurde keine Sprachunterstützung in der Doku genutzt. //Deswegen wird die Doku einfach als "default" geladen. if (docDic.Count == 0) { var defaultDoc = ParseDocumentation(xmlDoc.Children); docDic.Add("default", defaultDoc); } } } } catch (NullReferenceException ex) { Trace.TraceError(ex.ToString()); } return(docDic); }