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


C# FileName.GetFileName方法代码示例

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


在下文中一共展示了FileName.GetFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBlobHashAsync

		internal static async Task<string> GetBlobHashAsync(string gitExe, FileName fileName)
		{
			if (!File.Exists(fileName))
				return null;
			
			ProcessRunner runner = new ProcessRunner();
			runner.WorkingDirectory = fileName.GetParentDirectory();
			runner.RedirectStandardOutput = true;
			runner.Start(gitExe, "ls-tree", "HEAD", fileName.GetFileName());
			using (var reader = runner.OpenStandardOutputReader()) {
				string firstLine = await reader.ReadLineAsync().ConfigureAwait(false);
				if (firstLine != null) {
					string[] parts = firstLine.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
					if (parts.Length >= 3) {
						if (parts[2].Length == 40)
							return parts[2];
					}
				}
			}
			return null;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:21,代码来源:GitVersionProvider.cs

示例2: FindXmlDocumentation

 static string FindXmlDocumentation(FileName assemblyFileName, TargetRuntime runtime)
 {
     // First, look in the same directory as the assembly.
     // This usually works for .NET reference assembies and 3rd party libraries
     string xmlFileName = LookupLocalizedXmlDoc(assemblyFileName);
     if (xmlFileName != null)
         return xmlFileName;
     // Otherwise, assume the assembly is part of .NET and try looking
     // in the framework directory.
     // (if the assembly is not part of .NET, we won't find anything there)
     string name = assemblyFileName.GetFileName();
     switch (runtime) {
         case TargetRuntime.Net_1_0:
             xmlFileName = LookupLocalizedXmlDoc(Path.Combine(frameworkPath, "v1.0.3705", name));
             break;
         case TargetRuntime.Net_1_1:
             xmlFileName = LookupLocalizedXmlDoc(Path.Combine(frameworkPath, "v1.1.4322", name));
             break;
         case TargetRuntime.Net_2_0:
             xmlFileName = LookupLocalizedXmlDoc(Path.Combine(referenceAssembliesPath, "v3.5", name))
                 ?? LookupLocalizedXmlDoc(Path.Combine(referenceAssembliesPath, @".NETFramework\v3.5\Profile\Client", name))
                 ?? LookupLocalizedXmlDoc(Path.Combine(referenceAssembliesPath, "v3.0", name))
                 ?? LookupLocalizedXmlDoc(Path.Combine(frameworkPath, "v2.0.50727", name));
             break;
         case TargetRuntime.Net_4_0:
         default:
             xmlFileName = LookupLocalizedXmlDoc(Path.Combine(referenceAssembliesPath, @".NETFramework\v4.5.2", name))
                 ?? LookupLocalizedXmlDoc(Path.Combine(referenceAssembliesPath, @".NETFramework\v4.5.1", name))
                 ?? LookupLocalizedXmlDoc(Path.Combine(referenceAssembliesPath, @".NETFramework\v4.5", name))
                 ?? LookupLocalizedXmlDoc(Path.Combine(referenceAssembliesPath, @".NETFramework\v4.0", name))
                 ?? LookupLocalizedXmlDoc(Path.Combine(frameworkPath, "v4.0.30319", name));
             break;
     }
     return xmlFileName;
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:35,代码来源:AssemblyParserService.cs


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