本文整理汇总了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();
}
}
}
}
}
示例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"));
//}
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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");
}
示例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();
}
}
示例13: InstallOfficialPatchInternal
void InstallOfficialPatchInternal(string patchFile, IAbsoluteDirectoryPath tempPath, ITransferStatus status) {
var filePath = tempPath.GetChildFileWithName(patchFile);
Download(patchFile, status, filePath);
status.Reset();
InstallPatch(filePath, "-silent");
}
示例14: WriteBundleToDisk
static void WriteBundleToDisk(Bundle bundle, IAbsoluteDirectoryPath destination) {
Repository.SaveDto(CreateBundleDto(bundle),
destination.GetChildFileWithName(GetBundleFileName(bundle)));
}
示例15: CreateBatFile
public Task CreateBatFile(IAbsoluteDirectoryPath path, string name, string content) {
return
Ops.CreateTextAsync(
path.GetChildFileWithName(MakeValidBatFileName(name)), content);
}