public static void ItemRemoved(ProjectItem projectItem) { CopiedFiles.Remove(projectItem.FilenameAsRelativePath()); //var startupProject = Infrastructure.Core.Instance.StartupProject; //var existingFile = startupProject.Combine(projectItem.FilenameAsRelativePath()); //if (File.Exists(existingFile)) //File.Delete(existingFile); }
public static void Add(Project destination, ProjectItem projectItem) { if (!_relativeFilenames.Select(m => m.Name).Contains(projectItem.FilenameAsRelativePath())) _relativeFilenames.Add(new RelativeFile(projectItem.FilenameAsRelativePath())); var saveTo = destination.Combine(projectItem.FilenameAsRelativePath()); Directory.CreateDirectory(Path.GetDirectoryName(saveTo)); if (File.Exists(saveTo)) File.Delete(saveTo); File.Copy(projectItem.FileNames[0], saveTo, true); if (File.GetAttributes(saveTo).HasFlag(FileAttributes.ReadOnly)) File.SetAttributes(saveTo, File.GetAttributes(saveTo) & ~FileAttributes.ReadOnly); OutputWindow.Log(String.Format("Suctioning '{0}'", saveTo)); }
public static void Add(Project destination, ProjectItem projectItem) { if (!_relativeFilenames.Select(m => m.Name).Contains(projectItem.FilenameAsRelativePath())) { _relativeFilenames.Add(new RelativeFile(projectItem.FilenameAsRelativePath())); } var saveTo = destination.Combine(projectItem.FilenameAsRelativePath()); Directory.CreateDirectory(Path.GetDirectoryName(saveTo)); if (File.Exists(saveTo)) { File.Delete(saveTo); } File.Copy(projectItem.FileNames[0], saveTo, true); if (File.GetAttributes(saveTo).HasFlag(FileAttributes.ReadOnly)) { File.SetAttributes(saveTo, File.GetAttributes(saveTo) & ~FileAttributes.ReadOnly); } OutputWindow.Log(String.Format("Suctioning '{0}'", saveTo)); }
public static void ItemRenamed(ProjectItem projectItem, string oldName) { // Write the new file to disk and clean up the old. ItemAdded(projectItem); // Remove the old file, so we need to sub out the name name with the old. var oldRelativeFilePath = projectItem.FilenameAsRelativePath().Replace(Path.GetFileName(projectItem.FileNames[0]), oldName); CopiedFiles.Remove(oldRelativeFilePath); //var startupProject = Infrastructure.Core.Instance.StartupProject; //var existingFile = startupProject.Combine(projectItem.FilenameAsRelativePath()); //var old = Path.Combine(Path.GetDirectoryName(existingFile), oldName); //if (File.Exists(old)) //File.Delete(old); }