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


C# IAbsoluteDirectoryPath.MakeSurePathExists方法代码示例

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


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

示例1: TryCheckUac

        async Task<bool> TryCheckUac(IAbsoluteDirectoryPath mp, IAbsoluteFilePath path) {
            Exception ex;
            try {
                mp.MakeSurePathExists();
                if (path.Exists)
                    File.Delete(path.ToString());
                using (File.CreateText(path.ToString())) {}
                File.Delete(path.ToString());
                return false;
            } catch (UnauthorizedAccessException e) {
                ex = e;
            } catch (Exception e) {
                this.Logger().FormattedWarnException(e);
                return false;
            }

            var report = await UserErrorHandler.HandleUserError(new UserErrorModel("Restart the application elevated?",
                             $"The application failed to write to the path, probably indicating permission issues\nWould you like to restart the application Elevated?\n\n {mp}",
                             RecoveryCommands.YesNoCommands, null, ex)) == RecoveryOptionResultModel.RetryOperation;

            if (!report)
                return false;
            RestartWithUacInclEnvironmentCommandLine();
            return true;
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:25,代码来源:Restarter.cs

示例2: PackageManager

        public PackageManager(Repository repo, IAbsoluteDirectoryPath workDir, bool createWhenNotExisting = false,
            string remote = null) {
            Contract.Requires<ArgumentNullException>(repo != null);
            Contract.Requires<ArgumentNullException>(workDir != null);
            WorkDir = workDir;
            Repo = repo;
            StatusRepo = new StatusRepo();
            Settings = new PackageManagerSettings();

            Repository.Factory.HandlePathRequirements(WorkDir, Repo);

            if (!WorkDir.Exists) {
                if (!createWhenNotExisting)
                    throw new Exception("Workdir doesnt exist");
                WorkDir.MakeSurePathExists();
            }

            if (!string.IsNullOrWhiteSpace(remote)) {
                var config =
                    Repository.DeserializeJson<RepositoryConfigDto>(
                        FetchString(Tools.Transfer.JoinUri(new Uri(remote), "config.json")));
                if (config.Uuid == Guid.Empty)
                    throw new Exception("Invalid remote, does not contain an UUID");
                Repo.AddRemote(config.Uuid, remote);
                Repo.Save();
            }

            Repository.Log("Opening repository at: {0}. Working directory at: {1}", Repo.RootPath, WorkDir);
            _remote = remote;
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:30,代码来源:PackageManager.cs

示例3: WriteUserConfigTar

 static void WriteUserConfigTar(IAbsoluteDirectoryPath userConfigPath, IAbsoluteDirectoryPath storePath) {
     storePath.MakeSurePathExists();
     //using (var tarFile = new TmpFileCreated()) {
     Tools.Compression.PackTar(userConfigPath, storePath.GetChildFileWithName("userconfig.tar"));
     //  tarFile.FilePath
     //Tools.Compression.Gzip.GzipAuto(tarFile.FilePath, storePath.GetChildFileWithName("userconfig.tar.gz"));
     //}
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:8,代码来源:HandleUserconfigCommand.cs

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

示例5: Install

 public async Task Install(IAbsoluteDirectoryPath destination, Settings settings,
     params IAbsoluteFilePath[] files) {
     destination.MakeSurePathExists();
     foreach (var f in files)
         await f.CopyAsync(destination).ConfigureAwait(false);
     var theShell = GetTheShell(destination, files);
     RunSrm(theShell, "install", "-codebase");
     await RestartExplorer().ConfigureAwait(false);
     settings.ExtensionInstalled();
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:10,代码来源:ExplorerExtensionInstaller.cs

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

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

示例8: ExtractFolder

 void ExtractFolder(IAbsoluteDirectoryPath rootPath, IAbsoluteDirectoryPath tempPath,
     IAbsoluteDirectoryPath destination, IStatus status) {
     destination = destination.GetChildDirectoryWithName("addons");
     destination.MakeSurePathExists();
     var files = Directory.GetFiles(Path.Combine(rootPath.ToString(), "addons"), "*.ifa");
     var i = 0;
     foreach (var f in files) {
         ProcessPbo(f, tempPath, destination);
         i++;
         status.Update(null, ((double)i / files.Length) * 100);
     }
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:12,代码来源:IronFrontInstaller.cs

示例9: DownloadFilesAsync

 async Task DownloadFilesAsync(StatusRepo sr,
     IDictionary<KeyValuePair<string, Func<IAbsoluteFilePath, bool>>, ITransferStatus> transferStatuses,
     IAbsoluteDirectoryPath destinationPath, ExportLifetimeContext<IMirrorSelector> scoreMirrorSelector) {
     destinationPath.MakeSurePathExists();
     sr.Total = transferStatuses.Count;
     using (var multiMirrorFileDownloader = _createMultiMirrorFileDownloader(scoreMirrorSelector.Value))
     using (var multi = _createQueueDownloader(multiMirrorFileDownloader.Value)) {
         await multi.Value
             .DownloadAsync(CreateFileQueueSpec(transferStatuses, destinationPath), sr.CancelToken)
             .ConfigureAwait(false);
     }
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:12,代码来源:FileDownloadHelper.cs

示例10: DownloadFileAsync

 async Task DownloadFileAsync(string remoteFile, IAbsoluteDirectoryPath destinationPath,
     ExportLifetimeContext<IMirrorSelector> scoreMirrorSelector, CancellationToken token,
     Func<IAbsoluteFilePath, bool> confirmValidity, int zsyncHttpFallbackAfter) {
     destinationPath.MakeSurePathExists();
     using (var dl = _createMultiMirrorFileDownloader(scoreMirrorSelector.Value)) {
         await
             dl.Value.DownloadAsync(new MultiMirrorFileDownloadSpec(remoteFile,
                 destinationPath.GetChildFileWithName(remoteFile), confirmValidity) {
                     CancellationToken = token,
                     Progress = new TransferStatus(remoteFile) {ZsyncHttpFallbackAfter = zsyncHttpFallbackAfter}
                 },
                 token).ConfigureAwait(false);
     }
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:14,代码来源:FileDownloadHelper.cs

示例11: DownloadFilesAsync

 async Task DownloadFilesAsync(StatusRepo sr,
     IDictionary<FileFetchInfo, ITransferStatus> transferStatuses,
     IAbsoluteDirectoryPath destinationPath, IMirrorSelector scoreMirrorSelector) {
     destinationPath.MakeSurePathExists();
     sr.Total = transferStatuses.Count;
     using (var multiMirrorFileDownloader = _createMultiMirrorFileDownloader(scoreMirrorSelector))
     using (var multi = _createQueueDownloader(multiMirrorFileDownloader.Value)) {
         await multi.Value
             .DownloadAsync(CreateFileQueueSpec(transferStatuses, destinationPath), sr.CancelToken)
             .ConfigureAwait(false);
     }
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:12,代码来源:FileDownloadHelper.cs

示例12: TmpDirectory

 public TmpDirectory(IAbsoluteDirectoryPath path) {
     path.MakeSurePathExists();
     _path = path;
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:4,代码来源:TmpFile.cs


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