本文整理汇总了C#中IFileSystem.get_current_assembly_path方法的典型用法代码示例。如果您正苦于以下问题:C# IFileSystem.get_current_assembly_path方法的具体用法?C# IFileSystem.get_current_assembly_path怎么用?C# IFileSystem.get_current_assembly_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFileSystem
的用法示例。
在下文中一共展示了IFileSystem.get_current_assembly_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: execute
public static int execute(
string command,
IFileSystem fileSystem,
int waitForExitSeconds,
Action<object, DataReceivedEventArgs> stdOutAction,
Action<object, DataReceivedEventArgs> stdErrAction
)
{
if (string.IsNullOrWhiteSpace(_powershell)) _powershell = get_powershell_location(fileSystem);
//-NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%DIR%chocolatey.ps1' %PS_ARGS%"
string arguments = "-NoProfile -NoLogo -ExecutionPolicy Bypass -Command \"{0}\"".format_with(command);
return CommandExecutor.execute_static(
_powershell,
arguments,
waitForExitSeconds,
workingDirectory: fileSystem.get_directory_name(fileSystem.get_current_assembly_path()),
stdOutAction: stdOutAction,
stdErrAction: stdErrAction,
updateProcessPath: true
);
}
示例2: remove_old_chocolatey_exe
private static void remove_old_chocolatey_exe(IFileSystem fileSystem)
{
try
{
fileSystem.delete_file(fileSystem.get_current_assembly_path() + ".old");
fileSystem.delete_file(fileSystem.combine_paths(AppDomain.CurrentDomain.BaseDirectory, "choco.exe.old"));
}
catch (Exception ex)
{
"chocolatey".Log().Warn("Attempting to delete choco.exe.old ran into an issue:{0} {1}".format_with(Environment.NewLine, ex.Message));
}
}