本文整理汇总了C#中System.Result.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# Result.AddRange方法的具体用法?C# Result.AddRange怎么用?C# Result.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Result
的用法示例。
在下文中一共展示了Result.AddRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstallUninstall
/// <summary>
/// Install/uninstall MSI
/// </summary>
/// <returns></returns>
public Result InstallUninstall(InstanceOptions options)
{
ConsoleOutput.WriteLine("Running 'Remote:{0}', '{1}'", _installerConfig.Name, _installerConfig.DestinationPath);
// remote logfiles
string install_logfile = string.Empty;
string uninstall_logfile = string.Empty;
// the remote install result
Result result = new Result(
_installerConfig.Name,
_installerConfig.SvnRevision);
if (!Directory.Exists(LogPath))
{
ConsoleOutput.WriteLine("Creating directory '{0}'", LogPath);
Directory.CreateDirectory(LogPath);
}
ConsoleOutput.WriteLine("Saving logs in '{0}'", LogPath);
SequenceDrivers additionalSequences = new SequenceDrivers();
ExecuteDriver executeDriver = new ExecuteDriver(this);
executeDriver.Add(_config.Tasks);
executeDriver.Add(_config.VirtualMachines.Tasks);
executeDriver.Add(_vmConfig.Tasks);
executeDriver.Add(_vmConfig.Snapshots.Tasks);
executeDriver.Add(_snapshotConfig.Tasks);
executeDriver.Add(_config.Installers.Tasks);
executeDriver.Add(_installerConfig.Tasks);
additionalSequences.Add(executeDriver);
CopyFilesDriver copyFilesDriver = new CopyFilesDriver(this);
copyFilesDriver.Add(_config.CopyFiles);
copyFilesDriver.Add(_config.VirtualMachines.CopyFiles);
copyFilesDriver.Add(_vmConfig.CopyFiles);
copyFilesDriver.Add(_vmConfig.Snapshots.CopyFiles);
copyFilesDriver.Add(_snapshotConfig.CopyFiles);
copyFilesDriver.Add(_config.Installers.CopyFiles);
copyFilesDriver.Add(_installerConfig.CopyFiles);
additionalSequences.Add(copyFilesDriver);
// execute and copy files before all
result.AddRange(additionalSequences.ExecuteSequence(
SequenceWhen.beforeall));
DateTime start = DateTime.UtcNow;
try
{
// execute the installers
try
{
VirtualMachineDeployment deploy = null;
if (!_simulationOnly)
{
deploy = _installerConfig.CreateDeployment(_vm);
}
// install
if (options.Install)
{
// execute and copy files before install
result.AddRange(additionalSequences.ExecuteSequence(
SequenceWhen.beforeinstall));
ConsoleOutput.WriteLine("Installing 'Remote:{0}', '{1}'",
_installerConfig.Name, _installerConfig.DestinationPath);
result.SuccessfulInstall = InstallResult.False;
if (!_simulationOnly)
{
deploy.Install(out install_logfile);
}
result.SuccessfulInstall = InstallResult.True;
result.AddRange(additionalSequences.ExecuteSequence(
SequenceWhen.aftersuccessfulinstall));
}
// uninstall
if (options.Uninstall)
{
// execute and copy files before uninstall
result.AddRange(additionalSequences.ExecuteSequence(
SequenceWhen.beforeuninstall));
DateTime startUnInstall = DateTime.UtcNow;
ConsoleOutput.WriteLine("Uninstalling 'Remote:{0}', '{1}'", _installerConfig.Name, _installerConfig.DestinationPath);
result.SuccessfulUnInstall = InstallResult.False;
if (!_simulationOnly)
{
//.........这里部分代码省略.........