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


C# IFileSystem.GetFile方法代码示例

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


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

示例1: GetExplorerHistoryFiles

 public static IEnumerable<ExplorerHistoryFile> GetExplorerHistoryFiles(IFileSystem fileSystem)
 {
     for (int i = 0; i < paths.Length; i++) {
         foreach (FileSystemNode parent in fileSystem.GetFile(paths[i])) {
             Folder folder = parent as Folder;
             if (folder != null) {
                 foreach (FileSystemNode node in folder.GetChildren("index.dat")) {
                     File file = node as File;
                     if (file != null) {
                         yield return new ExplorerHistoryFile(file, folder, types[i]);
                     }
                 }
             }
         }
     }
 }
开发者ID:JoeyScarr,项目名称:kickass,代码行数:16,代码来源:History.cs

示例2: CreateFile

 private static void CreateFile(AbstractConfigurationDetails configuration, IFileSystem fileSystem)
 {
     var filePath = System.IO.Path.Combine(configuration.UserDataDirectory, ConfigurationFileName);
     using (var file = fileSystem.GetFile(filePath).MustExist().OpenWrite())
         file.Write(DefaultFileContents.ToBytes());
 }
开发者ID:tombuildsstuff,项目名称:Tray-Notifier,代码行数:6,代码来源:CruiseControlNotificationRegistration.cs

示例3: CopyDirectoryAsync

		static async Task<IFile> CopyDirectoryAsync (this IFileSystem src, IFile file, IFileSystem dest, string destDir)
		{
			var newPath = await dest.GetAvailableNameAsync (Path.Combine (destDir, Path.GetFileName (file.Path)));

			var r = await dest.CreateDirectory (newPath);
			if (!r)
				throw new Exception ("Failed to create destination directory " + newPath + " on " + dest);

			var srcFiles = await src.ListFiles (file.Path);
			foreach (var f in srcFiles) {
				await src.CopyAsync (f, dest, newPath);
			}

			try {
				return await dest.GetFile (newPath);

			} catch (Exception ex) {
				Log.Error (ex);
				return null;
			}
		}
开发者ID:praeclarum,项目名称:Praeclarum,代码行数:21,代码来源:IFileSystem.cs

示例4: TryParse

            public static SolutionProjectReference TryParse(IFileSystem fileSystem, string[] lines, ref int index)
            {
                var match = _projectRegex.Match(lines[index]);
                if (match.Success == false) return null;
                var project = new SolutionProjectReference
                {
                    Name = match.Groups["name"].Value,
                    Path = match.Groups["path"].Value,
                    Type = new Guid(match.Groups["projectTypeGuid"].Value),
                    Guid = new Guid(match.Groups["projectGuid"].Value),
                    File = fileSystem.GetFile(match.Groups["path"].Value)
                };

                for (index++; index < lines.Length; index++)
                {
                    if (lines[index] == "EndProject") break;
                    project._lines.Add(lines[index]);
                }
                return project;
            }
开发者ID:modulexcite,项目名称:openwrap,代码行数:20,代码来源:SolutionFile.cs

示例5: Exists

 public static bool Exists(this FilePath path, IFileSystem fileSystem)
 {
     var file = fileSystem.GetFile(path);
     return file != null && file.Exists;
 }
开发者ID:patriksvensson,项目名称:ld29,代码行数:5,代码来源:FilePathExtensions.cs


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