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


C# IDirectory.Files方法代码示例

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


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

示例1: UncompressedPackage

        public UncompressedPackage(IPackageRepository source,
                                   IFile originalPackageFile,
                                   IDirectory wrapCacheDirectory)
        {
            Check.NotNull(source, "source");
            if (originalPackageFile == null || originalPackageFile.Exists == false)
            {
                IsValid = false;
                return;
            }
            _originalPackageFile = originalPackageFile;
            BaseDirectory = wrapCacheDirectory;
            // get the descriptor file inside the package

            Source = source;
            var wrapDescriptor = wrapCacheDirectory.Files("*.wrapdesc").SingleOrDefault();

            if (wrapDescriptor == null)
            {
                IsValid = false;
                return;
            }

            var versionFile = wrapCacheDirectory.GetFile("version");
            _descriptor = new PackageDescriptorReader().Read(wrapDescriptor);
            _semver = _descriptor.SemanticVersion ?? _descriptor.Version.ToSemVer();
            if (_semver == null)
                _semver = versionFile.Exists ? versionFile.ReadString().ToSemVer() : null;

            IsValid = string.IsNullOrEmpty(Name) == false && _semver != null;
            if (IsValid)
                Identifier = new PackageIdentifier(Name, _semver);
        }
开发者ID:simonlaroche,项目名称:openwrap,代码行数:33,代码来源:UncompressedPackage.cs

示例2: UncompressedPackage

        public UncompressedPackage(IPackageRepository source,
            IFile originalPackageFile,
            IDirectory wrapCacheDirectory)
        {
            Check.NotNull(source, "source");
            if (originalPackageFile == null || originalPackageFile.Exists == false)
            {
                IsValid = false;
                return;
            }
            _originalPackageFile = originalPackageFile;
            BaseDirectory = wrapCacheDirectory;
            // get the descriptor file inside the package

            Source = source;
            var wrapDescriptor = wrapCacheDirectory.Files("*.wrapdesc").SingleOrDefault();

            if (wrapDescriptor == null)
            {
                IsValid = false;
                return;
            }

            var versionFile = wrapCacheDirectory.GetFile("version");
            _descriptor = new PackageDescriptorReaderWriter().Read(wrapDescriptor);
            PackageInfo = new DefaultPackageInfo(originalPackageFile.Name,
                                                versionFile.Exists ? versionFile.Read(x => x.ReadString().ToVersion()) : null,
                                                _descriptor);
            Identifier = new PackageIdentifier(Name, Version);
            IsValid = true;
        }
开发者ID:scrummyin,项目名称:openwrap,代码行数:31,代码来源:UncompressedPackage.cs

示例3: GetFileSpecCore

		private static IEnumerable<IFile> GetFileSpecCore(IDirectory directory, IList<string> segments, int position)
		{
			var segment = segments[position];

			if (position == segments.Count - 1)
			{
				return directory.Files(segment);
			}

			if (segment == Subfolder)
			{
				var isNextToLastSegment = position + 1 == segments.Count - 1;

				return isNextToLastSegment
				       	? directory.Files(segments[position + 1], SearchScope.SubFolders)
				       	: directory.Directories(segments[position + 1], SearchScope.SubFolders)
				       	  	.SelectMany(x => GetFileSpecCore(x, segments, position + 2));
			}

			return directory.Directories(segment, SearchScope.CurrentOnly)
				.SelectMany(x => GetFileSpecCore(x, segments, position + 1));
		}
开发者ID:bittercoder,项目名称:Windsor,代码行数:22,代码来源:DirectoryExtensions.cs

示例4: FolderRepository

        public FolderRepository(IDirectory packageBasePath, bool anchorsEnabled)
        {
            if (packageBasePath == null) throw new ArgumentNullException("packageBasePath");

            BasePath = packageBasePath;
            _anchorsEnabled = anchorsEnabled;

            _rootCacheDirectory = BasePath.GetOrCreateDirectory("_cache");
            Packages = (from wrapFile in BasePath.Files("*.wrap")
                        let packageFullName = wrapFile.NameWithoutExtension
                        let packageVersion = WrapNameUtility.GetVersion(packageFullName)
                        where packageVersion != null
                        let cacheDirectory = _rootCacheDirectory.GetDirectory(packageFullName)
                        select cacheDirectory.Exists
                                   ? (IPackageInfo)new UncompressedPackage(this, wrapFile, cacheDirectory, ExportBuilders.All, _anchorsEnabled)
                                   : (IPackageInfo)new ZipPackage(this, wrapFile, cacheDirectory, ExportBuilders.All, _anchorsEnabled)).ToList();
        }
开发者ID:bobthemighty,项目名称:openwrap,代码行数:17,代码来源:FolderRepository.cs

示例5: UncompressedPackage

 public UncompressedPackage(IPackageRepository source,
     IFile originalPackage,
     IDirectory wrapCacheDirectory,
     IEnumerable<IExportBuilder> exporters)
 {
     _originalWrapFile = originalPackage;
     _exporters = exporters;
     BaseDirectory = wrapCacheDirectory;
     // get the descriptor file inside the package
     var descriptorName = originalPackage.NameWithoutExtension;
     Source = source;
     var wrapDescriptor = wrapCacheDirectory.Files("*.wrapdesc").SingleOrDefault();
     if (wrapDescriptor == null)
         throw new InvalidOperationException("Could not find descriptor in wrap cache directory, or there are multiple .wrapdesc files in the package.");
     var versionFile = wrapCacheDirectory.GetFile("version");
     Descriptor = new DefaultPackageInfo(originalPackage.Name, versionFile.Exists ? versionFile.Read(x=>x.ReadString().ToVersion()) : null, new PackageDescriptorReaderWriter().Read(wrapDescriptor));
 }
开发者ID:RobertTheGrey,项目名称:openwrap,代码行数:17,代码来源:UncompressedPackage.cs

示例6: FolderNotEmptyAndMissingWraplist

 static bool FolderNotEmptyAndMissingWraplist(Uri fileUri, IDirectory directory, IFile wrapList)
 {
     return fileUri.Scheme == "file" && wrapList.Exists == false && directory.Files().Where(_ => _.Name != "index.wraplist").Any();
 }
开发者ID:scrummyin,项目名称:openwrap,代码行数:4,代码来源:IndexedFolderRepositoryFactory.cs


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