Пример #1
0
        /// <summary>
        /// Pulls all dependencies from the specified module list, gathers the state of them, and
        /// compares it to the state expressed in the provided file from a previous run
        /// </summary>
        /// <param name="ModuleList"></param>
        /// <param name="DependencyFile"></param>
        /// <returns></returns>
        private static bool AreDependenciesUpToDate(IEnumerable <string> ModuleList, string DependencyFile)
        {
            bool UpToDate = false;

            if (File.Exists(DependencyFile))
            {
                Log.TraceVerbose("Read dependency file at {0}", DependencyFile);

                HashCollection OldHashes = HashCollection.CreateFromFile(DependencyFile);

                if (OldHashes != null)
                {
                    HashCollection CurrentHashes = HashModules(ModuleList, false);

                    if (OldHashes.Equals(CurrentHashes))
                    {
                        UpToDate = true;
                    }
                    else
                    {
                        if (Log.OutputLevel >= LogEventType.VeryVerbose)
                        {
                            CurrentHashes.LogDifferences(OldHashes);
                        }
                    }
                }
                else
                {
                    Log.TraceInformation("Failed to read dependency info!");
                }
            }
            else
            {
                Log.TraceVerbose("No dependency file exists at {0}. Will do full build.", DependencyFile);
            }

            return(UpToDate);
        }