#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
1.1 KiB

// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.PackageManagement.EnvDTE
{
public class ProjectItems
{
Project project;
IPackageManagementFileService fileService;
public ProjectItems(Project project, IPackageManagementFileService fileService)
{
this.project = project;
this.fileService = fileService;
}
public void AddFromFileCopy(string filePath)
{
string include = Path.GetFileName(filePath);
CopyFileIntoProject(filePath, include);
project.AddFile(include);
project.Save();
}
void CopyFileIntoProject(string oldFileName, string fileName)
{
string newFileName = GetFileNameInProject(fileName);
fileService.CopyFile(oldFileName, newFileName);
}
string GetFileNameInProject(string fileName)
{
return Path.Combine(project.MSBuildProject.Directory, fileName);
}
}
}