OSDN Git Service

チケット #38687 tar.gz 形式が 7-ZIP32.DLL がインストールされている環境下で正しく展開されない
[applistation/AppliStation.git] / na-get-lib / NaGet.SubCommands.SubTask / VerifyInstallerFileSubTask.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4 using NaGet.Tasks;
5 using NaGet.Packages;
6 using NaGet.Packages.Install;
7
8 namespace NaGet.SubCommands.SubTask
9 {
10         public class VerifyInstallerFileSubTask : NaGetSubTask
11         {
12                 IList<Installation> installations = null;
13                 
14                 IList<Installation> invalidInstallers = null;
15                 
16                 public VerifyInstallerFileSubTask(IList<Installation> insts)
17                 {
18                         installations = new ReadOnlyCollection<Installation>(insts);
19                 }
20                 
21                 public IList<Installation> InvalidInstallers {
22                         get { return invalidInstallers; }
23                 }
24                 
25                 public override void Run()
26                 {
27                         NotifyStarted();
28                         
29                         List<Installation> invalidInstallers = new List<Installation>();
30                         
31                         for (int i = 0; i < installations.Count; i++) {
32                                 Installation inst = installations[i];
33                                 float percent = 100.0f * i / installations.Count;
34                                 
35                                 if (inst.GetRegisteredHashCount() > 0) {
36                                         if (inst.IsInstallablePackage() && inst.VerifyHashValues() == false) {
37                                                 invalidInstallers.Add(inst);
38                                                 RaiseTaskSetEvent(TaskEventType.WARNING, "検証: "+inst.ToString() + " 非整合", percent);
39                                         } else {
40                                                 RaiseTaskSetEvent(TaskEventType.INFO, "検証: "+inst.ToString() + " OK", percent);
41                                         }
42                                 } else {
43                                         RaiseTaskSetEvent(TaskEventType.PING, string.Empty, percent);
44                                 }
45                         }
46                         
47                         if (invalidInstallers.Count > 0) {
48                                 this.invalidInstallers = invalidInstallers.AsReadOnly();
49                         } else {
50                                 this.invalidInstallers = null;
51                         }
52                         
53                         NotifyCompleted();
54                 }
55         }
56 }