OSDN Git Service

AppliStation-all,NaGetTaskクラスをTaskクラスに改名他
authorttp <ttp@users.sourceforge.jp>
Sun, 27 Mar 2011 10:04:01 +0000 (19:04 +0900)
committerttp <ttp@users.sourceforge.jp>
Sun, 27 Mar 2011 10:04:01 +0000 (19:04 +0900)
12 files changed:
AppliStation/AppliStation.Util/ExecutionProgressViewer.cs
all-get/Main.cs
na-get-lib/NaGet.Net/Downloader.cs
na-get-lib/NaGet.SubCommands/NaGetDownloadToCache.cs
na-get-lib/NaGet.SubCommands/NaGetInstall.cs
na-get-lib/NaGet.SubCommands/NaGetTask.cs [deleted file]
na-get-lib/NaGet.SubCommands/NaGetTaskSet.cs
na-get-lib/NaGet.SubCommands/NaGetUpdate.cs
na-get-lib/NaGet.Tasks/Task.cs [new file with mode: 0644]
na-get-lib/NaGet.Tasks/TaskCanceledException.cs [new file with mode: 0644]
na-get-lib/NaGet.Tasks/TaskEventArgs.cs [new file with mode: 0644]
na-get-lib/na-get-lib.csproj

index a9f5f78..c192294 100644 (file)
@@ -75,8 +75,8 @@ namespace AppliStation.Util
                        }\r
                        \r
                        // ダウンロードの進捗を表示\r
                        }\r
                        \r
                        // ダウンロードの進捗を表示\r
-                       if (a.TaskProgressPercent >= 0) {\r
-                               progressBarSub.Value = (int) a.TaskProgressPercent;\r
+                       if (a.ProgressPercent >= 0) {\r
+                               progressBarSub.Value = (int) a.ProgressPercent;\r
                                progressBarSub.Style = ProgressBarStyle.Continuous;\r
                        } else {\r
                                progressBarSub.Style = ProgressBarStyle.Marquee;\r
                                progressBarSub.Style = ProgressBarStyle.Continuous;\r
                        } else {\r
                                progressBarSub.Style = ProgressBarStyle.Marquee;\r
@@ -113,7 +113,7 @@ namespace AppliStation.Util
                                        \r
                                        progressState = NativeMethods.ProgressBarState.Normal;\r
                                        \r
                                        \r
                                        progressState = NativeMethods.ProgressBarState.Normal;\r
                                        \r
-                                       logBox.AppendText(string.Format(" ... 完了. [{0}%]", (int) e.TaskProgressPercent));\r
+                                       logBox.AppendText(string.Format(" ... 完了. [{0}%]", (int) e.ProgressPercent));\r
                                        logBox.AppendText(System.Environment.NewLine);\r
                                        break;\r
                                case NaGetTaskSetEventType.INFO:\r
                                        logBox.AppendText(System.Environment.NewLine);\r
                                        break;\r
                                case NaGetTaskSetEventType.INFO:\r
@@ -153,8 +153,8 @@ namespace AppliStation.Util
                        }\r
                        \r
                        // タスクセット全体の進捗をプログレスバーに表示する\r
                        }\r
                        \r
                        // タスクセット全体の進捗をプログレスバーに表示する\r
-                       if (e.TaskProgressPercent >= 0) {\r
-                               progressBar.Value = (int) e.TaskProgressPercent;\r
+                       if (e.ProgressPercent >= 0) {\r
+                               progressBar.Value = (int) e.ProgressPercent;\r
                                progressBar.Style = ProgressBarStyle.Continuous;\r
                        } else {\r
                                progressBar.Style = ProgressBarStyle.Marquee;\r
                                progressBar.Style = ProgressBarStyle.Continuous;\r
                        } else {\r
                                progressBar.Style = ProgressBarStyle.Marquee;\r
@@ -162,8 +162,8 @@ namespace AppliStation.Util
                        NativeMethods.ProgressBar_SetState(progressBar, progressState);\r
                        NativeMethods.ProgressBar_SetState(progressBarSub, progressState);\r
                        // タスクセット全体の進捗をタスクバーに表示する(Windows 7以降のみ)\r
                        NativeMethods.ProgressBar_SetState(progressBar, progressState);\r
                        NativeMethods.ProgressBar_SetState(progressBarSub, progressState);\r
                        // タスクセット全体の進捗をタスクバーに表示する(Windows 7以降のみ)\r
-                       if (e.TaskProgressPercent >= 0 && e.TaskProgressPercent < 100) {\r
-                               NativeMethods.Form_SetTaskbarProgressParams(this, progressBar.Style, progressState, (ulong) e.TaskProgressPercent, 100);\r
+                       if (e.ProgressPercent >= 0 && e.ProgressPercent < 100) {\r
+                               NativeMethods.Form_SetTaskbarProgressParams(this, progressBar.Style, progressState, (ulong) e.ProgressPercent, 100);\r
                        } else {\r
                                NativeMethods.Form_SetTaskbarProgressParams(this, progressBar.Style, progressState, 0, 0);\r
                        }\r
                        } else {\r
                                NativeMethods.Form_SetTaskbarProgressParams(this, progressBar.Style, progressState, 0, 0);\r
                        }\r
index 0849124..2792fb3 100644 (file)
@@ -107,7 +107,7 @@ namespace AllGet
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
-                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.TaskProgressPercent);\r
+                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.ProgressPercent);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
@@ -250,7 +250,7 @@ namespace AllGet
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
-                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.TaskProgressPercent);\r
+                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.ProgressPercent);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
@@ -350,7 +350,7 @@ namespace AllGet
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
-                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.TaskProgressPercent);\r
+                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.ProgressPercent);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
@@ -407,7 +407,7 @@ namespace AllGet
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
                                                Console.Write("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.COMPLETED_TASKSET:\r
-                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.TaskProgressPercent);\r
+                                               Console.WriteLine(" ... Done. [{0}%]", (int) e.ProgressPercent);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
                                                break;\r
                                        case NaGetTaskSetEventType.INFO:\r
                                                Console.WriteLine("  " + e.TaskMessage);\r
index e54bfe8..b7d7079 100644 (file)
@@ -3,7 +3,7 @@ using System.Net;
 using System.Net.Mime;\r
 using System.IO;\r
 using System.Threading;\r
 using System.Net.Mime;\r
 using System.IO;\r
 using System.Threading;\r
-using NaGet.SubCommands;\r
+using NaGet.Tasks;\r
 \r
 namespace NaGet.Net\r
 {\r
 \r
 namespace NaGet.Net\r
 {\r
@@ -11,7 +11,7 @@ namespace NaGet.Net
 /// <summary>\r
 /// ダウンロードイベントオブジェクト\r
 /// </summary>\r
 /// <summary>\r
 /// ダウンロードイベントオブジェクト\r
 /// </summary>\r
-public class DownloadEventArgs : NaGetEventArgs\r
+public class DownloadEventArgs : TaskEventArgs\r
 {\r
        /// <summary>\r
        /// イベントの種類\r
 {\r
        /// <summary>\r
        /// イベントの種類\r
@@ -42,7 +42,7 @@ public class DownloadEventArgs : NaGetEventArgs
                MaxSize = max;\r
                \r
                TaskMessage = msg;\r
                MaxSize = max;\r
                \r
                TaskMessage = msg;\r
-               TaskProgressPercent = (max > 0)? (100.0f * pos / max) : -1;\r
+               ProgressPercent = (max > 0)? (100.0f * pos / max) : -1;\r
        }\r
 }\r
 \r
        }\r
 }\r
 \r
@@ -61,7 +61,7 @@ public enum DownloadEventType {
 /// <summary>\r
 /// ダウンロード処理を行うクラス\r
 /// </summary>\r
 /// <summary>\r
 /// ダウンロード処理を行うクラス\r
 /// </summary>\r
-public class Downloader : NaGetTask\r
+public class Downloader : Task\r
 {\r
        public IWebProxy proxy;\r
        \r
 {\r
        public IWebProxy proxy;\r
        \r
@@ -172,21 +172,21 @@ public class Downloader : NaGetTask
                        }\r
                        \r
                        if (cancelCalled) {\r
                        }\r
                        \r
                        if (cancelCalled) {\r
-                               throw new NaGetTaskCanceledException(string.Empty);\r
+                               throw new TaskCanceledException(string.Empty);\r
                        }\r
                        \r
                        try {\r
                                response = request.GetResponse();\r
                        } catch (WebException e) {\r
                                if (cancelCalled) { // キャンセル時\r
                        }\r
                        \r
                        try {\r
                                response = request.GetResponse();\r
                        } catch (WebException e) {\r
                                if (cancelCalled) { // キャンセル時\r
-                                       throw new NaGetTaskCanceledException(string.Empty, e);\r
+                                       throw new TaskCanceledException(string.Empty, e);\r
                                } else {\r
                                        throw new WebException(e.Message, e);\r
                                }\r
                        }\r
                        \r
                        if (cancelCalled) {\r
                                } else {\r
                                        throw new WebException(e.Message, e);\r
                                }\r
                        }\r
                        \r
                        if (cancelCalled) {\r
-                               throw new NaGetTaskCanceledException(string.Empty);\r
+                               throw new TaskCanceledException(string.Empty);\r
                        }\r
                        \r
                        try {\r
                        }\r
                        \r
                        try {\r
@@ -228,7 +228,7 @@ public class Downloader : NaGetTask
                                                        fs.Write(data, 0, size);\r
                                                        \r
                                                        if (cancelCalled) {\r
                                                        fs.Write(data, 0, size);\r
                                                        \r
                                                        if (cancelCalled) {\r
-                                                               throw new NaGetTaskCanceledException(string.Empty);\r
+                                                               throw new TaskCanceledException(string.Empty);\r
                                                        }\r
                                                }\r
                                        } finally {\r
                                                        }\r
                                                }\r
                                        } finally {\r
@@ -240,7 +240,7 @@ public class Downloader : NaGetTask
                                        RaiseDownloadEvent(DownloadEventType.COMPLETED, fs.Position, contentLength);\r
                                } catch (IOException ex) {\r
                                        if (cancelCalled) {\r
                                        RaiseDownloadEvent(DownloadEventType.COMPLETED, fs.Position, contentLength);\r
                                } catch (IOException ex) {\r
                                        if (cancelCalled) {\r
-                                               throw new NaGetTaskCanceledException(string.Empty);\r
+                                               throw new TaskCanceledException(string.Empty);\r
                                        } else {\r
                                                RaiseDownloadEvent(DownloadEventType.ERROR, 0, 0);\r
                                                throw new IOException(ex.Message, ex);\r
                                        } else {\r
                                                RaiseDownloadEvent(DownloadEventType.ERROR, 0, 0);\r
                                                throw new IOException(ex.Message, ex);\r
@@ -286,8 +286,8 @@ public class Downloader : NaGetTask
                                case DownloadEventType.STARTED:\r
                                case DownloadEventType.DOWNLOADING:\r
                                case DownloadEventType.COMPLETED:\r
                                case DownloadEventType.STARTED:\r
                                case DownloadEventType.DOWNLOADING:\r
                                case DownloadEventType.COMPLETED:\r
-                                       if (e.TaskProgressPercent >= 0) {\r
-                                               e.TaskMessage = string.Format("{0} bytes ({1} %)", e.DownloadSize, (int) e.TaskProgressPercent);\r
+                                       if (e.ProgressPercent >= 0) {\r
+                                               e.TaskMessage = string.Format("{0} bytes ({1} %)", e.DownloadSize, (int) e.ProgressPercent);\r
                                        } else {\r
                                                e.TaskMessage = string.Format("{0} bytes", e.DownloadSize);\r
                                        }\r
                                        } else {\r
                                                e.TaskMessage = string.Format("{0} bytes", e.DownloadSize);\r
                                        }\r
@@ -295,7 +295,7 @@ public class Downloader : NaGetTask
                                        \r
                                        if (stopwatch != null && stopwatch.IsRunning && stopwatch.ElapsedMilliseconds > 3000) {\r
                                                long bpers = e.DownloadSize * 1000 / stopwatch.ElapsedMilliseconds;\r
                                        \r
                                        if (stopwatch != null && stopwatch.IsRunning && stopwatch.ElapsedMilliseconds > 3000) {\r
                                                long bpers = e.DownloadSize * 1000 / stopwatch.ElapsedMilliseconds;\r
-                                               if ((e.TaskProgressPercent >= 0) && (bpers > 0)) {\r
+                                               if ((e.ProgressPercent >= 0) && (bpers > 0)) {\r
                                                        TimeSpan rest = TimeSpan.FromSeconds((max - e.DownloadSize) / bpers);\r
                                                        e.TaskMessage += string.Format(" 推定残り時間:{0} ({1}/s)", rest, NaGet.Utils.FormatSize(bpers));\r
                                                } else {\r
                                                        TimeSpan rest = TimeSpan.FromSeconds((max - e.DownloadSize) / bpers);\r
                                                        e.TaskMessage += string.Format(" 推定残り時間:{0} ({1}/s)", rest, NaGet.Utils.FormatSize(bpers));\r
                                                } else {\r
index a4d4e28..20596d2 100644 (file)
@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using NaGet.Packages.Install;
 using NaGet.Packages;
 using NaGet.Net;
 using NaGet.Packages.Install;
 using NaGet.Packages;
 using NaGet.Net;
+using NaGet.Tasks;
 
 namespace NaGet.SubCommands
 {
 
 namespace NaGet.SubCommands
 {
@@ -22,8 +23,8 @@ namespace NaGet.SubCommands
                                if (downloader == null) {
                                        downloader = new Downloader();
                                        downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {
                                if (downloader == null) {
                                        downloader = new Downloader();
                                        downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {
-                                               if (e.Type == DownloadEventType.DOWNLOADING && e.TaskProgressPercent > 0) {
-                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.PING, string.Empty, GetProgressPercent(NaGetTaskSetEventType.PING, e.TaskProgressPercent));
+                                               if (e.Type == DownloadEventType.DOWNLOADING && e.ProgressPercent > 0) {
+                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.PING, string.Empty, GetProgressPercent(NaGetTaskSetEventType.PING, e.ProgressPercent));
                                                }
                                        };
                                }
                                                }
                                        };
                                }
@@ -164,7 +165,7 @@ namespace NaGet.SubCommands
                                        if (! inst.Downloaded) {
                                                try {
                                                        inst.Download(Downloader);
                                        if (! inst.Downloaded) {
                                                try {
                                                        inst.Download(Downloader);
-                                               } catch (NaGetTaskCanceledException) {
+                                               } catch (TaskCanceledException) {
                                                        RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "インストーラーのダウンロード処理がキャンセルされました");
                                                        done = true;
                                                        return;
                                                        RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "インストーラーのダウンロード処理がキャンセルされました");
                                                        done = true;
                                                        return;
index 9c6ffdf..83285c0 100644 (file)
@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using NaGet.Packages.Install;\r
 using NaGet.Packages;\r
 using NaGet.Net;\r
 using NaGet.Packages.Install;\r
 using NaGet.Packages;\r
 using NaGet.Net;\r
+using NaGet.Tasks;\r
 \r
 namespace NaGet.SubCommands\r
 {\r
 \r
 namespace NaGet.SubCommands\r
 {\r
@@ -22,8 +23,8 @@ namespace NaGet.SubCommands
                                if (downloader == null) {\r
                                        downloader = new Downloader();\r
                                        downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {\r
                                if (downloader == null) {\r
                                        downloader = new Downloader();\r
                                        downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {\r
-                                               if (e.Type == DownloadEventType.DOWNLOADING && e.TaskProgressPercent > 0) {\r
-                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.PING, string.Empty, GetProgressPercent(NaGetTaskSetEventType.PING, e.TaskProgressPercent));\r
+                                               if (e.Type == DownloadEventType.DOWNLOADING && e.ProgressPercent > 0) {\r
+                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.PING, string.Empty, GetProgressPercent(NaGetTaskSetEventType.PING, e.ProgressPercent));\r
                                                }\r
                                        };\r
                                }\r
                                                }\r
                                        };\r
                                }\r
@@ -213,7 +214,7 @@ namespace NaGet.SubCommands
                                        if (! inst.Downloaded) {\r
                                                try {\r
                                                        inst.Download(Downloader);\r
                                        if (! inst.Downloaded) {\r
                                                try {\r
                                                        inst.Download(Downloader);\r
-                                               } catch (NaGetTaskCanceledException) {\r
+                                               } catch (TaskCanceledException) {\r
                                                        RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "インストーラーのダウンロード処理がキャンセルされました");\r
                                                        done = true;\r
                                                        return;\r
                                                        RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "インストーラーのダウンロード処理がキャンセルされました");\r
                                                        done = true;\r
                                                        return;\r
diff --git a/na-get-lib/NaGet.SubCommands/NaGetTask.cs b/na-get-lib/NaGet.SubCommands/NaGetTask.cs
deleted file mode 100644 (file)
index d17e94c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;\r
-\r
-namespace NaGet.SubCommands\r
-{\r
-       public class NaGetEventArgs : EventArgs\r
-       {\r
-               /// <summary>\r
-               /// \83^\83X\83N\82Ì\90i\92»\8fó\8bµ\82Ì\95S\95ª\97¦\95\\8e¦\r
-               /// </summary>\r
-               public float TaskProgressPercent = -1;\r
-               \r
-               /// <summary>\r
-               /// \83^\83X\83N\82Ì\8c»\8bµ\82Ì\83\81\83b\83Z\81[\83W\r
-               /// </summary>\r
-               public string TaskMessage;\r
-       }\r
-       \r
-       [Serializable()]\r
-       public class NaGetTaskCanceledException : Exception\r
-       {\r
-               public NaGetTaskCanceledException(string msg)\r
-                       : base(msg)\r
-               {\r
-               }\r
-               \r
-               public NaGetTaskCanceledException(string msg, Exception e)\r
-                       : base(msg, e)\r
-               {\r
-               }\r
-       }\r
-       \r
-       /// <summary>\r
-       /// NaGet\82Ì\83R\83}\83\93\83h\83^\83X\83N\82Ì\8dÅ\8f¬\92P\88Ê\82Ì\90e\83N\83\89\83X\r
-       /// </summary>\r
-       public abstract class NaGetTask\r
-       {\r
-               /// <summary>\r
-               /// \8eÀ\8ds\82·\82é\r
-               /// </summary>\r
-               public abstract void Run();\r
-               \r
-               /// <summary>\r
-               /// \8eÀ\8ds\8fó\91Ô\82©\94Û\82©\82ð\93¾\82é\r
-               /// </summary>\r
-               public abstract bool Running {\r
-                       get;\r
-               }\r
-               \r
-               /// <summary>\r
-               /// \8fI\97¹\82µ\82Ä\82¢\82é\82©\94Û\82©\81B\r
-               /// </summary>\r
-               public abstract bool Done {\r
-                       get;\r
-               }\r
-               \r
-               /// <summary>\r
-               /// \83L\83\83\83\93\83Z\83\8b\89Â\94\\82©\94Û\82©\82ð\95Ô\82·\r
-               /// </summary>\r
-               public virtual bool Cancelable {\r
-                       get { return false; }\r
-               }\r
-               \r
-               /// <summary>\r
-               /// \92\86\92f\82³\82¹\82é\r
-               /// </summary>\r
-               /// <returns>\90¬\8c÷\82µ\82½\82©\82¢\82È\82©</returns>\r
-               public virtual bool Cancel()\r
-               {\r
-                       return false;\r
-               }\r
-       }\r
-}\r
index df42cd3..41a8d7a 100644 (file)
@@ -1,10 +1,11 @@
 using System;\r
 using System;\r
+using NaGet.Tasks;\r
 \r
 namespace NaGet.SubCommands\r
 {\r
        #region EventHandler<NaGetTaskSetEventArgs>\8aÖ\98A\r
        \r
 \r
 namespace NaGet.SubCommands\r
 {\r
        #region EventHandler<NaGetTaskSetEventArgs>\8aÖ\98A\r
        \r
-       public class NaGetTaskSetEventArgs : NaGetEventArgs\r
+       public class NaGetTaskSetEventArgs : TaskEventArgs\r
        {\r
                public NaGetTaskSetEventType Type;\r
                \r
        {\r
                public NaGetTaskSetEventType Type;\r
                \r
@@ -12,7 +13,7 @@ namespace NaGet.SubCommands
                {\r
                        this.Type = type;\r
                        this.TaskMessage = message;\r
                {\r
                        this.Type = type;\r
                        this.TaskMessage = message;\r
-                       this.TaskProgressPercent = processPercent;\r
+                       this.ProgressPercent = processPercent;\r
                }\r
        }\r
        \r
                }\r
        }\r
        \r
@@ -114,7 +115,7 @@ namespace NaGet.SubCommands
        /// <summary>\r
        /// NaGet\83^\83X\83N\8f\88\97\9d\82Ì\83p\83b\83N\r
        /// </summary>\r
        /// <summary>\r
        /// NaGet\83^\83X\83N\8f\88\97\9d\82Ì\83p\83b\83N\r
        /// </summary>\r
-       public abstract class NaGetTaskSet : NaGetTask\r
+       public abstract class NaGetTaskSet : Task\r
        {\r
                /// <summary>\r
                /// \83^\83X\83N\8f\88\97\9d\82Ì\83C\83x\83\93\83g\83n\83\93\83h\83\89\r
        {\r
                /// <summary>\r
                /// \83^\83X\83N\8f\88\97\9d\82Ì\83C\83x\83\93\83g\83n\83\93\83h\83\89\r
index 6d2c8b6..2a0c5a8 100644 (file)
@@ -4,6 +4,7 @@ using NaGet.Packages;
 using NaGet.Packages.Install;\r
 using NaGet.Net;\r
 using NaGet.SubCommands;\r
 using NaGet.Packages.Install;\r
 using NaGet.Net;\r
 using NaGet.SubCommands;\r
+using NaGet.Tasks;\r
 \r
 namespace NaGet.SubCommands\r
 {\r
 \r
 namespace NaGet.SubCommands\r
 {\r
@@ -26,8 +27,8 @@ namespace NaGet.SubCommands
                                if (downloader == null) {\r
                                        downloader = new Downloader();\r
                                        downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {\r
                                if (downloader == null) {\r
                                        downloader = new Downloader();\r
                                        downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {\r
-                                               if (e.Type == DownloadEventType.DOWNLOADING && e.TaskProgressPercent > 0) {\r
-                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.PING, string.Empty, GetProgressPercent(NaGetTaskSetEventType.PING, e.TaskProgressPercent));\r
+                                               if (e.Type == DownloadEventType.DOWNLOADING && e.ProgressPercent > 0) {\r
+                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.PING, string.Empty, GetProgressPercent(NaGetTaskSetEventType.PING, e.ProgressPercent));\r
                                                }\r
                                        };\r
                                }\r
                                                }\r
                                        };\r
                                }\r
@@ -86,7 +87,7 @@ namespace NaGet.SubCommands
                                        packageListsDownloaded = false;\r
                                        try {\r
                                                runDownloadPackageLists();\r
                                        packageListsDownloaded = false;\r
                                        try {\r
                                                runDownloadPackageLists();\r
-                                       } catch (NaGetTaskCanceledException) {\r
+                                       } catch (TaskCanceledException) {\r
                                                RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "リストのダウンロード処理がキャンセルされました");\r
                                                pkgListMan.LoadPackageLists();\r
                                        } catch (System.Net.WebException e) {\r
                                                RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "リストのダウンロード処理がキャンセルされました");\r
                                                pkgListMan.LoadPackageLists();\r
                                        } catch (System.Net.WebException e) {\r
diff --git a/na-get-lib/NaGet.Tasks/Task.cs b/na-get-lib/NaGet.Tasks/Task.cs
new file mode 100644 (file)
index 0000000..dd24112
--- /dev/null
@@ -0,0 +1,45 @@
+using System;\r
+\r
+namespace NaGet.Tasks\r
+{\r
+       /// <summary>\r
+       /// NaGet\82Ì\83R\83}\83\93\83h\83^\83X\83N\82Ì\92\8a\8fÛ\83N\83\89\83X\r
+       /// </summary>\r
+       public abstract class Task\r
+       {\r
+               /// <summary>\r
+               /// \8eÀ\8ds\82·\82é\r
+               /// </summary>\r
+               public abstract void Run();\r
+               \r
+               /// <summary>\r
+               /// \8eÀ\8ds\8fó\91Ô\82©\94Û\82©\82ð\93¾\82é\r
+               /// </summary>\r
+               public abstract bool Running {\r
+                       get;\r
+               }\r
+               \r
+               /// <summary>\r
+               /// \8fI\97¹\82µ\82Ä\82¢\82é\82©\94Û\82©\81B\r
+               /// </summary>\r
+               public abstract bool Done {\r
+                       get;\r
+               }\r
+               \r
+               /// <summary>\r
+               /// \83L\83\83\83\93\83Z\83\8b\89Â\94\\82©\94Û\82©\82ð\95Ô\82·\r
+               /// </summary>\r
+               public virtual bool Cancelable {\r
+                       get { return false; }\r
+               }\r
+               \r
+               /// <summary>\r
+               /// \92\86\92f\82³\82¹\82é\r
+               /// </summary>\r
+               /// <returns>\90¬\8c÷\82µ\82½\82©\82¢\82È\82©</returns>\r
+               public virtual bool Cancel()\r
+               {\r
+                       return false;\r
+               }\r
+       }\r
+}\r
diff --git a/na-get-lib/NaGet.Tasks/TaskCanceledException.cs b/na-get-lib/NaGet.Tasks/TaskCanceledException.cs
new file mode 100644 (file)
index 0000000..7b86bf7
--- /dev/null
@@ -0,0 +1,18 @@
+using System;
+
+namespace NaGet.Tasks
+{
+       [Serializable()]
+       public class TaskCanceledException : Exception
+       {
+               public TaskCanceledException(string msg)
+                       : base(msg)
+               {
+               }
+               
+               public TaskCanceledException(string msg, Exception e)
+                       : base(msg, e)
+               {
+               }
+       }
+}
diff --git a/na-get-lib/NaGet.Tasks/TaskEventArgs.cs b/na-get-lib/NaGet.Tasks/TaskEventArgs.cs
new file mode 100644 (file)
index 0000000..99dc3e8
--- /dev/null
@@ -0,0 +1,17 @@
+using System;
+
+namespace NaGet.Tasks
+{
+       public class TaskEventArgs : EventArgs
+       {
+               /// <summary>
+               /// タスクの進捗状況の百分率表示
+               /// </summary>
+               public float ProgressPercent = -1;
+               
+               /// <summary>
+               /// タスクの現況のメッセージ
+               /// </summary>
+               public string TaskMessage;
+       }
+}
index 85deb06..455b982 100644 (file)
     <Compile Include="NaGet.Packages\VersionComparetor.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetDownloadToCache.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetInstall.cs" />\r
     <Compile Include="NaGet.Packages\VersionComparetor.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetDownloadToCache.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetInstall.cs" />\r
-    <Compile Include="NaGet.SubCommands\NaGetTask.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetTaskSet.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetUninstall.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetTaskSet.cs" />\r
     <Compile Include="NaGet.SubCommands\NaGetUninstall.cs" />\r
+    <Compile Include="NaGet.Tasks\Task.cs" />\r
+    <Compile Include="NaGet.Tasks\TaskCanceledException.cs" />\r
+    <Compile Include="NaGet.Tasks\TaskEventArgs.cs" />\r
     <Compile Include="NaGet\ArgParser.cs" />\r
     <Compile Include="NaGet\Env.cs" />\r
     <Compile Include="NaGet\NaGetLibPref.cs" />\r
     <Compile Include="NaGet\ArgParser.cs" />\r
     <Compile Include="NaGet\Env.cs" />\r
     <Compile Include="NaGet\NaGetLibPref.cs" />\r