Пример #1
0
        /// <summary>
        /// Adds aall input/output properties of a CSProject to a hash collection
        /// </summary>
        /// <param name="Hasher"></param>
        /// <param name="Project"></param>
        /// <returns></returns>
        public static bool AddCsProjectInfo(this HashCollection Hasher, CsProjectInfo Project, HashCollection.HashType HashType)
        {
            // Get the output assembly and pdb file
            FileReference OutputFile;

            if (!Project.TryGetOutputFile(out OutputFile))
            {
                throw new Exception(String.Format("Unable to get output file for {0}", Project.ProjectPath));
            }
            FileReference DebugFile = OutputFile.ChangeExtension("pdb");

            // build a list of all input and output files from this module
            List <FileReference> DependentFiles = new List <FileReference> {
                Project.ProjectPath, OutputFile, DebugFile
            };

            DependentFiles.AddRange(Project.CompileReferences);

            if (!Hasher.AddFiles(DependentFiles, HashType))
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Compares two collections by comparing the underlying hashsets
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            HashCollection RHS = obj as HashCollection;

            if (RHS == null)
            {
                return(false);
            }
            return(Hashes.SetEquals(RHS.Hashes));
        }
Пример #3
0
 /// <summary>
 /// Logs differences between two collections for debugging
 /// </summary>
 /// <param name="RHS"></param>
 public void LogDifferences(HashCollection RHS)
 {
     foreach (var Entry in Hashes)
     {
         if (!RHS.HasEntryForName(Entry.Name))
         {
             Log.TraceInformation("RHS does not have an entry for {0}", Entry.Name);
         }
         else if (!RHS.Hashes.Contains(Entry))
         {
             HashEntry RHSEntry = RHS.GetEntryForName(Entry.Name);
             Log.TraceInformation("RHS hash mismatch for {0}", Entry.Name);
             Log.TraceInformation("LHS:\n\t{0}\n\t{1}\n\t{2}", Entry.Hash, Entry.Name, Entry.MetaData);
             Log.TraceInformation("RHS:\n\t{0}\n\t{1}\n\t{2}", RHSEntry.Hash, RHSEntry.Name, RHSEntry.MetaData);
         }
     }
 }
        /// <summary>
        /// Adds aall input/output properties of a CSProject to a hash collection
        /// </summary>
        /// <param name="Hasher"></param>
        /// <param name="Project"></param>
        /// <returns></returns>
        public static bool AddCsProjectInfo(this HashCollection Hasher, CsProjectInfo Project, HashCollection.HashType HashType)
        {
            // Get the output assembly and pdb file
            DirectoryReference ProjectDirectory = Project.ProjectPath.Directory;
            DirectoryReference OutputDir        = Project.GetOutputDir(ProjectDirectory);
            FileReference      OutputFile       = FileReference.Combine(OutputDir, Project.GetAssemblyName() + ".dll");
            FileReference      DebugFile        = OutputFile.ChangeExtension("pdb");

            // build a list of all input and output files from this module
            List <FileReference> DependentFiles = new List <FileReference> {
                Project.ProjectPath, OutputFile, DebugFile
            };

            DependentFiles.AddRange(Project.CompileReferences);

            if (!Hasher.AddFiles(DependentFiles, HashType))
            {
                return(false);
            }

            return(true);
        }