OSDN Git Service

na-get-lib,起動高速化機能追加時にインストール済みソフトのバージョン認識がされていないことがあったのを修正。
[applistation/AppliStation.git] / all-get / Main.cs
index d21168a..876d8aa 100644 (file)
@@ -80,6 +80,7 @@ namespace AllGet
                        downloader.DownloadEventRaised += new EventHandler<DownloadEventArgs>(dl.OnDownload);\r
                        \r
                        pkgListMan = new PackageListsManager();\r
+                       pkgListMan.LoadPackageLists();\r
                }\r
                \r
                public void Update()\r
@@ -95,7 +96,6 @@ namespace AllGet
                public void update(bool downloadPackageListFlag)\r
                {\r
                        NaGet.SubCommands.NaGetUpdate tasks = new NaGet.SubCommands.NaGetUpdate(pkgListMan, downloadPackageListFlag);\r
-                       tasks.Downloader = this.downloader;\r
                        tasks.TaskSetRaised += delegate(object sender, NaGetTaskSetEventArgs e) { \r
                                switch (e.Type) {\r
 //                                     case NaGetTaskSetEventType.COMPLETED_TASKSET\r
@@ -118,6 +118,8 @@ namespace AllGet
                                                break;\r
                                }\r
                        };\r
+                       DownloadListener dl = new DownloadListener();\r
+                       tasks.Downloader.DownloadEventRaised += dl.OnDownload;\r
                        \r
                        tasks.Run();\r
                }\r
@@ -288,6 +290,13 @@ namespace AllGet
                                }\r
                        }\r
                        \r
+                       Installation[] depInstallations;\r
+                       {\r
+                               Installation[] resolved;\r
+                               DependeciesResolver.ResolveInstallations(installations, pkgListMan, out resolved, out depInstallations);\r
+                               installations = resolved;\r
+                       }\r
+                       \r
                        Console.WriteLine("The following packages will be downloaded:");\r
                        Console.WriteLine("  {0}", Installation.ToString(installations));\r
                        if (AllGet.Util.Confirm("Do you want to continue [Y/n]?", true) == false) {\r
@@ -296,7 +305,6 @@ namespace AllGet
                        }\r
                        \r
                        NaGet.SubCommands.NaGetInstall tasks = new NaGet.SubCommands.NaGetInstall(pkgListMan, installations);\r
-                       tasks.Downloader = this.downloader;\r
                        tasks.TaskQueryRaised += delegate(object sender, NaGetTaskQueryArgs e) {\r
                                char result = '\u0000';\r
                                if (e.SelectionFlag == (NaGetTaskQueryResult.CONTINUE | NaGetTaskQueryResult.RETRY | NaGetTaskQueryResult.CANCEL)) {\r
@@ -342,6 +350,8 @@ namespace AllGet
                                                break;\r
                                }\r
                        };\r
+                       DownloadListener dl = new DownloadListener();\r
+                       tasks.Downloader.DownloadEventRaised += dl.OnDownload;\r
                        \r
                        tasks.Run();\r
                }\r
@@ -478,6 +488,7 @@ namespace AllGet
                        Console.WriteLine("誰か {0} をスーパー牛さんパワー化してくれ", executeFileName);\r
                }\r
                \r
+               [STAThread]\r
                public static void Main(string[] args)\r
                {\r
                        // アーカイブSYSTEM32をパスに足す\r
@@ -501,81 +512,99 @@ namespace AllGet
                                }\r
                        }\r
                        \r
-                       if (args[0] == "update") {\r
-                               if (args.Length != 1) {\r
-                                       Console.WriteLine("E: The update command takes no arguments");\r
-                                       Environment.Exit(1);\r
-                               }\r
-                               mc.Update();\r
-                       } else if (args[0] == "localupdate") {\r
-                               if (args.Length != 1) {\r
-                                       Console.WriteLine("E: The update command takes no arguments");\r
-                                       Environment.Exit(1);\r
-                               }\r
-                               mc.LocalUpdate();\r
-                       } else if (args[0] == "search") {\r
-                               if (args.Length <= 1) {\r
-                                       Console.WriteLine("E: You must give exactly one pattern");\r
-                                       Environment.Exit(1);\r
-                               }\r
-                               \r
-                               mc.Search(string.Join(" ", args, 1, args.Length - 1));\r
-                       } else if (args[0] == "show") {\r
-                               if (args.Length <= 1) {\r
-                                       Console.WriteLine("E: You must give exactly one pattern");\r
-                                       Environment.Exit(1);\r
-                               }\r
-                               \r
-                               for (int i = 1; i < args.Length; i++) {\r
-                                       mc.Show(args[i]);\r
-                               }\r
-                       } else if (args[0] == "download") {\r
-                               if (args.Length <= 1) {\r
-                                       Console.WriteLine("E: Invalid operation download");\r
-                                       Environment.Exit(1);\r
-                               }\r
-                               \r
-                               string[] packages = new string[args.Length - 1];\r
-                               Array.Copy(args, 1, packages, 0, packages.Length);\r
-                               \r
-                               mc.Download(packages);\r
-                       } else if (args[0] == "install") {\r
-                               if (args.Length <= 1) {\r
-                                       Console.WriteLine("E: Invalid operation install");\r
-                                       Environment.Exit(1);\r
-                               }\r
-                               \r
-                               string[] packages = new string[args.Length - 1];\r
-                               Array.Copy(args, 1, packages, 0, packages.Length);\r
-                               \r
-                               mc.Install(packages);\r
-                       } else if (args[0] == "checkupgrade") {\r
-                               mc.CheckUpgrade();\r
-                       } else if (args[0] == "remove") {\r
-                               if (args.Length <= 1) {\r
-                                       Console.WriteLine("E: Invalid operation remove");\r
+                       // 引数ごとに操作を決定\r
+                       switch (args[0])\r
+                       {\r
+                               case "update":\r
+                                       if (args.Length != 1) {\r
+                                               Console.WriteLine("E: The update command takes no arguments");\r
+                                               Environment.Exit(1);\r
+                                       }\r
+                                       mc.Update();\r
+                                       break;\r
+                               case "localupate":\r
+                                       if (args.Length != 1) {\r
+                                               Console.WriteLine("E: The update command takes no arguments");\r
+                                               Environment.Exit(1);\r
+                                       }\r
+                                       mc.LocalUpdate();\r
+                                       break;\r
+                               case "search":\r
+                                       if (args.Length <= 1) {\r
+                                               Console.WriteLine("E: You must give exactly one pattern");\r
+                                               Environment.Exit(1);\r
+                                       }\r
+                                       \r
+                                       mc.Search(string.Join(" ", args, 1, args.Length - 1));\r
+                                       break;\r
+                               case "show":\r
+                                       if (args.Length <= 1) {\r
+                                               Console.WriteLine("E: You must give exactly one pattern");\r
+                                               Environment.Exit(1);\r
+                                       }\r
+                                       \r
+                                       for (int i = 1; i < args.Length; i++) {\r
+                                               mc.Show(args[i]);\r
+                                       }\r
+                                       break;\r
+                               case "download":\r
+                                       if (args.Length <= 1) {\r
+                                               Console.WriteLine("E: Invalid operation download");\r
+                                               Environment.Exit(1);\r
+                                       } else {\r
+                                               string[] packages = new string[args.Length - 1];\r
+                                               Array.Copy(args, 1, packages, 0, packages.Length);\r
+                                               \r
+                                               mc.Download(packages);\r
+                                       }\r
+                                       break;\r
+                               case "install":\r
+                                       if (args.Length <= 1) {\r
+                                               Console.WriteLine("E: Invalid operation install");\r
+                                               Environment.Exit(1);\r
+                                       } else {\r
+                                               string[] packages = new string[args.Length - 1];\r
+                                               Array.Copy(args, 1, packages, 0, packages.Length);\r
+                                               \r
+                                               mc.Install(packages);\r
+                                       }\r
+                                       break;\r
+                               case "checkupgrade":\r
+                                       mc.CheckUpgrade();\r
+                                       break;\r
+                               case "remove":\r
+                                       if (args.Length <= 1) {\r
+                                               Console.WriteLine("E: Invalid operation remove");\r
+                                               Environment.Exit(1);\r
+                                       } else {\r
+                                               string[] packages = new string[args.Length - 1];\r
+                                               Array.Copy(args, 1, packages, 0, packages.Length);\r
+                                               \r
+                                               mc.Remove(packages);\r
+                                       }\r
+                                       break;\r
+                               case "cleancache":\r
+                                       {\r
+                                               string[] packages = new string[args.Length - 1];\r
+                                               Array.Copy(args, 1, packages, 0, packages.Length);\r
+                                               \r
+                                               mc.CleanCache(packages);\r
+                                       }\r
+                                       break;\r
+                               case "foobar":\r
+                                       mc.FooBar();\r
+                                       break;\r
+                               case "hoge":\r
+                                       mc.Hoge();\r
+                                       break;\r
+                               case "moo":\r
+                                       mc.Moo();\r
+                                       break;\r
+                               default:\r
+                                       mc.Help();\r
+                                       \r
                                        Environment.Exit(1);\r
-                               }\r
-                               \r
-                               string[] packages = new string[args.Length - 1];\r
-                               Array.Copy(args, 1, packages, 0, packages.Length);\r
-                               \r
-                               mc.Remove(packages);\r
-                       } else if (args[0] == "cleancache") {\r
-                               string[] packages = new string[args.Length - 1];\r
-                               Array.Copy(args, 1, packages, 0, packages.Length);\r
-                               \r
-                               mc.CleanCache(packages);\r
-                       } else if (args[0] == "foobar") {\r
-                               mc.FooBar();\r
-                       } else if (args[0] == "hoge") {\r
-                               mc.Hoge();\r
-                       } else if (args[0] == "moo") {\r
-                               mc.Moo();\r
-                       } else {\r
-                               mc.Help();\r
-                               \r
-                               Environment.Exit(1);\r
+                                       break;\r
                        }\r
                }\r
        }\r