2 using System.Xml.Serialization;
\r
3 using System.Collections.Generic;
\r
5 using NaGet.Packages;
\r
7 namespace ArchiveInstall
\r
9 public class InstalledFileList
\r
11 [XmlElement("Entry")]
\r
12 public List<InstalledFile> Entries;
\r
14 public InstalledFileList()
\r
16 Entries = new List<InstalledFile>();
\r
20 ///
\83n
\83b
\83V
\83\85\8c\9f\8fØ
\82ð
\8ds
\82¢
\81A
\95Ï
\8dX
\82³
\82ê
\82½
\82Æ
\8am
\94F
\82µ
\82½(
\91Ã
\93\96\82Å
\82È
\82¢)
\83t
\83@
\83C
\83\8b\82ð
\95Ô
\82·
\r
22 /// <param name="rootDirectory">
\8c\9f\8d¸
\82·
\82é
\83t
\83@
\83C
\83\8b\82Ì
\83\8b\81[
\83g
\83f
\83B
\83\8c\83N
\83g
\83\8a</param>
\r
23 /// <returns>
\95Ï
\8dX
\82³
\82ê
\82½
\82Æ
\8c\9f\8fo
\82µ
\82½
\83t
\83@
\83C
\83\8b()</returns>
\r
24 public IEnumerable<InstalledFile> Verify(string rootDirectory)
\r
26 foreach (InstalledFile file in Entries) {
\r
27 string filepath = Path.Combine(rootDirectory, file.Path);
\r
29 if (File.Exists(filepath) && (! file.Hash.Validate(filepath))) {
\r
35 public static InstalledFileList CreateFromFiles(string rootDirectory)
\r
37 InstalledFileList list = new InstalledFileList();
\r
38 foreach (string filepath in Directory.GetFiles(rootDirectory, "*", SearchOption.AllDirectories)) {
\r
39 string relativePath = NaGet.Utils.GetRelativePath(rootDirectory, filepath);
\r
40 if (relativePath.StartsWith(".applistation.")) {
\r
44 InstalledFile file = new InstalledFile();
\r
45 file.Path = relativePath;
\r
46 file.Hash = new HashValue();
\r
47 file.Hash.Type = HashValueType.SHA1SUM;
\r
48 file.Hash.Value = HashValue.HashValueFor(filepath, file.Hash.Type);
\r
50 list.Entries.Add(file);
\r
56 public class InstalledFile
\r
59 ///
\83t
\83@
\83C
\83\8b\82Ì
\83p
\83X
\r
64 ///
\83n
\83b
\83V
\83\85\92l
\r
66 public HashValue Hash;
\r
68 public InstalledFile()
\r