当前位置: 首页>>代码示例>>C#>>正文


C# SourceFile.getName方法代码示例

本文整理汇总了C#中SourceFile.getName方法的典型用法代码示例。如果您正苦于以下问题:C# SourceFile.getName方法的具体用法?C# SourceFile.getName怎么用?C# SourceFile.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SourceFile的用法示例。


在下文中一共展示了SourceFile.getName方法的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;
 }
开发者ID:zpLin,项目名称:flashdevelop,代码行数:60,代码来源:DebuggerManager.cs

示例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;
 }
开发者ID:thecocce,项目名称:flashdevelop,代码行数:58,代码来源:DebuggerManager.cs

示例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;
 }
开发者ID:vovkasm,项目名称:flashdevelop,代码行数:40,代码来源:DebuggerManager.cs


注:本文中的SourceFile.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。