private void AddProjectItems([NotNull] ResourceEntity entity, [NotNull] ResourceLanguage neutralLanguage, [NotNull] string languageFileName) { DteProjectFile projectFile = null; foreach (var neutralLanguageProjectItem in ((DteProjectFile)neutralLanguage.ProjectFile).ProjectItems) { var collection = neutralLanguageProjectItem.Collection; var projectItem = collection.AddFromFile(languageFileName); var containingProject = projectItem.ContainingProject; var projectName = containingProject.Name; if (projectFile == null) { projectFile = new DteProjectFile(_compositionHost.GetExportedValue <DteSolution>(), languageFileName, projectName, containingProject.UniqueName, projectItem); } else { projectFile.AddProject(projectName, projectItem); } } if (projectFile != null) { entity.AddLanguage(projectFile); } }
private void AddProjectItems(ResourceEntity entity, ResourceLanguage neutralLanguage, string languageFileName) { Contract.Requires(entity != null); Contract.Requires(neutralLanguage != null); Contract.Requires(!string.IsNullOrEmpty(languageFileName)); DteProjectFile projectFile = null; foreach (var neutralLanguageProjectItem in ((DteProjectFile)neutralLanguage.ProjectFile).ProjectItems) { Contract.Assume(neutralLanguageProjectItem != null); var collection = neutralLanguageProjectItem.Collection; Contract.Assume(collection != null); var projectItem = collection.AddFromFile(languageFileName); Contract.Assume(projectItem != null); var containingProject = projectItem.ContainingProject; Contract.Assume(containingProject != null); var projectName = containingProject.Name; Contract.Assume(projectName != null); if (projectFile == null) { projectFile = new DteProjectFile(_compositionHost.GetExportedValue <DteSolution>(), languageFileName, projectName, containingProject.UniqueName, projectItem); } else { projectFile.AddProject(projectName, projectItem); } } if (projectFile != null) { entity.AddLanguage(projectFile); } }