private static void NewTemplateItemInSolutionFolder(string path, string itemTypeName, Solution2 sln, NewItemDynamicParameters p, SolutionFolder folder) { var destinationPath = Path.Combine( Path.GetDirectoryName(sln.FullName), path ); try { var n = sln.GetProjectTemplate(itemTypeName, p.Category); folder.AddFromTemplate(n, destinationPath, path); } catch (FileNotFoundException) { var n = sln.GetProjectItemTemplate(itemTypeName, p.Category); folder.AddFromTemplate(n, destinationPath, path); } }
private static void AddFromItemTypeName(Project project, ProjectItems items, string path, string itemTypeName, NewItemDynamicParameters p, Solution2 sln) { if ("folder" == itemTypeName.ToLowerInvariant()) { if (project.Object is SolutionFolder) { var folder = project.Object as SolutionFolder; folder.AddSolutionFolder(path); } else { items.AddFolder(path, Constants.vsProjectItemKindPhysicalFolder); } } else { if (!itemTypeName.ToLowerInvariant().EndsWith(".zip")) { itemTypeName += ".zip"; } p.Category = GetSafeCategoryValue(p.Category, project.CodeModel); //todo: validate p.Category against available item/project tmps if (project.Object is SolutionFolder) { SolutionFolder folder = project.Object as SolutionFolder; NewTemplateItemInSolutionFolder(path, itemTypeName, sln, p, folder); } else { var t = sln.GetProjectItemTemplate(itemTypeName, p.Category); items.AddFromTemplate(t, path); } } }
private static void AddFromItemFilePath(Project project, ProjectItems items, NewItemDynamicParameters p) { items.AddFromFileCopy(p.ItemFilePath); }
private static void NewTemplateItemInSolutionFolder(string path, string itemTypeName, Solution2 sln, NewItemDynamicParameters p, SolutionFolder folder) { var destinationPath = Path.Combine( Path.GetDirectoryName(sln.FullName), path ); try { var n = sln.GetProjectTemplate(itemTypeName, p.Category); folder.AddFromTemplate(n, destinationPath, path); } catch (FileNotFoundException) { var n = sln.GetProjectItemTemplate(itemTypeName, p.Category); folder.AddFromTemplate(n, destinationPath, path); } }
private static void AddFromItemTypeName(Project project, ProjectItems items, string path, string itemTypeName, NewItemDynamicParameters p, Solution2 sln) { if ("folder" == itemTypeName.ToLowerInvariant()) { if (project.Object is SolutionFolder) { var folder = project.Object as SolutionFolder; folder.AddSolutionFolder(path); } else { items.AddFolder(path, Constants.vsProjectItemKindPhysicalFolder); } } else { if (!itemTypeName.ToLowerInvariant().EndsWith(".zip")) { itemTypeName += ".zip"; } p.Category = GetSafeCategoryValue(p.Category, project.CodeModel); //todo: validate p.Category against available item/project tmps if (project.Object is SolutionFolder) { SolutionFolder folder = project.Object as SolutionFolder; NewTemplateItemInSolutionFolder(path, itemTypeName, sln, p, folder); } else { var t = sln.GetProjectItemTemplate(itemTypeName, p.Category); items.AddFromTemplate(t, path); } } }
private static void AddFromItemFilePath(Project project, ProjectItems items, NewItemDynamicParameters p) { items.AddFromFileCopy(p.ItemFilePath); }