public override void Execute()
        {
            var assemblyReferences = AssemblyReferences;
            // ReSharper disable once PossibleNullReferenceException
            var jetbrainsAnnotationsReference = assemblyReferences.FirstOrDefault(x => x.Name.StartsWith("JetBrains.Annotations"));

            if (jetbrainsAnnotationsReference == null)
            {
                LogWarning("Reference to JetBrains.Annotations not found.");
                return;
            }

            if (string.IsNullOrEmpty(ProjectDirectoryPath) || !Directory.Exists(ProjectDirectoryPath))
            {
                LogError("ProjectDirectoryPath is not a valid directory: " + ProjectDirectoryPath);
                return;
            }

            assemblyReferences.Remove(jetbrainsAnnotationsReference);

            var jetbrainsAnnotations = ModuleDefinition.AssemblyResolver.Resolve(jetbrainsAnnotationsReference);

            Debug.Assert(jetbrainsAnnotations != null, "jetbrainsAnnotations != null");
            var elements = new Executor(ModuleDefinition, jetbrainsAnnotations).Execute();

            Save(elements);

            if (!string.IsNullOrEmpty(DocumentationFilePath) && File.Exists(DocumentationFilePath))
            {
                XmlDocumentation.Decorate(DocumentationFilePath, elements);
            }
        }
Example #2
0
        public override void Execute()
        {
            // Debugger.Launch();

            var assemblyReferences = AssemblyReferences;
            // ReSharper disable once PossibleNullReferenceException

            const string JetBrainsAnnotations = "JetBrains.Annotations";

            var jetbrainsAnnotationsReference = assemblyReferences.FirstOrDefault(x => x.Name.StartsWith(JetBrainsAnnotations));

            if (jetbrainsAnnotationsReference == null)
            {
                LogWarning("Reference to JetBrains.Annotations not found.");
                return;
            }

            if (string.IsNullOrEmpty(ProjectDirectoryPath) || !Directory.Exists(ProjectDirectoryPath))
            {
                LogError("ProjectDirectoryPath is not a valid directory: " + ProjectDirectoryPath);
                return;
            }

            assemblyReferences.Remove(jetbrainsAnnotationsReference);
            ReferenceCopyLocalPaths.RemoveAll(file => string.Equals(JetBrainsAnnotations, Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase));

            var jetbrainsAnnotations = ModuleDefinition.AssemblyResolver.Resolve(jetbrainsAnnotationsReference);

            Debug.Assert(jetbrainsAnnotations != null, "jetbrainsAnnotations != null");
            var elements = new Executor(ModuleDefinition, jetbrainsAnnotations).Execute();

            Save(elements);

            if (!string.IsNullOrEmpty(DocumentationFilePath) && File.Exists(DocumentationFilePath))
            {
                XmlDocumentation.Decorate(DocumentationFilePath, elements);
            }
        }