本文整理汇总了C#中SourceFile.getFullPath方法的典型用法代码示例。如果您正苦于以下问题:C# SourceFile.getFullPath方法的具体用法?C# SourceFile.getFullPath怎么用?C# SourceFile.getFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceFile
的用法示例。
在下文中一共展示了SourceFile.getFullPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLocalPath
/// <summary>
///
/// </summary>
public String GetLocalPath(SourceFile file)
{
if (file == null) return null;
String fileFullPath = file.getFullPath();
if (m_PathMap.ContainsKey(fileFullPath))
{
return m_PathMap[fileFullPath];
}
if (File.Exists(fileFullPath))
{
m_PathMap[fileFullPath] = fileFullPath;
return fileFullPath;
}
Char pathSeparator = Path.DirectorySeparatorChar;
String pathFromPackage = file.getPackageName().ToString().Replace('/', pathSeparator);
String fileName = file.getName();
foreach (Folder folder in PluginMain.settingObject.SourcePaths)
{
StringBuilder localPathBuilder = new StringBuilder(260/*Windows max path length*/);
localPathBuilder.Append(folder.Path);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(pathFromPackage);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(fileName);
String localPath = localPathBuilder.ToString();
if (File.Exists(localPath))
{
m_PathMap[fileFullPath] = localPath;
return localPath;
}
}
IProject project = PluginBase.CurrentProject;
if (project != null)
{
var basePaths = project.SourcePaths.Length == 0 ? new[] { Path.GetDirectoryName(project.ProjectPath) } : project.SourcePaths;
var lookupPaths = basePaths.
Concat(ProjectManager.PluginMain.Settings.GetGlobalClasspaths(project.Language)).
Select(project.GetAbsolutePath).Distinct();
foreach (string cp in lookupPaths)
{
StringBuilder localPathBuilder = new StringBuilder(260/*Windows max path length*/);
localPathBuilder.Append(cp);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(pathFromPackage);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(fileName);
String localPath = localPathBuilder.ToString();
if (File.Exists(localPath))
{
m_PathMap[fileFullPath] = localPath;
return localPath;
}
}
}
m_PathMap[fileFullPath] = null;
return null;
}
示例2: GetLocalPath
/// <summary>
///
/// </summary>
public String GetLocalPath(SourceFile file)
{
if (file == null) return null;
String fileFullPath = file.getFullPath();
if (m_PathMap.ContainsKey(fileFullPath))
{
return m_PathMap[fileFullPath];
}
if (File.Exists(fileFullPath))
{
m_PathMap[fileFullPath] = fileFullPath;
return fileFullPath;
}
Char pathSeparator = Path.DirectorySeparatorChar;
String pathFromPackage = file.getPackageName().ToString().Replace('/', pathSeparator);
String fileName = file.getName();
foreach (Folder folder in PluginMain.settingObject.SourcePaths)
{
StringBuilder localPathBuilder = new StringBuilder(260/*Windows max path length*/);
localPathBuilder.Append(folder.Path);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(pathFromPackage);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(fileName);
String localPath = localPathBuilder.ToString();
if (File.Exists(localPath))
{
m_PathMap[fileFullPath] = localPath;
return localPath;
}
}
Project project = PluginBase.CurrentProject as Project;
if (project != null)
{
foreach (string cp in project.Classpaths)
{
StringBuilder localPathBuilder = new StringBuilder(260/*Windows max path length*/);
localPathBuilder.Append(project.Directory);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(cp);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(pathFromPackage);
localPathBuilder.Append(pathSeparator);
localPathBuilder.Append(fileName);
String localPath = localPathBuilder.ToString();
if (File.Exists(localPath))
{
m_PathMap[fileFullPath] = localPath;
return localPath;
}
}
}
m_PathMap[fileFullPath] = null;
return null;
}
示例3: GetLocalPath
/// <summary>
///
/// </summary>
public String GetLocalPath(SourceFile file)
{
if (file == null) return null;
if (File.Exists(file.getFullPath()))
{
return file.getFullPath();
}
if (m_PathMap.ContainsKey(file.getFullPath()))
{
return m_PathMap[file.getFullPath()];
}
Char pathSeparator = Path.DirectorySeparatorChar;
String pathFromPackage = file.getPackageName().ToString().Replace('/', pathSeparator);
foreach (Folder folder in PluginMain.settingObject.SourcePaths)
{
String localPath = folder.Path + pathSeparator + pathFromPackage + pathSeparator + file.getName();
if (File.Exists(localPath))
{
m_PathMap[file.getFullPath()] = localPath;
return localPath;
}
}
Project project = PluginBase.CurrentProject as Project;
if (project != null)
{
foreach (string cp in project.Classpaths)
{
String localPath = project.Directory + pathSeparator + cp + pathSeparator + pathFromPackage + pathSeparator + file.getName();
if (File.Exists(localPath))
{
m_PathMap[file.getFullPath()] = localPath;
return localPath;
}
}
}
return null;
}