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 |
d402013e
|
Tomáš Orlovský
|
|
26 |
68c1c319
|
Tomáš Orlovský
|
string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.Parent.Parent.FullName;
|
27 |
f70b07dd
|
Milan Hotovec
|
|
28 |
fad0afca
|
Dominik Chlouba
|
// Loop through all dll files in directory
|
29 |
0da3f05f
|
Milan Hotovec
|
foreach (FileInfo file in new DirectoryInfo(Path.Combine(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 |
|
|
}
|