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


C# FileSystemPath类代码示例

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


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


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