X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=na-get-lib%2FNaGet.SubCommands%2FNaGetUpdate.cs;h=619892104d36445d94bf941f55bf8f6789942ce1;hb=02c471102b6654a7ebd3f4e6b994307e2058731c;hp=56efa21a7776d6487462bc82268352c52ef47b6a;hpb=855f8af3bb25d90c17da5e2a86150943456fcb1e;p=applistation%2FAppliStation.git diff --git a/na-get-lib/NaGet.SubCommands/NaGetUpdate.cs b/na-get-lib/NaGet.SubCommands/NaGetUpdate.cs index 56efa21..6198921 100644 --- a/na-get-lib/NaGet.SubCommands/NaGetUpdate.cs +++ b/na-get-lib/NaGet.SubCommands/NaGetUpdate.cs @@ -65,7 +65,7 @@ namespace NaGet.SubCommands repoList = NaGet.Utils.GetDeserializedObject(NaGet.Env.RepositoriesListFile); } - foreach (RepositoryReference repo in repoList.Repositories) { + foreach (RepositoryInfo repo in repoList.EnabledRepositories) { taskSetNames.Add(string.Format("リスト取得: {0}", repo.Url.Href)); } taskSetNames.Add(string.Format("リスト更新: {0}", NaGet.Env.PackageListFile)); @@ -97,7 +97,8 @@ namespace NaGet.SubCommands RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "ネットワークに接続できませんでした。ネットワークが切断されているか、ファイアウォールによって遮断された可能性があります。"); } } finally { - currentTaskSetIndex = repoList.Repositories.Length + 1; + int numOfEnabledRepos = NaGet.Utils.IEnumerable2Array(repoList.EnabledRepositories).Length; + currentTaskSetIndex = numOfEnabledRepos + 1; } packageListsDownloaded = true; } @@ -113,19 +114,28 @@ namespace NaGet.SubCommands private void runDownloadPackages() { PackageList avaiablePackageList = new PackageList(); - foreach(RepositoryReference repo in repoList.Repositories) { + foreach(RepositoryInfo repo in repoList.EnabledRepositories) { RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, TaskSetNames[currentTaskSetIndex]); string tmpfileName = Path.GetTempFileName(); try { Downloader.Download(repo.Url.Href, tmpfileName); - PackageList pkgList = NaGet.Utils.GetDeserializedObject>(tmpfileName); - - // RepositoryReferenceの名前を読み込む // TODO RepositoryReferenceの名前を読み込む処理はここでいいのか? - repo.Name = (string.IsNullOrEmpty(pkgList.Name))? repo.Name : pkgList.Name; - - avaiablePackageList.AddPackages(pkgList.Packages); + if (repo.Type == RepositoryType.APPLISTATION_NATIVE_XML_1_0) { + try { + PackageList pkgList = NaGet.Utils.GetDeserializedObject>(tmpfileName); + pkgList.FixPackageListName(); // PackageListNameとの紐付けを行う + + // RepositoryReferenceの名前を読み込む // TODO RepositoryReferenceの名前を読み込む処理はここでいいのか? + repo.Name = (string.IsNullOrEmpty(pkgList.Name))? repo.Name : pkgList.Name; + + avaiablePackageList.AddPackages(pkgList.Packages); + } catch (InvalidOperationException) { + RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, string.Format("Repository {0} does not have a AppliStation Native XML softlist.", repo.Name ?? repo.Url.Href)); + } + } else { + RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, string.Format("Repository {0} is illegal type.", repo.Name ?? repo.Url.Href)); + } } finally { if (File.Exists(tmpfileName)) { File.Delete(tmpfileName);