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


C# IAbsoluteDirectoryPath.GetChildFileWithName方法代码示例

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


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

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

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

示例3: ExtractFile

 protected static void ExtractFile(IAbsoluteDirectoryPath tmpFolder, string fileName) {
     var destinationFile = tmpFolder.GetChildFileWithName(fileName);
     using (var s = GetApiStream(fileName))
     using (
         var f = new FileStream(destinationFile.ToString(), FileMode.Create, FileAccess.ReadWrite, FileShare.None)
     )
         s.CopyTo(f);
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:8,代码来源:ApiPortHandler.cs

示例4: IsRightVersion

        bool IsRightVersion(IAbsoluteDirectoryPath rsyncDir, KeyValuePair<string, SixRepoModDto> mod) {
            var versionFile = rsyncDir.GetChildFileWithName(Repository.VersionFileName);
            if (!versionFile.Exists)
                return false;

            var repoInfo = TryReadRepoFile(versionFile);
            return (repoInfo != null) && (repoInfo.Guid == mod.Value.Guid) && (repoInfo.Version == mod.Value.Version);
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:8,代码来源:CustomRepo.cs

示例5: RestoreFileFromBackup

 void RestoreFileFromBackup(IAbsoluteDirectoryPath backupDir, string fileName) {
     var existingFile = InstalledState.Directory.GetChildFileWithName(fileName);
     if (existingFile.Exists)
         return;
     var backupFile = backupDir.GetChildFileWithName(fileName);
     if (!backupFile.Exists)
         return;
     backupFile.Copy(existingFile);
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:9,代码来源:GTA5Game.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: GetRpfList

 private static IReadOnlyCollection<IRelativeFilePath> GetRpfList(IAbsoluteDirectoryPath rpfListPath)
 {
     IReadOnlyCollection<IRelativeFilePath> rpfList = null;
     var rpfDataListFile = rpfListPath.GetChildFileWithName(RpfdataList);
     if (rpfDataListFile.Exists)
     {
         Console.WriteLine("Found {0}, will check package config for validity.", rpfDataListFile);
         rpfList = File.ReadAllLines(rpfDataListFile.ToString()).Select(x => x.ToRelativeFilePath()).ToArray();
     }
     else
     {
         Console.WriteLine("Missing {0}, will NOT check package config for validity.", RpfdataList);
     }
     return rpfList;
 }
开发者ID:SIXNetworks,项目名称:gta-toolkit,代码行数:15,代码来源:PackageConfigWriter.cs

示例8: Uninstall

 public async Task Uninstall(IAbsoluteDirectoryPath destination, Settings settings,
     params IAbsoluteFilePath[] files) {
     var theShell = GetTheShell(destination, files);
     try {
         RunSrm(theShell, "uninstall");
         await RestartExplorer().ConfigureAwait(false);
         foreach (var d in files.Select(f => destination.GetChildFileWithName(f.FileName)).Where(d => d.Exists))
             d.Delete();
     } catch (ProcessExitException ex) {
         // Already uninstalled..
         if (ex.ExitCode != 255)
             throw;
     }
     settings.ExtensionUninstalled();
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:15,代码来源:ExplorerExtensionInstaller.cs

示例9: BuildAndRunBatFile

        protected static async Task BuildAndRunBatFile(IProcessManager pm, IAbsoluteDirectoryPath tmpFolder,
            IEnumerable<string> commands, bool asAdministrator = false, bool noisy = false) {
            var batFile = tmpFolder.GetChildFileWithName("install.bat");
            var actualCommands =
                new[] {"chcp 65001"}.Concat(commands)
                    .Concat(new[] {"echo finished"})
                    .Select(x => x == "" ? x : x + " >> install.log");
            var commandBat = string.Join("\r\n",
                new[] {"", "echo starting > install.log"}.Concat(actualCommands)
                    .Concat(new[] {""}));
            var encoding = Encoding.UTF8;
            File.WriteAllText(batFile.ToString(), commandBat, encoding);
            if (Common.Flags.Verbose || noisy)
                MainLog.Logger.Info("install.bat content:\n" + commandBat);

            try {
                var pInfo = new ProcessStartInfoBuilder(batFile) {
                    WorkingDirectory = tmpFolder
                    //WindowStyle = ProcessWindowStyle.Minimized
                }.Build();
                pInfo.CreateNoWindow = true;
                var basicLaunchInfo = new BasicLaunchInfo(pInfo) {StartMinimized = true};
                var r =
                    await (asAdministrator ? pm.LaunchElevatedAsync(basicLaunchInfo) : pm.LaunchAsync(basicLaunchInfo));
                r.ConfirmSuccess();
            } catch (Win32Exception ex) {
                if (ex.IsElevationCancelled())
                    throw ex.HandleUserCancelled();
                throw;
            }
            var logFile = tmpFolder.GetChildFileWithName("install.log");
            var output = File.ReadAllText(logFile.ToString(), encoding);

            if (Common.Flags.Verbose || noisy)
                MainLog.Logger.Info("install.bat output:\n" + output);
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:36,代码来源:ApiPortHandler.cs

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

示例11: Initialize

 public async Task Initialize(IAbsoluteDirectoryPath gamePath, uint appId) {
     var r = await _steamApi.Do(x => {
         var managerConfigWrap = new ManagerConfigWrap {ConsumerAppId = appId};
         managerConfigWrap.Load(gamePath.GetChildFileWithName(@"Launcher\config.bin").ToString());
         return x.Init(managerConfigWrap);
     }).ConfigureAwait(false);
     if (r == InitResult.SteamNotRunning)
         throw new SteamInitializationException(
             "Steam initialization failed. Is Steam running under the same priviledges?");
     if (r == InitResult.APIInitFailed)
         throw new SteamInitializationException(
             "Steam initialization failed. Is Steam running under the same priviledges?");
     if (r == InitResult.ContextCreationFailed)
         throw new SteamInitializationException(
             "Steam initialization failed. Is Steam running under the same priviledges?");
     if (r == InitResult.AlreadyInitialized)
         throw new SteamInitializationException(
             "Steam initialization failed. Already initialized");
     if (r == InitResult.Disabled)
         throw new SteamInitializationException(
             "Steam initialization failed. Disabled");
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:22,代码来源:SteamApi.cs

示例12: DownloadAndInstallCommunityPatchInternal

 void DownloadAndInstallCommunityPatchInternal(string patchFile, IAbsoluteDirectoryPath destinationPath,
     ITransferStatus status, IAbsoluteDirectoryPath gamePath) {
     var filePath = destinationPath.GetChildFileWithName(patchFile);
     Download(patchFile, status, filePath);
     status.Reset();
     var gameFilePath = gamePath.GetChildFileWithName(filePath.FileName);
     Tools.Compression.Unpack(filePath, gamePath, true, true, true);
     try {
         InstallPatch(gameFilePath, "-silent -incurrentfolder");
     } finally {
         gameFilePath.FileInfo.Delete();
     }
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:13,代码来源:IronFrontInstaller.cs

示例13: InstallOfficialPatchInternal

 void InstallOfficialPatchInternal(string patchFile, IAbsoluteDirectoryPath tempPath, ITransferStatus status) {
     var filePath = tempPath.GetChildFileWithName(patchFile);
     Download(patchFile, status, filePath);
     status.Reset();
     InstallPatch(filePath, "-silent");
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:6,代码来源:IronFrontInstaller.cs

示例14: WriteBundleToDisk

 static void WriteBundleToDisk(Bundle bundle, IAbsoluteDirectoryPath destination) {
     Repository.SaveDto(CreateBundleDto(bundle),
         destination.GetChildFileWithName(GetBundleFileName(bundle)));
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:4,代码来源:BundleConverter.cs

示例15: CreateBatFile

 public Task CreateBatFile(IAbsoluteDirectoryPath path, string name, string content) {
     return
         Ops.CreateTextAsync(
             path.GetChildFileWithName(MakeValidBatFileName(name)), content);
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:5,代码来源:File.cs


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