Projekt

Obecné

Profil

Stáhnout (1.29 KB) Statistiky
| Větev: | Tag: | Revize:
1
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
            string workingDirectory = Environment.CurrentDirectory;
25

    
26
            string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.Parent.Parent.FullName;
27

    
28
            // Loop through all dll files in directory
29
            foreach (FileInfo file in new DirectoryInfo(Path.Combine(projectDirectory, "src", "Presentation", "Leuze.Modules", "net5.0")).GetFiles("*.dll"))
30
            {
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
}
(6-6/6)