本文整理汇总了C#中SourceFile.getPackageName方法的典型用法代码示例。如果您正苦于以下问题:C# SourceFile.getPackageName方法的具体用法?C# SourceFile.getPackageName怎么用?C# SourceFile.getPackageName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceFile
的用法示例。
在下文中一共展示了SourceFile.getPackageName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLocalPath
/// <summary>
///
/// </summary>
public String GetLocalPath(SourceFile file)
{
if (File.Exists(file.FullPath))
{
return file.FullPath;
}
if (m_PathMap.ContainsKey(file.FullPath))
{
return m_PathMap[file.FullPath];
}
Char pathSeparator = Path.DirectorySeparatorChar;
foreach (Folder folder in PluginMain.settingObject.SourcePaths)
{
String pathFromPackage = file.getPackageName().Replace('/', pathSeparator);
String localPath = folder.Path + pathSeparator + pathFromPackage + pathSeparator + file.Name;
if (File.Exists(localPath))
{
m_PathMap[file.FullPath] = localPath;
return localPath;
}
}
return null;
}
示例2: filesMatch
/// <summary> Compare two files and determine if they are the same.
/// Our criteria included only line count package names
/// and the name of the class itself. If there are
/// any other differences then we won't be able to detect
/// them. We should probably do something like an MD5
/// computation on the characters in ScriptText. Then
/// we'd really be sure of a match.
/// </summary>
/// <param name="a">first file to compare
/// </param>
/// <param name="b">second file to compare
/// </param>
/// <returns> true if files appear to be the same
/// </returns>
public virtual bool filesMatch(SourceFile a, SourceFile b)
{
bool yes = true;
if (a == null || b == null)
yes = false;
else if (String.CompareOrdinal(a.getPackageName(), b.getPackageName()) != 0)
yes = false;
else if (String.CompareOrdinal(a.Name, b.Name) != 0)
yes = false;
else if (a.LineCount != b.LineCount)
// warning, this is sometimes expensive, so do it last
yes = false;
return yes;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}