// NAnt - A .NET build tool // Copyright (C) 2001-2004 Gerry Shaw // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Gert Driesen (gert.driesen@ardatis.com) using System; using System.IO; using System.Reflection; using NAnt.Core; using NAnt.Core.Attributes; namespace NAnt.Core.Functions { /// /// Functions that return information about an assembly's identity. /// [FunctionSet("assemblyname", "Assembly")] public class AssemblyNameFunctions : FunctionSetBase { #region Public Instance Constructors public AssemblyNameFunctions(Project project, PropertyDictionary properties) : base(project, properties) {} #endregion Public Instance Constructors #region Public Static Methods /// /// Gets the location of the assembly as a URL. /// /// The of the assembly. /// /// The location of the assembly as a URL. /// /// [Function("get-codebase")] public static string GetCodeBase(AssemblyName assemblyName) { return assemblyName.CodeBase; } /// /// Gets the URI, including escape characters, that represents the codebase. /// /// The of the assembly. /// /// The URI, including escape characters, that represents the codebase. /// /// [Function("get-escaped-codebase")] public static string GetEscapedCodeBase(AssemblyName assemblyName) { return assemblyName.EscapedCodeBase; } /// /// Gets the full name of the assembly, also known as the display name. /// /// The of the assembly. /// /// The full name of the assembly, also known as the display name. /// /// /// /// Output the full name of the nunit.framework assembly to the /// build log. /// /// /// /// ]]> /// /// /// [Function("get-full-name")] public static string GetFullName(AssemblyName assemblyName) { return assemblyName.FullName; } /// /// Gets the simple, unencrypted name of the assembly. /// /// The of the assembly. /// /// The simple, unencrypted name of the assembly. /// /// /// /// Output the simple name of the nunit.framework assembly to /// the build log. /// /// /// /// ]]> /// /// /// [Function("get-name")] public static string GetName(AssemblyName assemblyName) { return assemblyName.Name; } /// /// Gets the version of the assembly. /// /// The of the assembly. /// /// The version of the assembly. /// /// /// /// Output the major version of the nunit.framework assembly /// to the build log. /// /// /// /// ]]> /// /// /// /// [Function("get-version")] public static Version GetVersion(AssemblyName assemblyName) { return assemblyName.Version; } /// /// Gets the for a given file. /// /// The assembly file for which to get the . /// /// An object representing the given file. /// /// is an empty . /// does not exist. /// is not a valid assembly. /// /// The assembly is not added to this domain. /// /// /// /// Output the full name of the nunit.framework assembly to the /// build log. /// /// /// /// ]]> /// /// [Function("get-assembly-name")] public static AssemblyName GetAssemblyName(string assemblyFile) { return AssemblyName.GetAssemblyName(assemblyFile); } #endregion Public Static Methods } }