public static void Init() { SystemHelper sh = new SystemHelper(); foreach (var dtk in _apiMap.Values.Select(t => $"{t.Name} Drivers")) { tlog.LogMessage("DriverLoader", $"Loading/Creating node for Ascom {dtk}"); DriverTypeNode dn = sh.SubNode <DriverTypeNode>(sh.Ascom.ProfileNodeId, $"{dtk}", true); if (dn == null) { tlog.LogMessage("DriverLoader", $"Failed to access Ascom {dtk}"); throw new DriverException("Driver loader initialization failed"); } tlog.LogMessage("DriverLoader", $"Got handle to Ascom {dtk} [{dn.ProfileNodeId}]"); } tlog.LogMessage("AscomDriverLoader", $"Driver Root: {DriverRoot}"); tlog.LogMessage("AscomDriverLoader", $"Loading assemblies..."); LoadAssemblies(); tlog.LogMessage("AscomDriverLoader", $"{Assemblies.Count()} assemblies loaded"); foreach (var a in Assemblies) { Version aver = a?.GetName().Version; tlog.LogMessage("AscomDriverLoader", $"\t {a.FullName} v{aver.Major}.{aver.Minor}.{aver.MajorRevision}.{aver.MinorRevision}"); } tlog.LogMessage("AscomDriverLoader", $"Registering drivers..."); RegisterDrivers(); tlog.LogMessage("AscomDriverLoader", $"{DriverTypes.Count()} drivers loaded"); foreach (var dt in DriverTypes) { tlog.LogMessage("AscomDriverLoader", $"\t {dt.FullName}"); } }
public DocsProject LoadAssemblies() { // Load dlls from TempFolder and log if verbose enabled LogVerbose("Loading Assemblies..."); Assemblies.Add(Assembly.LoadFile(Path.Combine(Settings.TempFolder, Path.GetFileNameWithoutExtension(Settings.SourcePath) + ".dll"))); // Directory.EnumerateFiles(Settings.TempFolder, "*.dll").ToList().ForEach(f => { // Assemblies.Add(Assembly.LoadFile(Path.GetFullPath(f))); // LogVerbose($"File {Path.GetFullPath(f)} added to assemblies enumerable."); // }); LogVerbose($"{Assemblies.Count()} assemblies in enumerable"); LogVerbose("Loading source dlls complete."); return(this); }