1 |
fad0afca
|
Dominik Chlouba
|
using ExtCore.Infrastructure;
|
2 |
|
|
using System;
|
3 |
|
|
using System.Collections.Generic;
|
4 |
|
|
using System.IO;
|
5 |
|
|
using System.Linq;
|
6 |
|
|
using System.Reflection;
|
7 |
|
|
using System.Text;
|
8 |
|
|
using System.Threading.Tasks;
|
9 |
|
|
|
10 |
|
|
namespace Leuze.Tests.Configuration
|
11 |
|
|
{
|
12 |
|
|
/// <summary>
|
13 |
|
|
///
|
14 |
|
|
/// </summary>
|
15 |
|
|
public class Utilities
|
16 |
|
|
{
|
17 |
|
|
/// <summary>
|
18 |
|
|
///
|
19 |
|
|
/// </summary>
|
20 |
|
|
public static void LoadExtensions()
|
21 |
|
|
{
|
22 |
|
|
List<Assembly> loadedAssemblies = new List<Assembly>();
|
23 |
|
|
|
24 |
f70b07dd
|
Milan Hotovec
|
string workingDirectory = Environment.CurrentDirectory;
|
25 |
|
|
string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.Parent.Parent.FullName;
|
26 |
|
|
|
27 |
fad0afca
|
Dominik Chlouba
|
// Loop through all dll files in directory
|
28 |
f70b07dd
|
Milan Hotovec
|
//foreach (FileInfo file in new DirectoryInfo("C:\\Users\\domin\\source\\repos\\Leuze\\src\\Presentation\\Leuze.Modules\\net5.0").GetFiles("*.dll"))
|
29 |
|
|
foreach (FileInfo file in new DirectoryInfo(projectDirectory + "\\src\\Presentation\\Leuze.Modules\\net5.0").GetFiles("*.dll"))
|
30 |
fad0afca
|
Dominik Chlouba
|
{
|
31 |
|
|
try
|
32 |
|
|
{
|
33 |
|
|
loadedAssemblies.Add(Assembly.Load(AssemblyName.GetAssemblyName(file.FullName)));
|
34 |
|
|
}
|
35 |
|
|
catch (Exception)
|
36 |
|
|
{
|
37 |
|
|
Console.WriteLine("Error loading assembly from file: " + file.FullName);
|
38 |
|
|
}
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
ExtensionManager.SetAssemblies(loadedAssemblies);
|
42 |
|
|
}
|
43 |
|
|
}
|
44 |
|
|
}
|