Files
Umbraco-CMS/src/Umbraco.Core/AssemblyExtensions.cs
shannon@ShandemVaio 32bef227b7 Added App_Code assembly loading to new type finder, had to recompile log4net to support medium trust.
Updated TypeFinder and assembly info to support medium trust.
2012-08-04 06:07:29 +06:00

36 lines
879 B
C#

using System;
using System.IO;
using System.Reflection;
namespace Umbraco.Core
{
internal static class AssemblyExtensions
{
/// <summary>
/// Returns the file used to load the assembly
/// </summary>
/// <param name="assembly"></param>
/// <returns></returns>
public static FileInfo GetAssemblyFile(this Assembly assembly)
{
var codeBase = assembly.CodeBase;
var uri = new Uri(codeBase);
var path = uri.LocalPath;
return new FileInfo(path);
}
/// <summary>
/// Returns the file used to load the assembly
/// </summary>
/// <param name="assemblyName"></param>
/// <returns></returns>
public static FileInfo GetAssemblyFile(this AssemblyName assemblyName)
{
var codeBase = assemblyName.CodeBase;
var uri = new Uri(codeBase);
var path = uri.LocalPath;
return new FileInfo(path);
}
}
}