Esempio n. 1
0
        public DeployedDirectory(DirectoryInfo directory)
            : this()
        {
            Name = directory.Name;

//			foreach (DirectoryInfo childDirectory in directory.GetDirectories())
//			{
//				DeployedDirectory child = new DeployedDirectory(childDirectory);
//				AddChildDirectory(child);
//			}

            foreach (FileInfo fileInfo in directory.GetFiles())
            {
                DotNetAssembly assembly = DotNetAssembly.TryCreateAssembly(fileInfo);
                if (assembly != null)
                {
                    AddAssembly(assembly);
                }
                else
                {
                    DeployedFile deployedFile = DeployedFile.CreateFile(fileInfo);
                    AddFile(deployedFile);
                }
            }
        }
        public static DeployedFile CreateFile(FileInfo fileInfo)
        {
            var deployedFile = new DeployedFile(fileInfo.Name);
            var crypto = new SHA1CryptoServiceProvider();

            using (FileStream stream = fileInfo.OpenRead())
            {
                deployedFile.ContentsHash = crypto.ComputeHash(stream);
            }

            return deployedFile;
        }
        public static DeployedFile CreateFile(FileInfo fileInfo)
        {
            var deployedFile = new DeployedFile(fileInfo.Name);
            var crypto       = new SHA1CryptoServiceProvider();

            using (FileStream stream = fileInfo.OpenRead())
            {
                deployedFile.ContentsHash = crypto.ComputeHash(stream);
            }

            return(deployedFile);
        }
        public void CheckVersion(DeployedDirectory directory, IVersionReport report)
        {
            DeployedFile deployedFile = directory.FindFile(FileName);

            if (deployedFile == null)
            {
                report.MissingFile(FileName);
            }
            else if (!CheckContents(deployedFile.ContentsHash))
            {
                report.VersionMismatchFile(FileName);
            }
        }
Esempio n. 5
0
 public void AddFile(DeployedFile deployedFile)
 {
     _files.Add(deployedFile.FileName.ToUpper(), deployedFile);
 }
 public void AddFile(DeployedFile deployedFile)
 {
     _files.Add(deployedFile.FileName.ToUpper(), deployedFile);
 }