本文整理汇总了C#中ProjectItem.FilenameAsRelativePath方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectItem.FilenameAsRelativePath方法的具体用法?C# ProjectItem.FilenameAsRelativePath怎么用?C# ProjectItem.FilenameAsRelativePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectItem
的用法示例。
在下文中一共展示了ProjectItem.FilenameAsRelativePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
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));
}
示例2: ItemRemoved
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);
}
示例3: ItemRenamed
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);
}