本文整理汇总了C#中IAbsoluteDirectoryPath.GetChildDirectoryWithName方法的典型用法代码示例。如果您正苦于以下问题:C# IAbsoluteDirectoryPath.GetChildDirectoryWithName方法的具体用法?C# IAbsoluteDirectoryPath.GetChildDirectoryWithName怎么用?C# IAbsoluteDirectoryPath.GetChildDirectoryWithName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAbsoluteDirectoryPath
的用法示例。
在下文中一共展示了IAbsoluteDirectoryPath.GetChildDirectoryWithName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleUserconfig
void HandleUserconfig(IAbsoluteDirectoryPath dir) {
var userConfigPath = dir.GetChildDirectoryWithName("userconfig");
if (!userConfigPath.Exists)
return;
System.Console.WriteLine("Found userconfig in {0}, processing", dir);
HandleUserConfigPath(dir, userConfigPath);
}
示例2: ProcessUserconfig
public string ProcessUserconfig(IAbsoluteDirectoryPath modPath, IAbsoluteDirectoryPath gamePath,
string exisitingChecksum, bool force = true) {
Contract.Requires<ArgumentNullException>(modPath != null);
Contract.Requires<ArgumentNullException>(gamePath != null);
var backupAndClean = force;
var path = GetUserconfigPath(modPath);
if (!File.Exists(path) && !Directory.Exists(path))
return null;
this.Logger().Info("Found userconfig to process at " + path);
var checksum = GetConfigChecksum(path);
if (checksum != exisitingChecksum)
backupAndClean = true;
var uconfig = gamePath.GetChildDirectoryWithName("userconfig");
var uconfigPath = uconfig.GetChildDirectoryWithName(Mod.GetRepoName(modPath.DirectoryName));
if (backupAndClean)
new UserconfigBackupAndClean().ProcessBackupAndCleanInstall(path, gamePath, uconfig, uconfigPath);
else
new UserconfigUpdater().ProcessMissingFiles(path, gamePath, uconfig, uconfigPath);
return checksum;
}
示例3: 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);
}
示例4: TryMoveDir
static void TryMoveDir(IAbsoluteDirectoryPath dir, IAbsoluteDirectoryPath newModsPath) {
var newPath = newModsPath.GetChildDirectoryWithName(dir.DirectoryName);
try {
if (newPath.Exists)
Directory.Delete(newPath.ToString(), true);
} finally {
Tools.FileUtil.Ops.MoveDirectory(dir, newPath);
}
}
示例5: ScanForAddonFolders
LocalContent ScanForAddonFolders(IAbsoluteDirectoryPath path) {
var dirs = new[] {"addons", "dta", "common", "dll"};
if (dirs.Any(x => !path.GetChildDirectoryWithName(x).IsEmptySafe())) {
return !HasContentAlready(path.DirectoryName)
? new ModLocalContent(path.DirectoryName.ToLower(), _realVirtualityGame.Id,
new BasicInstallInfo())
: null;
}
return null;
}
示例6: YomaContent
public YomaContent(IAbsoluteDirectoryPath destination, Uri uri, IFileDownloadHelper downloader) {
Contract.Requires<ArgumentNullException>(destination != null);
_downloader = downloader;
Destination = destination;
YasDir = Destination.GetChildDirectoryWithName(".yas");
FilesDir = YasDir.GetChildDirectoryWithName("files");
Url = uri;
ConfigArchive = YasDir.GetChildFileWithName("config" + ArchiveExtension);
TmpPath = YasDir.GetChildDirectoryWithName("tmp");
}
示例7: SteamDirectories
public SteamDirectories(uint appId, string folder, IAbsoluteDirectoryPath steamPath) {
Contract.Requires<ArgumentNullException>(appId > 0);
Contract.Requires<ArgumentNullException>(folder != null);
Contract.Requires<ArgumentNullException>(steamPath != null);
// TODO: Take LibraryPath from KV store
RootPath = steamPath.GetChildDirectoryWithName("steamapps");
Game = new SteamGameDirectories(folder, RootPath);
Workshop = new SteamWorkshopDirectories(appId, RootPath);
}
示例8: HandleUserconfigFiles
void HandleUserconfigFiles(IAbsoluteDirectoryPath userConfigPath, IAbsoluteDirectoryPath storePath,
IEnumerable<FileInfo> files) {
System.Console.WriteLine("File based userconfig");
var subDir =
userConfigPath.GetChildDirectoryWithName(
userConfigPath.ParentDirectoryPath.DirectoryName.ToLower().Replace("@", ""));
subDir.MakeSurePathExists();
foreach (var f in files)
f.MoveTo(subDir.GetChildFileWithName(f.Name).ToString());
WriteUserConfigTar(userConfigPath, storePath);
userConfigPath.DirectoryInfo.Delete(true);
}
示例9: 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());
}
示例10: 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);
}
示例11: GetMod
public async Task GetMod(GroupContent mod, IAbsoluteDirectoryPath destination, IAbsoluteDirectoryPath packPath,
StatusRepo status, IAuthProvider provider, bool force = false) {
var folder = destination.GetChildDirectoryWithName(mod.PackageName);
if (!folder.Exists) {
await InstallNew(mod, provider, GetOpts(packPath, status, mod), folder).ConfigureAwait(false);
return;
}
var rsyncDir = folder.GetChildDirectoryWithName(Repository.RepoFolderName);
if (!force && rsyncDir.Exists && IsRightVersion(rsyncDir, mod))
return;
await UpdateExisting(mod, provider, rsyncDir, folder, GetOpts(packPath, status, mod)).ConfigureAwait(false);
}
示例12: HandleUserConfigPath
void HandleUserConfigPath(IAbsoluteDirectoryPath dir, IAbsoluteDirectoryPath userConfigPath) {
var files = userConfigPath.DirectoryInfo.EnumerateFiles();
var directories = userConfigPath.DirectoryInfo.EnumerateDirectories();
var hasFiles = files.Any();
var hasDirectories = directories.Any();
if (hasFiles && hasDirectories) {
throw new NotSupportedException(
"The userconfig folder contains both files and folders, unable to detect what type it is");
}
var storePath = dir.GetChildDirectoryWithName("store");
if (hasFiles)
HandleUserconfigFiles(userConfigPath, storePath, files);
else
HandleUserconfigDirectories(userConfigPath, storePath, directories);
}
示例13: GetMod
// TODO: localOnly if no update available? - so for local diagnose etc..
public async Task GetMod(string name, IAbsoluteDirectoryPath destination, IAbsoluteDirectoryPath packPath,
StatusRepo status, bool force = false) {
var mod = GetMod(name);
var folder = destination.GetChildDirectoryWithName(mod.Key);
var config = GetOpts(packPath, status, mod);
if (!folder.Exists) {
var opts = new SyncOptions();
config(opts);
await
Repository.Factory.Clone(opts.Hosts, folder.ToString(), config)
.ConfigureAwait(false);
return;
}
var rsyncDir = folder.GetChildDirectoryWithName(Repository.RepoFolderName);
if (!force && rsyncDir.Exists && IsRightVersion(rsyncDir, mod))
return;
var repo = GetRepo(rsyncDir, folder, config);
await repo.Update(config).ConfigureAwait(false);
}
示例14: Init
internal Repository Init(IAbsoluteDirectoryPath folder, IReadOnlyCollection<Uri> hosts, SyncOptions opts) {
var rsyncFolder = folder.GetChildDirectoryWithName(Repository.RepoFolderName);
if (rsyncFolder.Exists)
throw new Exception("Already appears to be a repository");
var packFolder = GetPackFolder(opts, rsyncFolder);
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.ToList() };
config.PackPath = opts.PackPath?.ToString();
if (opts.Include != null)
config.Include = opts.Include;
if (opts.Exclude != null)
config.Include = opts.Exclude;
var guid = opts.RequiredGuid ?? Guid.NewGuid().ToString();
var packVersion = new RepoVersion { Guid = guid };
if (opts.ArchiveFormat != null)
packVersion.ArchiveFormat = (string)opts.ArchiveFormat;
var wdVersion = SyncEvilGlobal.Yaml.NewFromYaml<RepoVersion>(packVersion.ToYaml());
SyncEvilGlobal.Yaml.ToYamlFile(config, configFile);
SyncEvilGlobal.Yaml.ToYamlFile(packVersion, packVersionFile);
SyncEvilGlobal.Yaml.ToYamlFile(wdVersion, wdVersionFile);
return TryGetRepository(folder, opts, rsyncFolder);
}
示例15: ProcessPbo
void ProcessPbo(string pboFile, IAbsoluteDirectoryPath tempPath, IAbsoluteDirectoryPath destination) {
var d = tempPath.GetChildDirectoryWithName(Path.GetFileNameWithoutExtension(pboFile));
using (new TmpDirectory(d)) {
_pboTools.RunExtractPboWithParameters(pboFile.ToAbsoluteFilePath(), tempPath,
"RYDPK");
MakePbo(d, destination);
}
}