-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Its now possible to specify providers of assemblies - fixes #650
- Loading branch information
Showing
21 changed files
with
300 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
Source/Bifrost.Specs/Execution/for_AssemblyProvider/FakeAssembly.cs
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
Source/Bifrost.Specs/Execution/for_AssemblyProvider/FakeModule.cs
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
Source/Bifrost.Specs/Execution/for_AssemblyProvider/given/all_dependencies.cs
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
...ce/Bifrost.Specs/Execution/for_AssemblyProvider/given/an_unitialized_assembly_provider.cs
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
...Provider/when_getting_assemblies_with_assembly_from_app_domain_that_should_filter_away.cs
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
...ider/when_getting_assemblies_with_assembly_from_app_domain_that_should_not_filter_away.cs
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
...der/when_getting_assemblies_with_dll_assembly_from_file_system_that_should_filter_away.cs
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
...when_getting_assemblies_with_dll_assembly_from_file_system_that_should_not_filter_away.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#region License | ||
// | ||
// Copyright (c) 2008-2015, Dolittle (http://www.dolittle.com) | ||
// | ||
// Licensed under the MIT License (http://opensource.org/licenses/MIT) | ||
// | ||
// You may not use this file except in compliance with the License. | ||
// You may obtain a copy of the license at | ||
// | ||
// http://github.com/dolittle/Bifrost/blob/master/MIT-LICENSE.txt | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
#endregion | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Bifrost.Execution | ||
{ | ||
/// <summary> | ||
/// Represents an implementation of <see cref="ICanProvideAssemblies"/> that provides assemblies from the current <see cref="_AppDomain"/> | ||
/// </summary> | ||
public class AppDomainAssemblyProvider : ICanProvideAssemblies | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="AppDomainAssemblyProvider"/> | ||
/// </summary> | ||
public AppDomainAssemblyProvider() | ||
{ | ||
AppDomain.CurrentDomain.AssemblyLoad += AssemblyLoaded; | ||
|
||
} | ||
|
||
#pragma warning disable 1591 // Xml Comments | ||
public event AssemblyAdded AssemblyAdded = (a) => { }; | ||
|
||
public IEnumerable<AssemblyInfo> AvailableAssemblies | ||
{ | ||
get | ||
{ | ||
return AppDomain.CurrentDomain.GetAssemblies() | ||
.Where(assembly => !assembly.IsDynamic) | ||
.Select(assembly => | ||
{ | ||
var name = assembly.GetName(); | ||
var assemblyInfo = new AssemblyInfo(name.Name, assembly.Location); | ||
return assemblyInfo; | ||
}); | ||
} | ||
} | ||
|
||
public _Assembly Get(AssemblyInfo assemblyInfo) | ||
{ | ||
return AppDomain.CurrentDomain.GetAssemblies() | ||
.Where(assembly => | ||
!assembly.IsDynamic && | ||
assembly.Location == assemblyInfo.Path).SingleOrDefault(); | ||
} | ||
#pragma warning restore 1591 // Xml Comments | ||
|
||
void AssemblyLoaded(object sender, AssemblyLoadEventArgs args) | ||
{ | ||
AssemblyAdded(args.LoadedAssembly); | ||
} | ||
} | ||
} |
Oops, something went wrong.