OSDN Git Service

na-get-lib,all-getについてアップデート処理を新方式(NaGetUpdate2)に変更。
[applistation/AppliStation.git] / na-get-lib / NaGet.SubCommands.SubTask / FunctionalSubTask.cs
1 using System;
2 using System.Diagnostics;
3 using NaGet.Tasks;
4
5 namespace NaGet.SubCommands.SubTask
6 {
7         /// <summary>
8         /// 関数をサブタスク化
9         /// </summary>
10         public class FunctionalSubTask : NaGetSubTask
11         {
12                 private Action<object> func = null;
13                 
14                 private object arg = null;
15                 
16                 /// <summary>
17                 /// コンストラクタ
18                 /// </summary>
19                 /// <param name="func">関数</param>
20                 /// <param name="arg">関数への引数</param>
21                 public FunctionalSubTask(Action<object> func, object arg)
22                 {
23                         this.func = func;
24                         this.arg = arg;
25                 }
26                 
27                 public override void Run()
28                 {
29                         NotifyStarted();
30                         try {
31                                 func(arg);
32                         } finally {
33                                 NotifyCompleted();
34                         }
35                 }
36                 
37                 /// <summary>
38                 /// 進捗は提供しない。
39                 /// </summary>
40                 public override bool UseProgress {
41                         get { return false; }
42                 }
43         }
44 }