本文整理汇总了C#中IAbsoluteDirectoryPath类的典型用法代码示例。如果您正苦于以下问题:C# IAbsoluteDirectoryPath类的具体用法?C# IAbsoluteDirectoryPath怎么用?C# IAbsoluteDirectoryPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAbsoluteDirectoryPath类属于命名空间,在下文中一共展示了IAbsoluteDirectoryPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static async Task<PackageManager> Create(Repository repo, IAbsoluteDirectoryPath workDir,
bool createWhenNotExisting = false,
string remote = null) {
var pm = new PackageManager(repo, workDir, createWhenNotExisting, remote);
await repo.RefreshRemotes().ConfigureAwait(false);
return pm;
}
示例2: ExistingMods
static IEnumerable<IAbsoluteDirectoryPath> ExistingMods(IAbsoluteDirectoryPath[] paths, params string[] mods) {
return paths.Any()
? mods.Select(
x => paths.Select(path => path.GetChildDirectoryWithName(x)).FirstOrDefault(p => p.Exists))
.Where(x => x != null)
: Enumerable.Empty<IAbsoluteDirectoryPath>();
}
示例3: GetNetEntryFilePath
private static IAbsoluteFilePath GetNetEntryFilePath(IAbsoluteDirectoryPath netEntryPath, string asName) {
var en = netEntryPath ?? AppContext.BaseDirectory.ToAbsoluteDirectoryPath();
var dll = en.GetChildFileWithName(asName + ".dll");
var netEntryFilePath = dll.Exists ? dll : en.GetChildFileWithName(asName + ".exe");
//_entryAssembly.Location.ToAbsoluteFilePath();
return netEntryFilePath;
}
示例4: 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();
}
}
}
}
}
示例5: ContentPaths
public ContentPaths(IAbsoluteDirectoryPath path, IAbsoluteDirectoryPath repositoryPath) {
Contract.Requires<ArgumentNullException>(path != null);
Contract.Requires<ArgumentNullException>(repositoryPath != null);
Path = path;
RepositoryPath = repositoryPath;
}
示例6: Import
public Package Import(Repository repo, IAbsoluteDirectoryPath workDir, IAbsoluteFilePath packageFilePath) {
var metaData = Package.Load(packageFilePath);
var package = new Package(workDir, metaData, repo);
package.Commit(metaData.GetVersionInfo());
return package;
}
示例7: UpgradeOrInstall
const int WM_USER = 0x0400; //http://msdn.microsoft.com/en-us/library/windows/desktop/ms644931(v=vs.85).aspx
public async Task UpgradeOrInstall(IAbsoluteDirectoryPath destination, Settings settings,
params IAbsoluteFilePath[] files) {
var theShell = GetTheShell(destination, files);
if (theShell.Exists)
await Uninstall(destination, settings, files).ConfigureAwait(false);
await Install(destination, settings, files).ConfigureAwait(false);
}
示例8: Create
public static async Task<BundleManager> Create(Repository repo, IAbsoluteDirectoryPath workDir,
bool createWhenNotExisting = false,
string remote = null) {
var packageManager =
await PackageManager.Create(repo, workDir, createWhenNotExisting, remote).ConfigureAwait(false);
return new BundleManager(packageManager);
}
示例9: Enumerate
public IEnumerable<string> Enumerate(IAbsoluteDirectoryPath path) {
Contract.Requires<ArgumentNullException>(path != null);
return Tools.FileUtil.GetFiles(path, "*.bisign")
.Select(GetSignatureFromFileName).Where(x => !string.IsNullOrWhiteSpace(x))
.Select(x => x.ToLower())
.Distinct();
}
示例10: 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;
}
示例11: ContentEngineContent
public ContentEngineContent(Guid networkId, Guid id, bool isInstalled, IAbsoluteDirectoryPath path, Guid gameId) {
NetworkId = networkId;
Id = id;
IsInstalled = isInstalled;
PathInternal = path;
GameId = gameId;
}
示例12: TryResolve
public VariablePathResolvingStatus TryResolve(IEnumerable<KeyValuePair<string, string>> variables,
out IAbsoluteDirectoryPath resolvedPath, out IReadOnlyList<string> unresolvedVariables)
{
Argument.IsNotNull(nameof(variables), variables);
string path;
if (!TryResolve(variables, out path, out unresolvedVariables))
{
resolvedPath = null;
return VariablePathResolvingStatus.UnresolvedVariable;
}
if (!path.IsValidAbsoluteDirectoryPath())
{
resolvedPath = null;
return VariablePathResolvingStatus.CannotConvertToAbsolutePath;
}
resolvedPath = path.ToAbsoluteDirectoryPath();
return VariablePathResolvingStatus.Success;
}
示例13: 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;
}
示例14: 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;
}
示例15: 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);
}