-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from gbtb/load_assemblies_with_filter
Added LoadAssembliesRecursively with custom load filter function support
- Loading branch information
Showing
3 changed files
with
108 additions
and
6 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
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,53 @@ | ||
// Copyright 2019 Florian Gather <[email protected]> | ||
// Copyright 2019 Fritz Brandhuber <[email protected]> | ||
// Copyright 2020 Pavel Fischer <[email protected]> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
using Mono.Cecil; | ||
|
||
namespace ArchUnitNET.Loader | ||
{ | ||
/// <summary> | ||
/// Type of delegate to control assemblies loading | ||
/// </summary> | ||
/// <param name="assemblyDefinition">Current assembly definition</param> | ||
public delegate FilterResult FilterFunc(AssemblyDefinition assemblyDefinition); | ||
|
||
/// <summary> | ||
/// Filter function result options | ||
/// </summary> | ||
public struct FilterResult | ||
{ | ||
/// <summary> | ||
/// Load this assembly and traverse its dependencies | ||
/// </summary> | ||
public static FilterResult LoadAndContinue = new FilterResult(true, true); | ||
|
||
/// <summary> | ||
/// Do not load this assembly, but traverse its dependencies | ||
/// </summary> | ||
public static FilterResult SkipAndContinue = new FilterResult(true, false); | ||
|
||
/// <summary> | ||
/// Load this assembly and do not traverse its dependencies | ||
/// </summary> | ||
public static FilterResult LoadAndStop = new FilterResult(false, true); | ||
|
||
/// <summary> | ||
/// Do not load this assembly and do not traverse its dependencies | ||
/// </summary> | ||
public static FilterResult DontLoadAndStop = new FilterResult(false, false); | ||
|
||
private FilterResult(bool traverseDependencies, bool loadThisAssembly) | ||
{ | ||
TraverseDependencies = traverseDependencies; | ||
LoadThisAssembly = loadThisAssembly; | ||
} | ||
|
||
internal bool TraverseDependencies { get; } | ||
|
||
internal bool LoadThisAssembly { get; } | ||
} | ||
} |
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