using System;
using System.Diagnostics;
using NaGet.Tasks;
namespace NaGet.SubCommands.SubTask
{
///
/// 関数をサブタスク化
///
public class FunctionalSubTask : NaGetSubTask
{
private Action func = null;
private T arg = default(T);
///
/// コンストラクタ
///
/// 関数
/// 関数への引数
public FunctionalSubTask(Action func, T arg)
{
this.func = func;
this.arg = arg;
}
public override void Run()
{
NotifyStarted();
try {
func(arg);
} finally {
NotifyCompleted();
}
}
///
/// 進捗は提供しない。
///
public override bool UseProgress {
get { return false; }
}
}
}