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


C# IDirectory.GetFile方法代码示例

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


在下文中一共展示了IDirectory.GetFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: LoadConfiguration

        /// <summary>
        /// Loads configuration for the specified directory and its subdirectories and file using the specified configuration node as parent node
        /// </summary>
        internal void LoadConfiguration(IConfigurationNode parentNode, IDirectory directory)
        {
            m_Logger.Info($"Loading configuration for directory '{directory.FullPath}'");

            // determine configuration node for directory
            IConfigurationNode configNode;

            // config file present in directory => create new node
            if (directory.FileExists(s_DirectoryConfigName))
            {
                configNode = new HierarchicalConfigurationNode(parentNode, LoadConfigurationFile(directory.GetFile(s_DirectoryConfigName)));
            }
            // no config file found => use parent node
            else
            {
                configNode = parentNode;
            }

            m_Mapper.AddMapping(configNode, directory);

            // load configuration for files in the directory
            foreach (var file in directory.Files)
            {
                LoadConfiguration(configNode, file);
            }

            // load configuration for subdirectories
            foreach (var dir in directory.Directories)
            {
                LoadConfiguration(configNode, dir);
            }
        }
开发者ID:ap0llo,项目名称:MusicFileCop,代码行数:35,代码来源:ConfigurationLoader.cs

示例4: BundleCache

 public BundleCache(string version, CassetteSettings settings)
 {
     this.version = version;
     this.settings = settings;
     cacheDirectory = settings.CacheDirectory;
     sourceDirectory = settings.SourceDirectory;
     containerFile = cacheDirectory.GetFile(ContainerFilename);
 }
开发者ID:hempels,项目名称:cassette,代码行数:8,代码来源:BundleCache.cs

示例5: DownloadILMerge

    private string DownloadILMerge(IDirectory destination)
    {
        var destinationFile = destination.GetFile(Guid.NewGuid() + ".msi").Path.FullPath;

        using (var c = new WebClient())
            c.DownloadFile("http://download.microsoft.com/download/1/3/4/1347C99E-9DFB-4252-8F6D-A3129A069F79/ILMerge.msi", destinationFile);

        return destinationFile;
    }
开发者ID:simoneb,项目名称:Pencil,代码行数:9,代码来源:Pencil.cs

示例6: GenerateIncrementalRevision

        static int GenerateIncrementalRevision(IDirectory versionFile)
        {
            var lastBuild= versionFile.GetFile("_lastVersion");
            int count = 0;
            if (lastBuild.Exists)
                count = int.Parse(lastBuild.ReadString())+1;

            lastBuild.WriteString(count.ToString());
            return count;
        }
开发者ID:trullock,项目名称:openwrap,代码行数:10,代码来源:VersionExtensions.cs

示例7: InMemoryEnvironment

 public InMemoryEnvironment(IDirectory currentDirectory, IDirectory configDirectory)
 {
     CurrentDirectory = currentDirectory;
     SystemRepository = new InMemoryRepository("System repository");
     RemoteRepository = new InMemoryRepository("Remote repository");
     CurrentDirectoryRepository = new InMemoryRepository("Current directory repository");
     RemoteRepositories = new List<InMemoryRepository> { RemoteRepository };
     Descriptor = new WrapDescriptor() { File = CurrentDirectory.GetFile("descriptor.wrapdesc").MustExist()};
     ConfigurationDirectory = configDirectory;
 }
开发者ID:bobthemighty,项目名称:openwrap,代码行数:10,代码来源:InMemoryEnvironment.cs

示例8: CssUrlMatchTransformer

 protected CssUrlMatchTransformer(Match match, IAsset asset, IDirectory rootDirectory)
 {
     matchIndex = match.Index;
     matchLength = match.Length;
     path = match.Groups["path"].Value;
     url = (path.StartsWith("/") ? "~" : "") + path + "." + match.Groups["extension"].Value;
     extension = match.Groups["extension"].Value;
     var currentDirectory = rootDirectory.GetFile(asset.Path).Directory;
     file = currentDirectory.GetFile(url);
 }
开发者ID:jlopresti,项目名称:cassette,代码行数:10,代码来源:CssUrlMatchTransformer.cs

示例9: InMemoryEnvironment

 public InMemoryEnvironment(IDirectory currentDirectory, IDirectory configDirectory)
 {
     CurrentDirectory = currentDirectory;
     SystemRepository = new InMemoryRepository("System repository");
     RemoteRepository = new InMemoryRepository("Remote repository");
     CurrentDirectoryRepository = new InMemoryRepository("Current directory repository");
     RemoteRepositories = new List<InMemoryRepository> { RemoteRepository };
     DescriptorFile = CurrentDirectory.GetFile("descriptor.wrapdesc").MustExist();
     Descriptor = new PackageDescriptor();
     ConfigurationDirectory = configDirectory;
     ScopedDescriptors = new Dictionary<string, FileBased<IPackageDescriptor>>(StringComparer.OrdinalIgnoreCase);
     ScopedDescriptors[string.Empty] = FileBased.New(DescriptorFile, Descriptor);
 }
开发者ID:petejohanson,项目名称:openwrap,代码行数:13,代码来源:InMemoryEnvironment.cs

示例10: msbuild_emitter

        public msbuild_emitter()
        {
            _fileSystem = new InMemoryFileSystem();
            _emitter = new MSBuildInstructionEmitter(_fileSystem);
            RootDirectory = _fileSystem.CreateTempDirectory();
            _emitter.RootPath = RootDirectory.Path;
            ProjectDirectory = RootDirectory.GetDirectory("src").GetDirectory("Project");
            ProjectFile = ProjectDirectory.GetFile("Project.csproj");

            BinDirectory 
                = _fileSystem.CreateTempDirectory();
            GacDirectory = _fileSystem.CreateTempDirectory();
            TempDirectory = _fileSystem.CreateTempDirectory();
            BinPath = new OpenFileSystem.IO.Path(System.IO.Path.Combine(_emitter.RootPath, "bin"));
        }
开发者ID:modulexcite,项目名称:openwrap,代码行数:15,代码来源:msbuild_emitter.cs

示例11: UncompressedPackage

 public UncompressedPackage(IPackageRepository source,
     IFile originalPackage,
     IDirectory wrapCacheDirectory,
     IEnumerable<IExportBuilder> exporters,
     bool allowAnchoring)
 {
     _originalWrapFile = originalPackage;
     _exporters = exporters;
     BaseDirectory = wrapCacheDirectory;
     // get the descriptor file inside the package
     var descriptorName = BaseDirectory.Name;
     Source = source;
     Descriptor = new WrapDescriptorParser().ParseFile(wrapCacheDirectory.GetFile(descriptorName + ".wrapdesc"));
     if (allowAnchoring)
         VerifyAnchoring();
 }
开发者ID:bobthemighty,项目名称:openwrap,代码行数:16,代码来源:UncompressedPackage.cs

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

示例13: DirectoryEqual

        public static void DirectoryEqual(IDirectory expected, IDirectory actual)
        {
            Assert.Equal(expected.Path, actual.Path);
            Assert.Equal(expected.Name, actual.Name);
            Assert.Equal(expected.Directories.Count(), actual.Directories.Count());
            Assert.Equal(expected.Files.Count(), actual.Files.Count());

            foreach (var directory in expected.Directories)
            {
                Assert.True(actual.DirectoryExists(directory.Name));
                DirectoryEqual(directory, actual.GetDirectory(directory.Name));
            }

            foreach (var file in expected.Files)
            {
                Assert.True(actual.FileExists(file.Name));
                FileEqual(file, actual.GetFile(file.Name));
            }
        }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:19,代码来源:FileSystemAssert.cs

示例14: GetFiles

        // Initially based on code from Reliak.FileSystemGlobbingExtensions (https://github.com/reliak/Reliak.FileSystemGlobbingExtensions)
        public static IEnumerable<IFile> GetFiles(IDirectory directory, IEnumerable<string> patterns)
        {
            Matcher matcher = new Matcher(StringComparison.Ordinal);

            // Expand braces
            IEnumerable<string> expandedPatterns = patterns
                .SelectMany(ExpandBraces)
                .Select(f => f.Replace("\\{", "{").Replace("\\}", "}")); // Unescape braces

            // Add the patterns, any that start with ! are exclusions
            foreach (string expandedPattern in expandedPatterns)
            {
                bool isExclude = expandedPattern[0] == '!';
                string finalPattern = isExclude ? expandedPattern.Substring(1) : expandedPattern;
                finalPattern = finalPattern
                    .Replace("\\!", "!") // Unescape negation
                    .Replace("\\", "/"); // Normalize slashes

                // No support for absolute paths
                if (System.IO.Path.IsPathRooted(finalPattern))
                {
                    throw new ArgumentException($"Rooted globbing patterns are not supported ({expandedPattern})", nameof(patterns));
                }

                // Add exclude or include pattern to matcher
                if (isExclude)
                {
                    matcher.AddExclude(finalPattern);
                }
                else
                {
                    matcher.AddInclude(finalPattern);
                }
            }

            DirectoryInfoBase directoryInfo = new DirectoryInfo(directory);
            PatternMatchingResult result = matcher.Execute(directoryInfo);
            return result.Files.Select(match => directory.GetFile(match.Path));
        }
开发者ID:ibebbs,项目名称:Wyam,代码行数:40,代码来源:Globber.cs

示例15: FileSystemNavigator

 public FileSystemNavigator(IDirectory directory)
 {
     _directory = directory;
     _indexFile = _directory.GetFile("index.wraplist");
 }
开发者ID:modulexcite,项目名称:openwrap,代码行数:5,代码来源:FileSystemNavigator.cs


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