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


C# IDirectory.GetDirectory方法代码示例

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


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

示例1: ContentLocator

        //todo: Link content to a content cache similar to openwraps package cache. Use same mechanism?
        public ContentLocator()
        {
            var environment = ServiceLocator.GetService<IEnvironment>();
            var packageManager = ServiceLocator.GetService<IPackageManager>();

            var baseDirectory = LocalFileSystem.Instance.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory);

            contentRoot = baseDirectory.GetDirectory("Content");
            contentRoot.MustExist();

            foreach (var scopedDescriptor in environment.ScopedDescriptors)
            {
                var files = packageManager.GetProjectExports<ContentFolderExport>(scopedDescriptor.Value.Value,
                                                                                  environment.ProjectRepository,
                                                                                  environment.ExecutionEnvironment);

                contentPathSources = files.SelectMany(x => x).Distinct().Select(x => x.Directory).ToList();
                foreach (
                    var pathSource in
                        contentPathSources.SelectMany(contentPathSource => contentPathSource.Directories()))
                {
                    pathSource.LinkTo(contentRoot.GetDirectory(pathSource.Name).MustExist().Path.FullPath);
                }
            }
        }
开发者ID:simonlaroche,项目名称:monorail-ow,代码行数:26,代码来源:ContentLocator.cs

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

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

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

示例5: Anchor

            public override bool? Anchor(IDirectory packagesDirectory, IDirectory packageDirectory, string anchorName)
            {
                var anchoredDirectory = packagesDirectory.GetDirectory(anchorName);

                if (anchoredDirectory.Exists && anchoredDirectory.IsHardLink && !SafeDelete(anchoredDirectory))
                    return false;
                anchoredDirectory = packagesDirectory.GetDirectory(anchorName);
                if (anchoredDirectory.Exists)
                {
                    var anchorFile = anchoredDirectory.GetFile(".anchored");
                    if (anchorFile.Exists && anchorFile.ReadString() == packageDirectory.Name) return null;

                    if (!SafeDelete(anchoredDirectory)) return false;
                }
                packageDirectory.CopyTo(anchoredDirectory);
                anchoredDirectory.GetFile(".anchored").WriteString(packageDirectory.Name);
                return true;
            }
开发者ID:carcer,项目名称:openwrap,代码行数:18,代码来源:FolderRepository.cs

示例6: CopyOpenWrap

        IEnumerable<ICommandOutput> CopyOpenWrap(PackageDescriptor projectDescriptor, IDirectory projectDirectory)
        {
            var packageManager = ServiceLocator.GetService<IPackageManager>();

            var repositoryOptions = FolderRepositoryOptions.AnchoringEnabled;
            if (projectDescriptor.UseSymLinks)
                repositoryOptions |= FolderRepositoryOptions.UseSymLinks;
            if (projectDescriptor.StorePackages)
                repositoryOptions |= FolderRepositoryOptions.PersistPackages;
            var projectRepository = new FolderRepository(projectDirectory.GetDirectory("wraps"), repositoryOptions)
            {
                Name = "Project repository"
            };
            packageManager.AddProjectPackage(PackageRequest.Any("openwrap"),
                                             new[] { Environment.SystemRepository },
                                             projectDescriptor,
                                             projectRepository,
                                             PackageAddOptions.Default | PackageAddOptions.Anchor | PackageAddOptions.Content).ToList();

            yield return new Info("Project repository initialized.");
        }
开发者ID:guesshoo,项目名称:openwrap,代码行数:21,代码来源:InitWrapCommand.cs

示例7: AddIgnores

 void AddIgnores(IDirectory projectDirectory)
 {
     if (IgnoreFileName == null) return;
     if (Hg)
     {
         // mercurial is a bit special when it comes to ignores
         projectDirectory.GetFile(IgnoreFileName).WriteString("syntax: glob\r\nwraps/_cache");
     }
     else
     {
         projectDirectory.GetDirectory("wraps").GetFile(IgnoreFileName).WriteString("_cache\r\n_cache\\*");
     }
 }
开发者ID:guesshoo,项目名称:openwrap,代码行数:13,代码来源:InitWrapCommand.cs

示例8: AddPackageFolders

 static void AddPackageFolders(IDirectory projectDirectory)
 {
     projectDirectory.GetDirectory("src").MustExist();
     projectDirectory.GetDirectory("wraps").GetDirectory("_cache").MustExist();
 }
开发者ID:guesshoo,项目名称:openwrap,代码行数:5,代码来源:InitWrapCommand.cs

示例9: CopyOpenWrap

        IEnumerable<ICommandOutput> CopyOpenWrap(IDirectory projectDirectory)
        {
            var packageManager = Services.Services.GetService<IPackageResolver>();
            var initialDescriptor = new PackageDescriptor
            {
                Name = "openwrap",
                Dependencies =
                            {
                                    new PackageDependency
                                    {
                                            Name = "OpenWrap",
                                            VersionVertices = { new AnyVersionVertex() }
                                    }
                            }
            };

            DependencyResolutionResult openwrapPackage = packageManager.TryResolveDependencies(initialDescriptor, new[] { Environment.SystemRepository });
            var folderRepository = new FolderRepository(projectDirectory.GetDirectory("wraps"))
            {
                EnableAnchoring = true,
                Name = "Project repository"
            };
            foreach (ICommandOutput msg in packageManager.CopyPackagesToRepositories(
                    openwrapPackage,
                    Environment.SystemRepository,
                    folderRepository))
                yield return msg;
            folderRepository.Refresh();

            folderRepository.VerifyAnchors(new[] { folderRepository.PackagesByName["openwrap"].First() });
        }
开发者ID:Baphomet666,项目名称:openwrap,代码行数:31,代码来源:InitWrapCommand.cs

示例10: AddIgnores

 void AddIgnores(IDirectory projectDirectory)
 {
     if (IgnoreFileName == null) return;
     projectDirectory.GetDirectory("wraps").GetFile(IgnoreFileName).WriteString("_cache\r\n_cache\\*");
 }
开发者ID:Baphomet666,项目名称:openwrap,代码行数:5,代码来源:InitWrapCommand.cs

示例11: CopyOpenWrap

        IEnumerable<ICommandOutput> CopyOpenWrap(PackageDescriptor projectDescriptor, IDirectory projectDirectory)
        {
            var packageManager = Services.Services.GetService<IPackageManager>();

            var projectRepository = new FolderRepository(projectDirectory.GetDirectory("wraps"))
            {
                    EnableAnchoring = true,
                    Name = "Project repository"
            };
            packageManager.AddProjectPackage(PackageRequest.Any("openwrap"),
                                             new[] { Environment.SystemRepository },
                                             projectDescriptor,
                                             projectRepository,
                                             PackageAddOptions.Default | PackageAddOptions.Anchor | PackageAddOptions.Content).ToList();
            yield return new GenericMessage("Project repository initialized.");
        }
开发者ID:seantfox,项目名称:openwrap,代码行数:16,代码来源:InitWrapCommand.cs

示例12: CopyOpenWrap

 IEnumerable<ICommandOutput> CopyOpenWrap(IDirectory projectDirectory)
 {
     var packageManager = Services.Services.GetService<IPackageManager>();
     var openwrapPackage = packageManager.TryResolveDependencies(new PackageDescriptor { Name = "openwrap" }, new[] { Environment.SystemRepository });
     foreach(var msg in packageManager.CopyPackagesToRepositories(openwrapPackage, new FolderRepository(projectDirectory.GetDirectory("wraps"))))
         yield return msg;
 }
开发者ID:RobertTheGrey,项目名称:openwrap,代码行数:7,代码来源:NewWrapCommand.cs

示例13: AddPackageFolders

 void AddPackageFolders(IDirectory projectDirectory, List<IFileSystemItem> items)
 {
     items.AddRange(new IFileSystemItem[]
     {
             projectDirectory.GetDirectory("src"),
             projectDirectory.GetDirectory("wraps")
     });
 }
开发者ID:RobertTheGrey,项目名称:openwrap,代码行数:8,代码来源:NewWrapCommand.cs

示例14: Scaffold

        public void Scaffold(IDirectory directory)
        {
            // Add info page
            IFile aboutFile = directory.GetFile("about.md");
            aboutFile.WriteAllText(@"Title: About Me
---
I'm awesome!");

            // Add post page
            IDirectory postsDirectory = directory.GetDirectory("posts");
            IFile postFile = postsDirectory.GetFile("first-post.md");
            postFile.WriteAllText(@"Title: First Post
Published: 1/1/2016
Tags: Introduction
---
This is my first post!");
        }
开发者ID:ibebbs,项目名称:Wyam,代码行数:17,代码来源:Blog.cs


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