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


C# FileName.GetParentDirectory方法代码示例

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


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

示例1: DefaultAssemblySearcher

 public DefaultAssemblySearcher(FileName mainAssemblyFileName)
 {
     if (mainAssemblyFileName == null)
         throw new ArgumentNullException("mainAssemblyFileName");
     this.mainAssemblyFileName = mainAssemblyFileName;
     this.baseDirectory = mainAssemblyFileName.GetParentDirectory();
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:DefaultAssemblySearcher.cs

示例2: LoadTemplate

 public TemplateBase LoadTemplate(FileName fileName)
 {
     var fileSystem = SD.FileSystem;
     using (Stream stream = fileSystem.OpenRead(fileName)) {
         return LoadTemplate(stream, new ReadOnlyChrootFileSystem(fileSystem, fileName.GetParentDirectory()));
     }
 }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:7,代码来源:TemplateService.cs

示例3: OpenOutput

		Stream OpenOutput(string gitExe, FileName fileName, string blobHash)
		{
			if (blobHash == null)
				return null;
			if (!File.Exists(fileName))
				return null;
			
			ProcessRunner runner = new ProcessRunner();
			runner.WorkingDirectory = fileName.GetParentDirectory();
			runner.RedirectStandardOutput = true;
			runner.Start(gitExe, "cat-file", "blob", blobHash);
			return runner.StandardOutput;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:13,代码来源:GitVersionProvider.cs

示例4: TestableInvokeUpdateWorkingDirectoryCmdlet

        public TestableInvokeUpdateWorkingDirectoryCmdlet(
			string solutionFileName,
			FakePackageManagementProjectService projectService,
			FakePackageManagementConsoleHost consoleHost,
			FakeCmdletTerminatingError cmdletTerminatingError)
            : base(projectService, consoleHost, cmdletTerminatingError)
        {
            this.FakeProjectService = projectService;
            this.FakePackageManagementConsoleHost = consoleHost;
            this.FakeCmdletTerminatingError = cmdletTerminatingError;

            Solution = MockRepository.GenerateStub<ISolution>();
            var fileName = new FileName(solutionFileName);
            Solution.Stub(s => s.Directory).Return(fileName.GetParentDirectory());
            Solution.Stub(s => s.FileName).Return(fileName);
            projectService.OpenSolution = Solution;
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:17,代码来源:TestableInvokeUpdateWorkingDirectoryCmdlet.cs

示例5: CreateSharpDevelopSolution

		SD.ISolution CreateSharpDevelopSolution(string fileName = @"d:\projects\MyProject\MyProject.sln")
		{
			var solution = MockRepository.GenerateStub<ISolution>();
			var solutionFileName = new FileName(fileName);
			solution.Stub(s => s.FileName).Return(solutionFileName);
			solution.Stub(s => s.Directory).Return(solutionFileName.GetParentDirectory());
			
			var sections = new SimpleModelCollection<SolutionSection>(new SolutionSection[0]);
			solution.Stub(s => s.GlobalSections).Return(sections);
			
			solution.Stub(s => s.MSBuildProjectCollection).Return(new ProjectCollection());
			
			var projects = new SimpleModelCollection<IProject>();
			solution.Stub(s =>s.Projects).Return(projects);
			
			return solution;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:17,代码来源:SolutionHelper.cs

示例6: 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

示例7: SolutionWriter

		public SolutionWriter(FileName fileName)
		{
			// we need to specify UTF8 because MSBuild needs the BOM
			this.writer = new StreamWriter(fileName, false, Encoding.UTF8);
			this.basePath = fileName.GetParentDirectory();
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:6,代码来源:SolutionWriter.cs

示例8: SetParentSolutionFileName

 void SetParentSolutionFileName(string fileName)
 {
     var solutionFileName = new FileName(fileName);
     msbuildProject.ParentSolution.Stub(s => s.FileName).Return(solutionFileName);
     msbuildProject.ParentSolution.Stub(s => s.Directory).Return(solutionFileName.GetParentDirectory());
 }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:6,代码来源:ProjectTests.cs

示例9: ObservedSave

 public static FileOperationResult ObservedSave(NamedFileOperationDelegate saveFileAs, FileName fileName, string message, FileErrorPolicy policy = FileErrorPolicy.Inform)
 {
     System.Diagnostics.Debug.Assert(IsValidPath(fileName));
     try {
         Directory.CreateDirectory(fileName.GetParentDirectory());
         saveFileAs(fileName);
         RaiseFileSaved(new FileNameEventArgs(fileName));
         return FileOperationResult.OK;
     } catch (IOException e) {
         return ObservedSaveHandleError(e, saveFileAs, fileName, message, policy);
     } catch (UnauthorizedAccessException e) {
         return ObservedSaveHandleError(e, saveFileAs, fileName, message, policy);
     }
 }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:14,代码来源:FileUtility.cs


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