• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FileSystemPath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中FileSystemPath的典型用法代码示例。如果您正苦于以下问题:C# FileSystemPath类的具体用法?C# FileSystemPath怎么用?C# FileSystemPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileSystemPath类属于命名空间,在下文中一共展示了FileSystemPath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ImplicitConversionBackToString

        public void ImplicitConversionBackToString()
        {
            var path = new FileSystemPath(@"relative\path", false, @"c:\");

            string pathString = path;
            pathString.Should().Be(@"c:\relative\path");
        }
开发者ID:reubeno,项目名称:NClap,代码行数:7,代码来源:FileSystemPathTests.cs


示例2: ProductSettingsTracker

        public ProductSettingsTracker(Lifetime lifetime, ClientFactory clientFactory, IViewable<ISyncSource> syncSources, IFileSystemTracker fileSystemTracker, JetBoxSettingsStorage jetBoxSettings)
        {
            myClientFactory = clientFactory;
              mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              mySettingsStore.Changed.Advise(lifetime, _ => InitClient());

              myRootFolder = FileSystemPath.Parse("ReSharperPlatform");
              InitClient();

              syncSources.View(lifetime, (lt1, source) =>
            source.FilesToSync.View(lt1, (lt2, fileToSync) =>
            {
              SyncFromCloud(fileToSync.Value);

              var fileTrackingLifetime = new SequentialLifetimes(lt2);
              fileToSync.Change.Advise(lt2,
            args =>
            {
              var path = args.Property.Value;
              if (lifetime.IsTerminated || path.IsNullOrEmpty())
              {
                fileTrackingLifetime.TerminateCurrent();
              }
              else
              {
                fileTrackingLifetime.Next(lt =>
                    fileSystemTracker.AdviseFileChanges(lt, path,
                      delta => delta.Accept(new FileChangesVisitor(myClient, myRootFolder))));
              }
            });
            }));
        }
开发者ID:derigel23,项目名称:JetBox,代码行数:32,代码来源:ProductSettingsTracker.cs


示例3: Move

 public static void Move(this IFileSystem sourceFileSystem, FileSystemPath sourcePath, IFileSystem destinationFileSystem, FileSystemPath destinationPath)
 {
     IEntityMover mover;
     if (!EntityMovers.Registration.TryGetSupported(sourceFileSystem.GetType(), destinationFileSystem.GetType(), out mover))
         throw new ArgumentException("The specified combination of file-systems is not supported.");
     mover.Move(sourceFileSystem, sourcePath, destinationFileSystem, destinationPath);
 }
开发者ID:readelivery,项目名称:sharpfilesystem,代码行数:7,代码来源:FileSystemExtensions.cs


示例4: DeclaredElementAsTypeMember

        public static IDeclaredElement DeclaredElementAsTypeMember(this MockFactory factory, string typename, string member, 
            string location)
        {
            var elt = factory.Create<IDeclaredElement>();
            var typeMember = elt.As<ITypeMember>();

            var module = factory.Create<IAssemblyPsiModule>();

            var file = factory.Create<IAssemblyFile>();

            var path = new FileSystemPath(location);
            var type = factory.Create<ITypeElement>();

            typeMember.Setup(tm => tm.GetContainingType()).Returns(type.Object);
            typeMember.Setup(tm => tm.ShortName).Returns(member);

            type.Setup(t => t.CLRName).Returns(typename);

            file.Setup(f => f.Location).Returns(path);

            module.Setup(m => m.Assembly.GetFiles()).Returns(
                new[] { file.Object });

            typeMember.Setup(te => te.Module).Returns(module.Object);

            return elt.Object;
        }
开发者ID:ArildF,项目名称:RogueSharper,代码行数:27,代码来源:PsiMother.cs


示例5: CreateSingleFileSolution

        protected Pair<ISolution, IProjectFile> CreateSingleFileSolution(string relativeProjectDirectory, string fileName, string [] systemAssemblies)
        {
            PlatformInfo platformInfo = PlatformManager.Instance.GetPlatformInfo("Standard", Environment.Version);
            string projectDirectory = Path.Combine(testFilesDirectory, relativeProjectDirectory);

            FileSystemPath filePath = new FileSystemPath(Path.Combine(projectDirectory, fileName));
            if(!File.Exists(filePath.ToString()))
                Assert.Fail("File does not exists {0}", filePath);

            ISolution solution =
                SolutionManager.Instance.CreateSolution(
                    new FileSystemPath(Path.Combine(projectDirectory, "TestSolution.sln")));
            IProject project =
                solution.CreateProject(new FileSystemPath(Path.Combine(projectDirectory, "TestProject.csproj")),
                                       ProjectFileType.CSHARP,
                                       platformInfo.PlatformID);

            Arp.Common.Assertions.Assert.CheckNotNull(platformInfo);
            project.AddAssemblyReference(platformInfo.MscorlibPath.ToString());

            if(systemAssemblies != null)
            {
                foreach (string systemAssemblyName in systemAssemblies)
                {
                    string assemblyPath = GetSystemAssemblyPath(platformInfo, systemAssemblyName);
                    project.AddAssemblyReference(assemblyPath);
                }
            }

            IProjectFile file = project.CreateFile(filePath);

            return new Pair<ISolution, IProjectFile>(solution, file);
        }
开发者ID:willrawls,项目名称:arp,代码行数:33,代码来源:BaseTest.cs


示例6: Delete

 public void Delete(FileSystemPath path)
 {
     using (var r = Refer(path))
     {
         r.FileSystem.Delete(GetRelativePath(path));
     }
 }
开发者ID:Maxwolf,项目名称:FakeFilesystem,代码行数:7,代码来源:SeamlessArchiveFileSystem.cs


示例7: IsArchiveFile

 protected override bool IsArchiveFile(IFileSystem fileSystem, FileSystemPath path)
 {
     return path.IsFile
         && ArchiveExtensions.Contains(path.GetExtension())
         && !HasArchive(path)// HACK: Disable ability to open archives inside archives (SevenZip's stream does not have the ability to trace at the moment).
         ;
 }
开发者ID:Mexahoid,项目名称:CSF,代码行数:7,代码来源:SeamlessSevenZipFileSystem.cs


示例8: Read

        public static NuSpec Read(FileSystemPath path)
        {
            if (!path.ExistsFile)
            return null;

              NuSpec nuspec = null;

              Logger.CatchSilent(() =>
              {
            using (var stream = path.OpenFileForReading())
            {
              stream.ReadXml(packageReader =>
              {
            if (!packageReader.ReadToDescendant("metadata"))
              return;

            packageReader.ReadElement(metadataReader =>
            {
              if (metadataReader.LocalName != "metadata")
                return;

              nuspec = new NuSpec();
              metadataReader.ReadSubElements(childReader =>
              {
                Action<NuSpec, string> action;
                if (StringActions.TryGetValue(childReader.LocalName, out action))
                  action(nuspec, childReader.ReadElementContentAsString());
              });
            });
              });
            }
              });

              return nuspec;
        }
开发者ID:JetBrains,项目名称:resharper-vsix,代码行数:35,代码来源:NuSpecReader.cs


示例9: CreateDirectory

 public void CreateDirectory(FileSystemPath path)
 {
     using (var r = Refer(path))
     {
         r.FileSystem.CreateDirectory(GetRelativePath(path));
     }
 }
开发者ID:Maxwolf,项目名称:FakeFilesystem,代码行数:7,代码来源:SeamlessArchiveFileSystem.cs


示例10: T4OutsideSolutionSourceFile

 public T4OutsideSolutionSourceFile(IProjectFileExtensions projectFileExtensions,
     PsiProjectFileTypeCoordinator projectFileTypeCoordinator, IPsiModule module, FileSystemPath path,
     Func<PsiSourceFileFromPath, bool> validityCheck, Func<PsiSourceFileFromPath, IPsiSourceFileProperties> propertiesFactory,
     DocumentManager documentManager, IModuleReferenceResolveContext resolveContext)
     : base(projectFileExtensions, projectFileTypeCoordinator, module, path, validityCheck, propertiesFactory, documentManager, resolveContext)
 {
 }
开发者ID:ThatShawGuy,项目名称:ForTea,代码行数:7,代码来源:T4OutsideSolutionSourceFile.v8.cs


示例11: OpenFile

 public Stream OpenFile(FileSystemPath path, FileAccess access)
 {
     var fs = GetFirst(path);
     if (fs == null)
         throw new FileNotFoundException();
     return fs.OpenFile(path, access);
 }
开发者ID:Maxwolf,项目名称:FakeFilesystem,代码行数:7,代码来源:MergedFileSystem.cs


示例12: Move

        public void Move(IFileSystem source, FileSystemPath sourcePath, IFileSystem destination, FileSystemPath destinationPath)
        {
            bool isFile;
            if ((isFile = sourcePath.IsFile) != destinationPath.IsFile)
                throw new ArgumentException("The specified destination-path is of a different type than the source-path.");

            if (isFile)
            {
                using (var sourceStream = source.OpenFile(sourcePath, FileAccess.Read))
                {
                    using (var destinationStream = destination.CreateFile(destinationPath))
                    {
                        byte[] buffer = new byte[BufferSize];
                        int readBytes;
                        while ((readBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0)
                            destinationStream.Write(buffer, 0, readBytes);
                    }
                }
                source.Delete(sourcePath);
            }
            else
            {
                destination.CreateDirectory(destinationPath);
                foreach (var ep in source.GetEntities(sourcePath).ToArray())
                {
                    var destinationEntityPath = ep.IsFile
                                                    ? destinationPath.AppendFile(ep.EntityName)
                                                    : destinationPath.AppendDirectory(ep.EntityName);
                    Move(source, ep, destination, destinationEntityPath);
                }
                if (!sourcePath.IsRoot)
                    source.Delete(sourcePath);
            }
        }
开发者ID:readelivery,项目名称:sharpfilesystem,代码行数:34,代码来源:StandardEntityMover.cs


示例13: Delete

 public void Delete(FileSystemPath path)
 {
     if (path.IsFile)
         System.IO.File.Delete(GetPhysicalPath(path));
     else
         System.IO.Directory.Delete(GetPhysicalPath(path), true);
 }
开发者ID:Mexahoid,项目名称:CSF,代码行数:7,代码来源:PhysicalFileSystem.cs


示例14: AddEntity

 public void AddEntity(FileSystemPath path)
 {
     if (!_entities.Contains(path))
         _entities.Add(path);
     if (!path.IsRoot)
         AddEntity(path.ParentPath);
 }
开发者ID:Mexahoid,项目名称:CSF,代码行数:7,代码来源:SevenZipFileSystem.cs


示例15: ProductSettingsTracker

        public ProductSettingsTracker(Lifetime lifetime, IProductNameAndVersion product, ClientFactory clientFactory, GlobalPerProductStorage globalPerProductStorage, IFileSystemTracker fileSystemTracker, JetBoxSettingsStorage jetBoxSettings)
        {
            myClientFactory = clientFactory;
              mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              mySettingsStore.Changed.Advise(lifetime, _ => InitClient());

              myRootFolder = FileSystemPath.Parse(product.ProductName);
              InitClient();

              var productSettingsPath = globalPerProductStorage.XmlFileStorage.Path;

              SyncFromCloud(productSettingsPath.Value);

              var fileTrackingLifetime = new SequentialLifetimes(lifetime);
              productSettingsPath.Change.Advise(lifetime,
            args =>
            {
              var path = args.Property.Value;
              if (lifetime.IsTerminated || path.IsNullOrEmpty())
              {
            fileTrackingLifetime.TerminateCurrent();
              }
              else
              {
            fileTrackingLifetime.Next(lt => fileSystemTracker.AdviseFileChanges(lt, path, delta => delta.Accept(new FileChangesVisitor(myClient, myRootFolder))));
              }
            });
        }
开发者ID:jrote1,项目名称:JetBox,代码行数:28,代码来源:ProductSettingsTracker.cs


示例16: DeclaredElementAsTypeOwner

        public static IDeclaredElement DeclaredElementAsTypeOwner(this MockFactory factory, string typename, 
           string location)
        {
            var elt = factory.Create<IDeclaredElement>();
            var typeOwner = elt.As<ITypeOwner>();
            var type = factory.Create<IType>();
            var declaredType = type.As<IDeclaredType>();
            var typeElement = factory.Create<ITypeElement>();

            typeOwner.SetupGet(tm => tm.Type).Returns(type.Object);

            var module = factory.Create<IAssemblyPsiModule>();

            var file = factory.Create<IAssemblyFile>();

            var path = new FileSystemPath(location);

            declaredType.Setup(dt => dt.GetTypeElement()).Returns(
                typeElement.Object);

            typeElement.Setup(dt => dt.CLRName).Returns(typename);

            file.Setup(f => f.Location).Returns(path);

            module.Setup(m => m.Assembly.GetFiles()).Returns(
                new[] { file.Object });

            typeElement.Setup(dt => dt.Module).Returns(module.Object);

            return elt.Object;
        }
开发者ID:ArildF,项目名称:RogueSharper,代码行数:31,代码来源:PsiMother.cs


示例17: Exists

 public bool Exists(FileSystemPath path)
 {
     if (path.IsFile)
         return ToEntry(path) != null;
     return GetZipEntries()
         .Select(ToPath)
         .Any(entryPath => entryPath.IsChildOf(path));
 }
开发者ID:Mexahoid,项目名称:CSF,代码行数:8,代码来源:SharpZipLibFileSystem.cs


示例18: Exists

 public bool Exists(FileSystemPath path)
 {
     using (var r = Refer(path))
     {
         var fileSystem = r.FileSystem;
         return fileSystem.Exists(GetRelativePath(path));
     }
 }
开发者ID:Maxwolf,项目名称:FakeFilesystem,代码行数:8,代码来源:SeamlessArchiveFileSystem.cs


示例19: GetUri

        private static Uri GetUri(FileSystemPath documentationRoot, string htmlPath)
        {
            if (documentationRoot.IsEmpty)
                return null;

            var fileSystemPath = documentationRoot/"en"/htmlPath;
            return fileSystemPath.ExistsFile ? fileSystemPath.ToUri() : null;
        }
开发者ID:JetBrains,项目名称:resharper-unity,代码行数:8,代码来源:ShowUnityHelp.cs


示例20: OpenFile

 public Stream OpenFile(FileSystemPath path, FileAccess access)
 {
     if (access == FileAccess.Write)
         throw new NotSupportedException();
     if (path.IsDirectory || path.ParentPath != FileSystemPath.Root)
         throw new FileNotFoundException();
     return Assembly.GetManifestResourceStream(path.EntityName);
 }
开发者ID:readelivery,项目名称:sharpfilesystem,代码行数:8,代码来源:EmbeddedResourceFileSystem.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FileSystemRights类代码示例发布时间:2022-05-24
下一篇:
C# FileSystemHelper类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap