Skip to content

Commit

Permalink
(chocolateyGH-584) Assembly adapter enhancements
Browse files Browse the repository at this point in the history
 - Add GetType (all overloads)
 - Add LoadFile
  • Loading branch information
ferventcoder committed Jan 27, 2016
1 parent c9c1706 commit 2f57d15
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/chocolatey/infrastructure/adapters/Assembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,36 @@ public Stream GetManifestResourceStream(Type type, string name)
return _assembly.GetManifestResourceStream(type, name);
}

public AssemblyName GetName()
{
return _assembly.GetName();
}

public Type GetType(String name)
{
return _assembly.GetType(name);
}

public Type GetType(String name, bool throwOnError)
{
return _assembly.GetType(name,throwOnError);
}

public Type GetType(String name, bool throwOnError, bool ignoreCase)
{
return _assembly.GetType(name,throwOnError, ignoreCase);
}

public static IAssembly LoadFile(string path)
{
return new Assembly(System.Reflection.Assembly.LoadFile(path));
}

public static IAssembly GetAssembly(Type type)
{
return new Assembly(System.Reflection.Assembly.GetAssembly(type));
//return System.Reflection.Assembly.GetAssembly(type);
}
public AssemblyName GetName()
{
return _assembly.GetName();
}

public static IAssembly GetExecutingAssembly()
{
Expand Down
6 changes: 6 additions & 0 deletions src/chocolatey/infrastructure/adapters/IAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public interface IAssembly

AssemblyName GetName();

Type GetType(String name);

Type GetType(String name, bool throwOnError);

Type GetType(String name, bool throwOnError, bool ignoreCase);

/// <summary>
/// Loads the specified manifest resource from this assembly.
/// </summary>
Expand Down

0 comments on commit 2f57d15

Please sign in to comment.