本文整理汇总了C#中IAbsoluteFilePath类的典型用法代码示例。如果您正苦于以下问题:C# IAbsoluteFilePath类的具体用法?C# IAbsoluteFilePath怎么用?C# IAbsoluteFilePath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAbsoluteFilePath类属于命名空间,在下文中一共展示了IAbsoluteFilePath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Gzip
public virtual string Gzip(IAbsoluteFilePath file, IAbsoluteFilePath dest = null,
bool preserveFileNameAndModificationTime = true, ITProgress status = null) {
Contract.Requires<ArgumentNullException>(file != null);
Contract.Requires<ArgumentException>(file.Exists);
var defDest = (file + ".gz").ToAbsoluteFilePath();
if (dest == null)
dest = defDest;
var cmd = $"-f --best --rsyncable --keep \"{file}\"";
if (!preserveFileNameAndModificationTime)
cmd = "-n " + cmd;
dest.RemoveReadonlyWhenExists();
var startInfo =
new ProcessStartInfoBuilder(Common.Paths.ToolPath.GetChildFileWithName("gzip.exe"), cmd) {
WorkingDirectory = file.ParentDirectoryPath
}.Build();
var srcSize = file.FileInfo.Length;
ProcessExitResultWithOutput ret;
var predictedSize = srcSize*DefaultPredictedCompressionRatio;
using (StatusProcessor.Conditional(defDest, status, (long) predictedSize))
ret = ProcessManager.LaunchAndGrabTool(startInfo, "Gzip pack");
if (Path.GetFullPath(dest.ToString()) != Path.GetFullPath(defDest.ToString()))
FileUtil.Ops.MoveWithRetry(defDest, dest);
return ret.StandardOutput + ret.StandardError;
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:30,代码来源:ToolsGzipTools.cs
示例2: 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;
}
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:7,代码来源:PackageFactory.cs
示例3: TryDownloadAsync
async Task TryDownloadAsync(TransferSpec spec, IWebClient webClient, IAbsoluteFilePath tmpFile) {
try {
tmpFile.RemoveReadonlyWhenExists();
if (!string.IsNullOrWhiteSpace(spec.Uri.UserInfo))
webClient.SetAuthInfo(spec.Uri);
using (webClient.HandleCancellationToken(spec))
await webClient.DownloadFileTaskAsync(spec.Uri, tmpFile.ToString()).ConfigureAwait(false);
VerifyIfNeeded(spec, tmpFile);
_fileOps.Move(tmpFile, spec.LocalFile);
} catch (OperationCanceledException e) {
_fileOps.DeleteIfExists(tmpFile.ToString());
throw CreateTimeoutException(spec, e);
} catch (WebException ex) {
_fileOps.DeleteIfExists(tmpFile.ToString());
var cancelledEx = ex.InnerException as OperationCanceledException;
if (cancelledEx != null)
throw CreateTimeoutException(spec, cancelledEx);
if (ex.Status == WebExceptionStatus.RequestCanceled)
throw CreateTimeoutException(spec, ex);
var response = ex.Response as HttpWebResponse;
if (response == null)
throw GenerateDownloadException(spec, ex);
switch (response.StatusCode) {
case HttpStatusCode.NotFound:
throw new RequestFailedException("Received a 404: NotFound response", ex);
case HttpStatusCode.Forbidden:
throw new RequestFailedException("Received a 403: Forbidden response", ex);
case HttpStatusCode.Unauthorized:
throw new RequestFailedException("Received a 401: Unauthorized response", ex);
}
throw GenerateDownloadException(spec, ex);
}
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:35,代码来源:HttpDownloadProtocol.cs
示例4: UnpackFile
public virtual void UnpackFile(IAbsoluteFilePath srcFile, IAbsoluteFilePath dstFile, IStatus status = null) {
var dstPath = dstFile.ParentDirectoryPath;
dstPath.MakeSurePathExists();
dstFile.RemoveReadonlyWhenExists();
Tools.Compression.Unpack(srcFile, dstPath, true, progress: status);
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:RepositoryTools.cs
示例5: GetUpdateExe
public static IAbsoluteFilePath GetUpdateExe(IAbsoluteFilePath location) {
var parent = location.ParentDirectoryPath;
var updateExe = parent.HasParentDirectory
? parent.ParentDirectoryPath.GetChildFileWithName("Update.exe")
: null;
return updateExe;
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:StartWithWindowsHandler.cs
示例6: TryResolve
public VariablePathResolvingStatus TryResolve(IEnumerable<KeyValuePair<string, string>> variables, out IAbsoluteFilePath 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.IsValidAbsoluteFilePath())
{
resolvedPath = null;
return VariablePathResolvingStatus.CannotConvertToAbsolutePath;
}
resolvedPath = path.ToAbsoluteFilePath();
return VariablePathResolvingStatus.Success;
}
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:25,代码来源:PathHelpers.VariableFilePath.cs
示例7: SafeSave
public static void SafeSave(Action<IAbsoluteFilePath> saveCode, IAbsoluteFilePath filePath) {
var newFileName = (filePath + GenericTools.TmpExtension).ToAbsoluteFilePath();
saveCode(newFileName);
FileUtil.Ops.Copy(newFileName, filePath);
FileUtil.Ops.DeleteFile(newFileName);
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:ToolsFileSafeIO.cs
示例8: ProcessDll
void ProcessDll(IAbsoluteFilePath dll, bool force = true) {
var fileName = dll.FileName.ToLower();
var ts332Path = _localMachineInfo.TS3_32_Path;
var ts364Path = _localMachineInfo.TS3_64_Path;
switch (fileName) {
case "task_force_radio_win32.dll": {
InstallTaskForceRadio(dll, ts332Path, force);
break;
}
case "task_force_radio_win64.dll": {
InstallTaskForceRadio(dll, ts364Path, force);
break;
}
case "dsound.dll": {
var path = _game.InstalledState.Directory;
if (path != null)
InstallDll(dll, path, null, force);
break;
}
default: {
if (ts332Dlls.Contains(fileName))
InstallTs3Plugin(dll, ts332Path, force);
else if (ts364Dlls.Contains(fileName))
InstallTs3Plugin(dll, ts364Path, force);
break;
}
}
}
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:28,代码来源:ModDllInstaller.cs
示例9: CreateDesktopPwsIconCustomRepo
public static Task CreateDesktopPwsIconCustomRepo(string name, string description, Uri target,
IAbsoluteFilePath icon = null) => CreateShortcutAsync(new ShortcutInfo(GetDesktop(), name,
Common.Paths.EntryLocation) {
Arguments = target.ToString(),
Description = description,
Icon = icon
});
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:ShortcutCreator.cs
示例10: MultiMirrorFileDownloadSpec
public MultiMirrorFileDownloadSpec(string remoteFile, IAbsoluteFilePath localFile) {
Contract.Requires<ArgumentNullException>(remoteFile != null);
Contract.Requires<ArgumentNullException>(localFile != null);
Contract.Requires<ArgumentException>(!remoteFile.Contains(@"\"));
RemoteFile = remoteFile;
LocalFile = localFile;
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:MultiMirrorFileDownloadSpec.cs
示例11: CreateDesktopGameBat
public static Task CreateDesktopGameBat(string name, string description, string arguments, Game game,
IAbsoluteFilePath icon = null) {
return
Tools.FileUtil.CreateBatFile(GetDesktop(), name,
GenerateBatContent(game.InstalledState.LaunchExecutable, game.InstalledState.Directory, arguments));
// TODO: DEscription etc? Maybe just create a nice shortcut to this thing incl icon?
}
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:7,代码来源:ShortcutCreator.cs
示例12: GenerateCommandLineExecution
public static IEnumerable<string> GenerateCommandLineExecution(IAbsoluteFilePath location, string executable,
params string[] desiredParams) {
var updateExe = GetUpdateExe(location);
return (updateExe != null) && updateExe.Exists
? new[] {updateExe.ToString()}.Concat(Restarter.BuildUpdateExeArguments(executable, desiredParams))
: new[] {location.ToString()}.Concat(desiredParams);
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:StartWithWindowsHandler.cs
示例13: CreateDesktopPwsIcon
public static Task CreateDesktopPwsIcon(string name, string description, string arguments,
IAbsoluteFilePath icon = null) => CreateShortcutAsync(new ShortcutInfo(GetDesktop(), name,
Common.Paths.EntryLocation) {
Arguments = arguments,
Icon = icon,
Description = description
});
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:ShortcutCreator.cs
示例14: Gzip
public virtual string Gzip(IAbsoluteFilePath file, IAbsoluteFilePath dest = null,
bool preserveFileNameAndModificationTime = false) {
Contract.Requires<ArgumentNullException>(file != null);
Contract.Requires<ArgumentException>(file.Exists);
var defDest = (file + ".gz").ToAbsoluteFilePath();
if (dest == null)
dest = defDest;
var cmd = String.Format("-f --best --rsyncable --keep \"{0}\"", file);
if (!preserveFileNameAndModificationTime)
cmd = "-n " + cmd;
dest.RemoveReadonlyWhenExists();
var startInfo =
new ProcessStartInfoBuilder(Common.Paths.ToolPath.GetChildFileWithName("gzip.exe"), cmd) {
WorkingDirectory = file.ParentDirectoryPath.ToString()
}.Build();
var ret = ProcessManager.LaunchAndGrabTool(startInfo, "Gzip pack");
if (Path.GetFullPath(dest.ToString()) != Path.GetFullPath(defDest.ToString()))
FileUtil.Ops.MoveWithRetry(defDest, dest);
return ret.StandardOutput + ret.StandardError;
}
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:26,代码来源:GzipTools.cs
示例15: 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
示例16: YomaConfig
public YomaConfig(IAbsoluteFilePath inputAddonsFile, IAbsoluteFilePath inputModsFile,
IAbsoluteFilePath inputServerFile = null)
: this(
XDocument.Load(inputAddonsFile.ToString()), XDocument.Load(inputModsFile.ToString()),
inputServerFile == null ? null : XDocument.Load(inputServerFile.ToString())) {
Contract.Requires<ArgumentOutOfRangeException>(inputAddonsFile != null);
Contract.Requires<ArgumentOutOfRangeException>(inputModsFile != null);
}
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:8,代码来源:YomaConfig.cs
示例17: TransferSpec
protected TransferSpec(Uri uri, IAbsoluteFilePath localFile, ITransferProgress progress) {
Contract.Requires<ArgumentNullException>(uri != null);
Contract.Requires<ArgumentNullException>(localFile != null);
Uri = uri;
LocalFile = localFile;
Progress = progress ?? new TransferProgress();
}
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:8,代码来源:TransferSpec.cs
示例18: GenerateBatContent
static string GenerateBatContent(IAbsoluteFilePath target, IAbsoluteDirectoryPath workDir, string pars)
=> String.Format(@"
@echo off
echo Starting: {0}
echo From: {1}
echo With params: {2}
cd /D ""{1}""
""{0}"" {2}", target, workDir, pars);
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:8,代码来源:ShortcutCreator.cs
示例19: CreateDesktopGameIcon
public static Task CreateDesktopGameIcon(string name, string description, string arguments, Game game,
IAbsoluteFilePath icon = null) => CreateShortcutAsync(new ShortcutInfo(GetDesktop(), name,
game.InstalledState.LaunchExecutable) {
WorkingDirectory = game.InstalledState.Directory,
Arguments = arguments,
Description = description,
Icon = icon
});
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:8,代码来源:ShortcutCreator.cs
示例20: HandleKeyParams
public HandleKeyParams(IAbsoluteDirectoryPath keyPath, string prefix, bool copyKey,
IAbsoluteDirectoryPath directory, IAbsoluteFilePath key) {
KeyPath = keyPath;
Prefix = prefix;
CopyKey = copyKey;
Directory = directory;
Key = key;
}
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:8,代码来源:BiSigner.cs
注:本文中的IAbsoluteFilePath类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论