本文整理汇总了C#中ProjectItem.get_FileNames方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectItem.get_FileNames方法的具体用法?C# ProjectItem.get_FileNames怎么用?C# ProjectItem.get_FileNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectItem
的用法示例。
在下文中一共展示了ProjectItem.get_FileNames方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDbContextTemplates
// <summary>
// Adds the DbContext templates for the given EDMX project item if the templates are
// installed and can be used, otherwise does nothing.
// </summary>
// <param name="edmxItem">The project item representing the EDMX model.</param>
// <param name="useLegacyTemplate">A value indicating whether to use the legacy version of the template.</param>
public void AddDbContextTemplates(ProjectItem edmxItem, bool useLegacyTemplate = true)
{
Debug.Assert(edmxItem != null, "edmxItem is null.");
var templatePath = FindDbContextTemplate(edmxItem.ContainingProject, useLegacyTemplate);
if (templatePath != null)
{
try
{
var edmxFilePath = edmxItem.get_FileNames(1);
var edmxFileName = Path.GetFileNameWithoutExtension(edmxFilePath);
AddArtifactGeneratorWizard.EdmxUri = Utils.FileName2Uri(edmxFilePath);
if (!(edmxItem.ProjectItems ?? edmxItem.Collection).OfType<ProjectItem>().Any(
i => string.Equals(i.Name, edmxFileName + ".tt", StringComparison.OrdinalIgnoreCase)))
{
AddAndNestCodeGenTemplates(
edmxItem,
() => edmxItem.Collection.AddFromTemplate(templatePath, edmxFileName));
}
}
finally
{
AddArtifactGeneratorWizard.EdmxUri = null;
}
}
}
示例2: VSProjectItemManager
internal VSProjectItemManager(DTE2 dte, ProjectItem projectItem, string fileNamePrefix)
{
this.dte = dte;
this.projectItem = projectItem;
this.filesAdded = new Dictionary<string, object>();
this.filesCreated = new List<string>();
if (this.projectItem != null)
{
if (string.IsNullOrEmpty(fileNamePrefix))
{
fileNamePrefix = this.GetFileNamePrefix(projectItem.Name);
}
if (projectItem.FileCount > 0)
{
try
{
this.fullFileNamePrefix = Path.GetDirectoryName(projectItem.get_FileNames(0)) + @"\" + fileNamePrefix;
}
catch (System.ArgumentException)
{
//vs.Php raise exception
}
}
}
}
示例3: OnItemRemoved
public void OnItemRemoved(ProjectItem item)
{
P4Operations.EditFile(m_plugin.OutputPane, item.ContainingProject.FullName);
for (int i = 0; i < item.FileCount; i++)
{
string name = item.get_FileNames((short)i);
P4Operations.DeleteFile(m_plugin.OutputPane, name);
}
}
开发者ID:transformersprimeabcxyz,项目名称:_To-Do-unreal-3D-niftyplugins-ben-marsh,代码行数:10,代码来源:AutoAddDelete.cs
示例4: RenameItem
private void RenameItem(ProjectItem item, string newFileName)
{
var templateFile = item.get_FileNames(1);
var newFile = Path.Combine(Path.GetDirectoryName(templateFile), newFileName);
File.Copy(templateFile, newFile);
item.Collection.AddFromFile(newFile);
item.Remove();
File.Delete(templateFile);
}
示例5: CreateFileCodeMerger
/// <summary>
/// Creates the file code merger.
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
public IFileCodeMerger CreateFileCodeMerger(ProjectItem item)
{
if (item == null)
throw new ArgumentNullException("item");
IFileCodeMerger fileCodeMerger;
string activeFileName = DTE.ActiveDocument.ProjectItem.get_FileNames(1);
bool useDocumentMerger = GetTextDocument() != null;
if (useDocumentMerger || item.get_FileNames(1) == activeFileName)
fileCodeMerger = new LuaFileCodeMerger(item);
else
fileCodeMerger = new LuaExternalFileCodeMerger(item);
return fileCodeMerger;
}
示例6: VisitFile
protected FileComponent VisitFile( ProjectItem item )
{
FileComponent file = null;
if( Filter( item ) )
{
m_app.StatusBar.Text = "building stats for " + item.Name;
file = new FileComponent( item.get_FileNames(0), item.Name );
Walker walker = new Walker();
walker.WalkFile( file, item );
}
return file;
}
示例7: ProjectItemFinishedGenerating
public override void ProjectItemFinishedGenerating(ProjectItem projectItem)
{
if (!projectItem.Name.Contains(".g.cs"))
{
_entityRepoFile = projectItem;
}
else
{
//把生成文件变为实体文件的子文件。
if (_entityRepoFile != null)
{
projectItem.Remove();
_entityRepoFile.ProjectItems.AddFromFile(projectItem.get_FileNames(1));
}
}
base.ProjectItemFinishedGenerating(projectItem);
}
示例8: OnItemAdded
public void OnItemAdded(ProjectItem item)
{
P4Operations.EditFile(m_plugin.OutputPane, item.ContainingProject.FullName);
if (item.ProjectItems != null)
{
for (int i = 0; i < item.FileCount; i++)
{
string name = item.get_FileNames((short)i);
P4Operations.AddFile(m_plugin.OutputPane, name);
}
}
else
{
if(System.IO.File.Exists(item.Name))
P4Operations.AddFile(m_plugin.OutputPane, item.Name);
}
}
示例9: DoLaunchUpdateModelFromDatabaseWizard
private static void DoLaunchUpdateModelFromDatabaseWizard(ProjectItem projectItem)
{
var uri = Utils.FileName2Uri(projectItem.get_FileNames(1));
ModelManager modelManager = PackageManager.Package.ModelManager;
var efArtifactSet = modelManager.GetArtifactSet(uri);
Debug.Assert(efArtifactSet != null, "Could not find artifact for the following file:" + uri.AbsolutePath);
if (efArtifactSet != null)
{
var entityDesignArtifact = efArtifactSet.GetEntityDesignArtifact();
Debug.Assert(
entityDesignArtifact != null,
"In LaunchUpdateModelWizardPage: DoLaunchUpdateModelFromDatabaseWizard, entityDesignArtifact is null");
if (entityDesignArtifact != null)
{
UpdateFromDatabaseEngine.UpdateModelFromDatabase(entityDesignArtifact);
}
}
}
示例10: ProjectItemFinishedGenerating
public override void ProjectItemFinishedGenerating(ProjectItem projectItem)
{
if (!projectItem.Name.Contains(".g.cs"))
{
_entityFile = projectItem;
//给父实体添加列表属性。
if (_isChild)
{
WriteChildrenProperty(projectItem);
}
}
else
{
//把生成文件变为实体文件的子文件。
if (_entityFile != null)
{
projectItem.Remove();
_entityFile.ProjectItems.AddFromFile(projectItem.get_FileNames(1));
}
}
base.ProjectItemFinishedGenerating(projectItem);
}
示例11: TestReplaceMethod
/// <summary>
/// Invokes replace method on the provided objects
/// </summary>
/// <param name="codeFile">Code file to test</param>
/// <param name="resFile">Resource file to use</param>
/// <param name="hcs">Hardcoded string to use</param>
/// <param name="expected">Expected test string</param>
internal static void TestReplaceMethod(ProjectItem codeFile, string resourceFileName, BaseHardCodedString hcs, string expected, string resourceName)
{
string fileName = codeFile.get_FileNames(1);
bool readOnly = false;
try
{
readOnly = CommonMethods.ToggleReadOnly(fileName, false);
ExtractToResourceActionSite refactorSite = new ExtractToResourceActionSite(hcs);
ResourceFileCollection resources = new ResourceFileCollection(codeFile.ContainingProject,
new FilterMethod(refactorSite.ActionObject.IsValidResourceFile));
ResourceFile resFile = resources[resourceFileName];
refactorSite.ExtractStringToResource(resFile, resourceName);
TextDocument doc = ((EnvDTE.TextDocument)codeFile.Document.Object(null));
EditPoint ep = doc.StartPoint.CreateEditPoint();
string line = ep.GetLines(hcs.StartingLine + 1, hcs.StartingLine + 2);
Assert.AreEqual(expected, line, "New line does not match the expected output");
}
finally
{
if (readOnly) CommonMethods.ToggleReadOnly(fileName, true);
}
}
示例12: IsModelFile
public static bool IsModelFile(ProjectItem projectItem)
{
var fullName = projectItem.get_FileNames(1);
return IsModelFile(fullName);
}
示例13: GetFilePathRelative
/// <summary>
/// Returns the item file name relative to the containing solution.
/// </summary>
public static string GetFilePathRelative(ProjectItem item)
{
Guard.ArgumentNotNull(item, "item");
return GetFilePathRelative(item.DTE, item.get_FileNames(1));
}
示例14: BuildCacheSub
private void BuildCacheSub(ProjectItem projectItem)
{
try
{
var k = projectItem.get_FileNames(1);
if (!_projectItemCache.ContainsKey(k))
_projectItemCache.Add(k, projectItem);
else
System.Diagnostics.Debug.Write(string.Empty);
foreach (ProjectItem pItem in projectItem.ProjectItems)
{
BuildCacheSub(pItem);
}
}
catch (Exception ex)
{
throw;
}
}
示例15: GetFileListFromProjectTree
private ArrayList GetFileListFromProjectTree(ProjectItem item)
{
ArrayList filesList = new ArrayList();
if (item == null) return filesList;
if (item.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFile)
{
for (short i = 1; i <= item.FileCount; i++)
{
string filename = item.get_FileNames(i);
filesList.Add(filename);
}
}
else if (item.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFolder)
{
foreach (ProjectItem childItem in item.ProjectItems)
{
filesList.AddRange(GetFileListFromProjectTree(childItem));
}
}
return filesList;
}