2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
6 using NaGet.Packages.Install;
8 namespace NaGet.SubCommands.SubTask
10 public class VerifyInstallerFileSubTask : NaGetSubTask
12 IList<Installation> installations = null;
14 IList<Installation> invalidInstallers = null;
16 public VerifyInstallerFileSubTask(IList<Installation> insts)
18 installations = new ReadOnlyCollection<Installation>(insts);
21 public IList<Installation> InvalidInstallers {
22 get { return invalidInstallers; }
25 public override void Run()
29 List<Installation> invalidInstallers = new List<Installation>();
31 for (int i = 0; i < installations.Count; i++) {
32 Installation inst = installations[i];
33 float percent = 100.0f * i / installations.Count;
35 if (inst.GetRegisteredHashCount() > 0) {
36 if (inst.IsInstallablePackage() && inst.VerifyHashValues() == false) {
37 invalidInstallers.Add(inst);
38 RaiseTaskSetEvent(TaskEventType.WARNING, "検証: "+inst.ToString() + " 非整合", percent);
40 RaiseTaskSetEvent(TaskEventType.INFO, "検証: "+inst.ToString() + " OK", percent);
43 RaiseTaskSetEvent(TaskEventType.PING, string.Empty, percent);
47 if (invalidInstallers.Count > 0) {
48 this.invalidInstallers = invalidInstallers.AsReadOnly();
50 this.invalidInstallers = null;