Exemplo n.º 1
0
        /// <summary>
        /// Reads the contents of the project file and returns the details of the
        /// output assembly for this project
        /// </summary>
        /// <returns>An array of assembly files, although there will only ever be one from here.</returns>
        public override List <DocumentedAssembly> Read()
        {
            ProjectFileProperties properties = this.ParseProject();

            if (!string.IsNullOrEmpty(properties.OutputPath))
            {
                string outputFile = string.Format(@"{0}\{1}{2}.{3}",
                                                  System.IO.Path.GetDirectoryName(this.FileName),
                                                  properties.OutputPath,
                                                  properties.LibraryName,
                                                  properties.GetOutputExtension());

                string documentation = string.Empty;
                if (!string.IsNullOrEmpty(properties.DocumentationFile))
                {
                    if (System.IO.Path.IsPathRooted(properties.DocumentationFile))
                    {
                        documentation = properties.DocumentationFile;
                    }
                    else
                    {
                        // We need to check if the file is relative to the project file or simply output
                        // in the output directory
                        documentation = System.IO.Path.GetFullPath(System.IO.Path.GetDirectoryName(this.FileName) + "\\" + properties.DocumentationFile);
                        if (!System.IO.File.Exists(documentation))
                        {
                            documentation = System.IO.Path.GetFullPath(System.IO.Path.GetDirectoryName(this.FileName) + "\\" + properties.OutputPath + "\\" + properties.DocumentationFile);
                        }
                    }
                }

                return(new List <DocumentedAssembly>()
                {
                    new DocumentedAssembly(outputFile, documentation)
                });
            }
            else
            {
                throw new InvalidOperationException();
            }
        }