using System;
using System.IO;
using System.Collections.Generic;
using System.Net;
using NaGet.Packages;
using NaGet.Packages.Install;
using NaGet.SubCommands;
using NaGet.SubCommands.SubTask;
using NaGet.Tasks;
namespace NaGet.SubCommands
{
///
/// ソフトリストなどのアップデート処理
///
public class NaGetUpdate2 : NaGetTaskSet2
{
private PackageListsManager pkgListMan = null;
private bool downloadPackageLists = true;
private RepositoriesList repoList = null;
private IList tempRepoFiles = null;
public NaGetUpdate2(PackageListsManager pkgListMan)
: this(pkgListMan, true)
{
}
///
/// コンストラクタ
///
/// 参照パッケージマネージャ
/// リストをダウンロードするか?
public NaGetUpdate2(PackageListsManager pkgMan, bool downloadPackageListsFlag)
{
this.pkgListMan = pkgMan;
this.downloadPackageLists = downloadPackageListsFlag;
// taskセットの初期化
initSubTask();
if (downloadPackageListsFlag) {
registSubTask("セキュリティプロトコル設定の確認",
new SecurityProtocolConfigSubTask());
}
if (this.downloadPackageLists) {
// repos.list.xmlがあるとき、そこからよみとる。
repoList = NaGet.Utils.GetDeserializedObject(NaGet.Env.RepositoriesListFile);
tempRepoFiles = new List();
foreach (RepositoryInfo repo in repoList.EnabledRepositories) {
string filepath = Path.GetTempFileName();
tempRepoFiles.Add(filepath);
registSubTask(string.Format("リスト取得: {0}", repo.Url.Href),
new DownloadSubTask(repo.Url.Href, filepath));
}
registSubTask(string.Format("リスト更新: {0}", NaGet.Env.PackageListFile),
new FunctionalSubTask