本文整理汇总了C#中IProject.GetAbsolutePath方法的典型用法代码示例。如果您正苦于以下问题:C# IProject.GetAbsolutePath方法的具体用法?C# IProject.GetAbsolutePath怎么用?C# IProject.GetAbsolutePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProject
的用法示例。
在下文中一共展示了IProject.GetAbsolutePath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllProjectRelatedFiles
/// <summary>
/// Gets all files related to the project
/// </summary>
private static List<String> GetAllProjectRelatedFiles(IProject project)
{
List<String> files = new List<String>();
string filter = GetSearchPatternFromLang(project.Language.ToLower());
if (string.IsNullOrEmpty(filter))
return files;
foreach (String path in project.SourcePaths)
{
String absolute = project.GetAbsolutePath(path);
if (Directory.Exists(path))
files.AddRange(Directory.GetFiles(absolute, filter, SearchOption.AllDirectories));
}
// If no source paths are defined, get files directly from project path
if (project.SourcePaths.Length == 0)
{
String projRoot = Path.GetDirectoryName(project.ProjectPath);
files.AddRange(Directory.GetFiles(projRoot, filter, SearchOption.AllDirectories));
}
return files;
}
示例2: IsProjectRelatedFile
/// <summary>
/// Checks if files is related to the project
/// TODO support SWCs -> refactor test as IProject method
/// </summary>
public static Boolean IsProjectRelatedFile(IProject project, String file)
{
foreach (String path in project.SourcePaths)
{
String absolute = project.GetAbsolutePath(path);
if (file.StartsWith(absolute)) return true;
}
// If no source paths are defined, is it under the project?
if (project.SourcePaths.Length == 0)
{
String projRoot = Path.GetDirectoryName(project.ProjectPath);
if (file.StartsWith(projRoot)) return true;
}
return false;
}
示例3: GetAllProjectRelatedFiles
private static List<String> GetAllProjectRelatedFiles(IProject project, bool onlySourceFiles, Boolean ignoreSdkFiles)
{
List<String> files = new List<String>();
string filter = project.DefaultSearchFilter;
if (string.IsNullOrEmpty(filter)) return files;
string[] filters = project.DefaultSearchFilter.Split(';');
if (!onlySourceFiles)
{
IASContext context = ASContext.GetLanguageContext(project.Language);
if (context == null) return files;
foreach (PathModel pathModel in context.Classpath)
{
string absolute = project.GetAbsolutePath(pathModel.Path);
if (Directory.Exists(absolute))
{
if (ignoreSdkFiles && IsUnderSDKPath(absolute)) continue;
foreach (string filterMask in filters)
{
files.AddRange(Directory.GetFiles(absolute, filterMask, SearchOption.AllDirectories));
}
}
}
}
else
{
var lookupPaths = project.SourcePaths.
Concat(ProjectManager.PluginMain.Settings.GetGlobalClasspaths(project.Language)).
Select(project.GetAbsolutePath).Distinct();
foreach (string path in lookupPaths)
{
if (Directory.Exists(path))
{
if (ignoreSdkFiles && IsUnderSDKPath(path)) continue;
foreach (string filterMask in filters)
{
files.AddRange(Directory.GetFiles(path, filterMask, SearchOption.AllDirectories));
}
}
}
}
// If no source paths are defined, get files directly from project path
if (project.SourcePaths.Length == 0)
{
String projRoot = Path.GetDirectoryName(project.ProjectPath);
foreach (string filterMask in filters)
{
files.AddRange(Directory.GetFiles(projRoot, filterMask, SearchOption.AllDirectories));
}
}
return files;
}
示例4: IsProjectRelatedFile
/// <summary>
/// Checks if files is related to the project
/// TODO support SWCs -> refactor test as IProject method
/// </summary>
public static Boolean IsProjectRelatedFile(IProject project, String file)
{
if (project == null) return false;
IASContext context = ASContext.GetLanguageContext(project.Language);
if (context == null) return false;
foreach (PathModel pathModel in context.Classpath)
{
string absolute = project.GetAbsolutePath(pathModel.Path);
if (file.StartsWith(absolute)) return true;
}
// If no source paths are defined, is it under the project?
if (project.SourcePaths.Length == 0)
{
String projRoot = Path.GetDirectoryName(project.ProjectPath);
if (file.StartsWith(projRoot)) return true;
}
return false;
}
示例5: IsFileHidden
/// <summary>
/// Check if file is hidden in project
/// </summary>
private Boolean IsFileHidden(String file, IProject project)
{
String[] hiddenPaths = project.GetHiddenPaths();
foreach (String hiddenPath in hiddenPaths)
{
String absHiddenPath = project.GetAbsolutePath(hiddenPath);
if (Directory.Exists(absHiddenPath) && file.StartsWith(absHiddenPath)) return true;
}
return false;
}
示例6: GetAllProjectRelatedFiles
/// <summary>
/// Gets all files related to the project
/// </summary>
private static List<String> GetAllProjectRelatedFiles(IProject project)
{
List<String> files = new List<String>();
String filter = project.Language.ToLower() == "haxe" ? "*.hx" : "*.as";
foreach (String path in project.SourcePaths)
{
String absolute = project.GetAbsolutePath(path);
files.AddRange(Directory.GetFiles(absolute, filter, SearchOption.AllDirectories));
}
// If no source paths are defined, get files directly from project path
if (project.SourcePaths.Length == 0)
{
String projRoot = Path.GetDirectoryName(project.ProjectPath);
files.AddRange(Directory.GetFiles(projRoot, filter, SearchOption.AllDirectories));
}
return files;
}