Projekt

Obecné

Profil

Stáhnout (1.42 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
#if TEST
26
            string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.FullName;
27
#else
28
            string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.Parent.Parent.FullName;
29
#endif
30

    
31

    
32
            // Loop through all dll files in directory
33
            foreach (FileInfo file in new DirectoryInfo(Path.Combine(projectDirectory, "src", "Presentation", "Leuze.Modules", "net5.0")).GetFiles("*.dll"))
34
            {
35
                try
36
                {
37
                    loadedAssemblies.Add(Assembly.Load(AssemblyName.GetAssemblyName(file.FullName)));
38
                }
39
                catch (Exception)
40
                {
41
                    Console.WriteLine("Error loading assembly from file: " + file.FullName);
42
                }
43
            }
44

    
45
            ExtensionManager.SetAssemblies(loadedAssemblies);
46
        }
47
    }
48
}
(6-6/6)