2 using System.Collections.Generic;
5 using NaGet.Packages.Install;
7 namespace NaGet.SubCommands.SubTask
9 public class VerifyInstallerFileSubTask : NaGetSubTask
11 IList<Installation> installations = null;
13 IList<Installation> invalidInstallers = null;
15 public VerifyInstallerFileSubTask(IList<Installation> insts)
17 installations = insts;
20 public IList<Installation> InvalidInstallers {
21 get { return invalidInstallers; }
24 public override void Run()
28 List<Installation> invalidInstallers = new List<Installation>();
30 for (int i = 0; i < installations.Count; i++) {
31 Installation inst = installations[i];
32 float percent = 100.0f * i / installations.Count;
34 if (inst.GetRegisteredHashCount() > 0) {
35 if (inst.IsInstallablePackage() && inst.VerifyHashValues() == false) {
36 invalidInstallers.Add(inst);
37 RaiseTaskSetEvent(TaskEventType.WARNING, "検証: "+inst.ToString() + " 非整合", percent);
39 RaiseTaskSetEvent(TaskEventType.INFO, "検証: "+inst.ToString() + " OK", percent);
42 RaiseTaskSetEvent(TaskEventType.PING, string.Empty, percent);
46 if (invalidInstallers.Count > 0) {
47 this.invalidInstallers = invalidInstallers.AsReadOnly();
49 this.invalidInstallers = null;