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


C# IAbsoluteDirectoryPath.ToString方法代码示例

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


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

示例1: GetRepoPath

 public IAbsoluteDirectoryPath GetRepoPath(string repoDirectory, IAbsoluteDirectoryPath directory,
     bool local = false) {
     if (string.IsNullOrWhiteSpace(repoDirectory)) {
         repoDirectory = directory.GetChildDirectoryWithName(Repository.DefaultRepoRootDirectory).ToString();
         if (!Directory.Exists(repoDirectory)) {
             var dir = Tools.FileUtil.FindPathInParents(directory.ToString(), Repository.DefaultRepoRootDirectory);
             if (dir != null && Directory.Exists(dir))
                 repoDirectory = dir;
             else if (local)
                 repoDirectory = directory.ToString();
         }
     }
     return Legacy.SixSync.Repository.RepoTools.GetRootedPath(repoDirectory);
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:14,代码来源:PackageFactory.cs

示例2: OpenRepositoryWithRetry

        public Repository OpenRepositoryWithRetry(IAbsoluteDirectoryPath path, bool createWhenNotExisting = false,
            Action failAction = null) {
            if (createWhenNotExisting && !path.Exists)
                return new Repository(path, createWhenNotExisting);

            using (var autoResetEvent = new AutoResetEvent(false))
            using (var fileSystemWatcher =
                new FileSystemWatcher(path.ToString(), "*.lock") {
                    EnableRaisingEvents = true
                }) {
                var lockFile = path.GetChildFileWithName(Repository.LockFile);
                var fp = Path.GetFullPath(lockFile.ToString());
                fileSystemWatcher.Deleted +=
                    (o, e) => {
                        if (Path.GetFullPath(e.FullPath) == fp)
                            autoResetEvent.Set();
                    };

                while (true) {
                    using (var timer = UnlockTimer(lockFile, autoResetEvent)) {
                        try {
                            return new Repository(path, createWhenNotExisting);
                        } catch (RepositoryLockException) {
                            if (failAction != null)
                                failAction();
                            timer.Start();
                            autoResetEvent.WaitOne();
                            lock (timer)
                                timer.Stop();
                            autoResetEvent.Reset();
                        }
                    }
                }
            }
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:35,代码来源:RepositoryFactory.cs

示例3: TryGetRelativePath

         //
         //  Relative/absolute computation
         //

         internal static bool TryGetRelativePath(IAbsoluteDirectoryPath pathFrom, IAbsolutePath pathTo, out string pathResult, out string failurereason) {
            Debug.Assert(pathFrom != null);
            Debug.Assert(pathTo != null);

            if (!pathFrom.OnSameVolumeThan(pathTo)) {
               failurereason = @"Cannot compute relative path from 2 paths that are not on the same volume 
   PathFrom = """ + pathFrom.ToString() + @"""
   PathTo   = """ + pathTo.ToString() + @"""";
               pathResult = null;
               return false;
            }
            // Only work with Directory 
            if (pathTo.IsFilePath) { pathTo = pathTo.ParentDirectoryPath; }
            pathResult = GetPathRelativeTo(pathFrom.ToString(), pathTo.ToString());
            failurereason = null;
            return true;
         }
开发者ID:ArsenShnurkov,项目名称:NDepend.Path,代码行数:21,代码来源:PathHelpers+AbsoluteRelativePathHelpers.cs

示例4: MigrateServerModFolder

 static void MigrateServerModFolder(IAbsoluteDirectoryPath modFolder, IAbsoluteDirectoryPath modPath) {
     var folderName = modFolder.DirectoryName;
     var destination = modPath.GetChildDirectoryWithName(folderName);
     if (!destination.Exists)
         Tools.FileUtil.Ops.MoveDirectory(modFolder, destination);
     else
         Directory.Delete(modFolder.ToString(), true);
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:8,代码来源:ServerModsMigrator.cs

示例5: UnpackUpdater

            public virtual void UnpackUpdater(IAbsoluteFilePath sourceFile, IAbsoluteDirectoryPath outputFolder,
                bool overwrite = false, bool fullPath = true) {
                Contract.Requires<ArgumentNullException>(sourceFile != null);
                Contract.Requires<ArgumentNullException>(outputFolder != null);

                Generic.RunUpdater(UpdaterCommands.Unpack, sourceFile.ToString(), outputFolder.ToString(),
                    overwrite ? "--overwrite" : null,
                    fullPath.ToString());
            }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:9,代码来源:ToolsCompression.cs

示例6: MoveModFolders

        public void MoveModFolders(IAbsoluteDirectoryPath oldModsPath, IAbsoluteDirectoryPath newModsPath) {
            newModsPath.MakeSurePathExists();

            foreach (var dir in Directory.EnumerateDirectories(oldModsPath.ToString())
                .Where(x => !excludeFolders.Contains(Path.GetFileName(x).ToLower()))
                .Where(x => File.Exists(Path.Combine(x, Package.SynqInfoFile)) ||
                            Directory.Exists(Path.Combine(x, Repository.RepoFolderName))))
                TryMoveDir(dir.ToAbsoluteDirectoryPath(), newModsPath);
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:9,代码来源:PathMover.cs

示例7: TryUserconfigUpdate

        void TryUserconfigUpdate(string path, IAbsoluteDirectoryPath gamePath, IAbsoluteDirectoryPath uconfig,
            IAbsoluteDirectoryPath uconfigPath) {
            if (!ConfirmUserconfigIsNotFile(uconfig.ToString()))
                return;

            if (Directory.Exists(path))
                TryUserconfigDirectory(path.ToAbsoluteDirectoryPath(), uconfigPath);
            else if (File.Exists(path))
                TryUserconfigUnpack(path.ToAbsoluteFilePath(), gamePath);
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:10,代码来源:UserconfigUpdater.cs

示例8: RunExtractPboWithParameters

        public void RunExtractPboWithParameters(IAbsoluteFilePath input, IAbsoluteDirectoryPath output,
            params string[] parameters) {
            if (!input.Exists)
                throw new IOException("File doesn't exist: " + input);
            var startInfo =
                new ProcessStartInfoBuilder(_extractPboBin,
                    BuildParameters(input.ToString(), output.ToString(), parameters)).Build();

            ProcessExitResult(_processManager.LaunchAndGrabTool(startInfo));
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:10,代码来源:PboTools.cs

示例9: TryUserconfigClean

        void TryUserconfigClean(string path, IAbsoluteDirectoryPath gamePath, IAbsoluteDirectoryPath uconfig,
            IAbsoluteDirectoryPath uconfigPath) {
            if (!ConfirmUserconfigIsNotFile(uconfig.ToString()))
                return;

            if (Directory.Exists(path))
                TryUserconfigDirectoryOverwrite(path.ToAbsoluteDirectoryPath(), uconfigPath);
            else
                TryUserconfigUnpackOverwrite(path.ToAbsoluteFilePath(), gamePath);
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:10,代码来源:UserconfigBackupAndClean.cs

示例10: UnpackArchive

 static void UnpackArchive(IAbsoluteFilePath sourceFile, IAbsoluteDirectoryPath outputFolder, bool overwrite,
     bool checkFileIntegrity,
     SevenZipExtractor extracter) {
     if (checkFileIntegrity && !extracter.Check())
         throw new Exception(String.Format("Appears to be an invalid archive: {0}", sourceFile));
     outputFolder.MakeSurePathExists();
     extracter.ExtractFiles(outputFolder.ToString(), overwrite
         ? extracter.ArchiveFileNames.ToArray()
         : extracter.ArchiveFileNames.Where(x => !outputFolder.GetChildFileWithName(x).Exists)
             .ToArray());
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:11,代码来源:Compression.cs

示例11: Init

        public Repository Init(IAbsoluteDirectoryPath folder, IReadOnlyCollection<Uri> hosts,
            Dictionary<string, object> opts = null) {
            Contract.Requires<ArgumentNullException>(folder != null);
            Contract.Requires<ArgumentNullException>(hosts != null);

            if (opts == null)
                opts = new Dictionary<string, object>();

            var rsyncFolder = folder.GetChildDirectoryWithName(Repository.RepoFolderName);
            if (rsyncFolder.Exists)
                throw new Exception("Already appears to be a repository");

            var packFolder = Path.Combine(opts.ContainsKey("pack_path")
                ? ((string) opts["pack_path"])
                : rsyncFolder.ToString(),
                Repository.PackFolderName).ToAbsoluteDirectoryPath();

            var configFile = rsyncFolder.GetChildFileWithName(Repository.ConfigFileName);
            var wdVersionFile = rsyncFolder.GetChildFileWithName(Repository.VersionFileName);
            var packVersionFile = packFolder.GetChildFileWithName(Repository.VersionFileName);

            this.Logger().Info("Initializing {0}", folder);
            rsyncFolder.MakeSurePathExists();
            packFolder.MakeSurePathExists();

            var config = new RepoConfig {Hosts = hosts.ToArray()};

            if (opts.ContainsKey("pack_path"))
                config.PackPath = (string) opts["pack_path"];

            if (opts.ContainsKey("include"))
                config.Include = (string[]) opts["include"];

            if (opts.ContainsKey("exclude"))
                config.Exclude = (string[]) opts["exclude"];

            var guid = opts.ContainsKey("required_guid")
                ? (string) opts["required_guid"]
                : Guid.NewGuid().ToString();

            var packVersion = new RepoVersion {Guid = guid};
            if (opts.ContainsKey("archive_format"))
                packVersion.ArchiveFormat = (string) opts["archive_format"];

            var wdVersion = YamlExtensions.NewFromYaml<RepoVersion>(packVersion.ToYaml());

            config.SaveYaml(configFile);
            packVersion.SaveYaml(packVersionFile);
            wdVersion.SaveYaml(wdVersionFile);

            return TryGetRepository(folder.ToString(), opts, rsyncFolder.ToString());
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:52,代码来源:RepositoryFactory.cs

示例12: TryGetAbsolutePathFrom

         internal static bool TryGetAbsolutePathFrom(IAbsoluteDirectoryPath pathFrom, IPath pathTo, out string pathResult, out string failureReason) {
            Debug.Assert(pathFrom != null);
            Debug.Assert(pathTo != null);
            Debug.Assert(pathTo.IsRelativePath);
           
            if (pathFrom.Kind == AbsolutePathKind.DriveLetter) {
               // Only work with Directory 
               if (pathTo.IsFilePath) { pathTo = pathTo.ParentDirectoryPath; }
               return TryGetAbsolutePath(pathFrom.ToString(), pathTo.ToString(), out pathResult, out failureReason);
            }


            //
            // Special case when a relative path is asked from a UNC path like ".." from "\\Server\Share".
            // In such case we cannot return "\\Server" that is not a valis UNC path
            // To address this we create a temporary drive letter absolute path and do the TryGetAbsolutePathFrom() on it!
            //
            Debug.Assert(pathFrom.Kind == AbsolutePathKind.UNC);
            var pathFromString = pathFrom.ToString();
            string uncServerShareStart;
            var fakePathFromString = UNCPathHelper.TranformUNCIntoDriveLetter(pathFromString, out uncServerShareStart);
            Debug.Assert(fakePathFromString.IsValidAbsoluteDirectoryPath());
            var fakePathFrom = fakePathFromString.ToAbsoluteDirectoryPath();

            // Call me, but this time with a DriveLetter path (no risk of infinite recursion!)
            string pathResultDriveLetter;
            if (!TryGetAbsolutePathFrom(fakePathFrom, pathTo, out pathResultDriveLetter, out failureReason)) {
               failureReason = failureReason.Replace(UNCPathHelper.FAKE_DRIVE_LETTER_PREFIX, uncServerShareStart);
               pathResult = null;
               return false;
            }

            Debug.Assert(pathResultDriveLetter != null);
            Debug.Assert(pathResultDriveLetter.Length > 0);
            Debug.Assert(pathResultDriveLetter.StartsWith(UNCPathHelper.FAKE_DRIVE_LETTER_PREFIX));
            pathResult = UNCPathHelper.TranformDriveLetterIntoUNC(pathResultDriveLetter, uncServerShareStart);

            return true;
         }
开发者ID:ArsenShnurkov,项目名称:NDepend.Path,代码行数:39,代码来源:PathHelpers+AbsoluteRelativePathHelpers.cs

示例13: Init

        public Repository Init(IAbsoluteDirectoryPath directory, RepositoryOperationMode? mode = null) {
            Contract.Requires<ArgumentNullException>(directory != null);

            if (File.Exists(directory.ToString()))
                throw new SynqPathException("Already exists file with same name");

            ConfirmEmpty(directory);

            directory.MakeSurePathExists();
            var repo = new Repository(directory, true);
            if (mode != null)
                repo.Config.OperationMode = mode.Value;
            repo.Save();
            return repo;
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:15,代码来源:RepositoryFactory.cs

示例14: Init

        public Package Init(Repository repo, IAbsoluteDirectoryPath directory, PackageMetaData initialMetaData = null) {
            Contract.Requires<ArgumentNullException>(directory != null);

            if (initialMetaData == null)
                initialMetaData = new PackageMetaData(PackifyPath(directory.ToString()));

            if (string.IsNullOrWhiteSpace(initialMetaData.Name))
                throw new Exception("Initial metadata lacks Package Name");

            if (initialMetaData.Version == null)
                throw new Exception("Initial metadata lacks Version");

            var depName = initialMetaData.GetFullName();
            if (repo.HasPackage(depName))
                throw new Exception("Package and version already exists: " + depName);

            return new Package(directory, initialMetaData, repo);
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:18,代码来源:PackageFactory.cs

示例15: InstallDll

        static bool InstallDll(IAbsoluteFilePath pluginPath, IAbsoluteDirectoryPath gamePluginFolder,
            bool force = true) {
            Contract.Requires<ArgumentNullException>(gamePluginFolder != null);
            Contract.Requires<ArgumentNullException>(pluginPath != null);

            if (!pluginPath.IsNotNullAndExists())
                throw new PathDoesntExistException(pluginPath.ToString());

            if (!gamePluginFolder.IsNotNullAndExists())
                throw new PathDoesntExistException(gamePluginFolder.ToString());

            var fullPath = gamePluginFolder.GetChildFileWithName(pluginPath.FileName);

            if (!force && fullPath.Exists)
                return false;

            return TryCopyDll(pluginPath, fullPath);
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:18,代码来源:GameFolderService.cs


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