public override void ProjectItemFinishedGenerating(ProjectItem item) { var path = item.FileNames[0]; item.Remove(); var name = Path.GetFileName(path).Replace(tempExtension, ""); var location = form.location; var outPath = Path.Combine(location, name); Directory.CreateDirectory(location); File.Move(path, outPath); //CLInlcude "FIX" var parent = ProjectUtilities.GetCurrentParentFilter(dte); try { parent.AddFromFile(outPath); } catch {} //Don't open .ui file if (Path.GetExtension(name) == ".ui") { return; } var outItem = ProjectUtilities.GetProjectItemByPath(project, outPath); outItem.Open().Activate(); }
public static bool CheckFile(string path) { //Check exists path //( if true - replace original ) if (ProjectUtilities.GetProjectItemByPath(project, path) != null) { return(false); } //Check exists in current filter //( if true - no error, two elements in same name ) var fileName = Path.GetFileName(path); var parent = ProjectUtilities.GetCurrentParentFilter(dte); foreach (ProjectItem item in parent) { if (item.Name == fileName) { return(false); } } return(true); }