Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the project to prepare it for analysis.
        /// </summary>
        /// <param name="project">The project to initialize.</param>
        /// <param name="data">The analysis data object.</param>
        /// <param name="cache">The file cache.</param>
        private static void InitializeProjectForAnalysis(CodeProject project, StyleCopThread.Data data, ResultsCache cache)
        {
            Param.AssertNotNull(project, "project");
            Param.AssertNotNull(data, "data");
            Param.Ignore(cache);

            // Get the status object for the project.
            ProjectStatus projectStatus = data.GetProjectStatus(project);
            Debug.Assert(projectStatus != null, "There is no status for the given project.");

            // Load the settings for the project. If the project already contains settings, use those.
            // Otherwise, load them from scratch.
            if (!project.SettingsLoaded)
            {
                project.Settings = data.GetSettings(project);
                project.SettingsLoaded = true;
            }

            // Load the project configuration from the cache and compare it to the
            // current project configuration.
            string configuration = cache == null ? null : cache.LoadProject(project);
            if (configuration == null)
            {
                projectStatus.IgnoreResultsCache = true;
            }
            else
            {
                projectStatus.IgnoreResultsCache = !StyleCopCore.CompareCachedConfiguration(
                    project.Configuration, configuration);
            }

            if (cache != null && project.WriteCache)
            {
                cache.SaveProject(project);
            }
        }
Ejemplo n.º 2
0
 private static void InitializeProjectForAnalysis(CodeProject project, StyleCopThread.Data data, ResultsCache cache)
 {
     ProjectStatus projectStatus = data.GetProjectStatus(project);
     if (!project.SettingsLoaded)
     {
         project.Settings = data.GetSettings(project);
         project.SettingsLoaded = true;
     }
     string flagList = (cache == null) ? null : cache.LoadProject(project);
     if (flagList == null)
     {
         projectStatus.IgnoreResultsCache = true;
     }
     else
     {
         projectStatus.IgnoreResultsCache = !CompareCachedConfiguration(project.Configuration, flagList);
     }
     if ((cache != null) && project.WriteCache)
     {
         cache.SaveProject(project);
     }
 }