Exemple #1
0
        private void ScanFiles()
        {
            // If no includes were specified, add all files and subdirectories
            // from the fileset's base directory to the fileset.
            if ((FileSet.Includes.Count == 0) && (FileSet.AsIs.Count == 0))
            {
                FileSet.Includes.Add("**/*.dll");

                // Make sure to rescan the fileset
                FileSet.Scan();
            }

            AgentProjectInfo projectInfo = new AgentProjectInfo();

            if (String.IsNullOrEmpty(ProjectToken))
            {
                projectInfo.Coordinates = new Coordinates(null, Project.ProjectName, null);
            }
            else
            {
                projectInfo.ProjectToken = ProjectToken;
            }

            // scan files and calculate SHA-1 values
            List <DependencyInfo> dependencies = projectInfo.Dependencies;

            foreach (String pathname in FileSet.FileNames)
            {
                FileInfo srcInfo = new FileInfo(pathname);
                if (srcInfo.Exists)
                {
                    String sha1     = ChecksumUtils.GetSha1Hash(pathname);
                    String filename = srcInfo.Name;
                    Log(Level.Debug, "SHA-1 for " + filename + " is: " + sha1);

                    DependencyInfo dependency = new DependencyInfo();
                    dependency.Sha1       = sha1;
                    dependency.ArtifactId = filename;
                    dependency.SystemPath = pathname;
                    dependencies.Add(dependency);
                }
            }
            Log(Level.Info, "Found " + dependencies.Count + " direct dependencies");
            projects.Add(projectInfo);
        }