<commit_before>using System;
using System.IO;
using System.Linq;
using System.Reflection;

var currentDirectory = Directory.GetCurrentDirectory();
var parentDirectory = Directory.GetParent(currentDirectory).FullName;

// If our parent directory contains QC Dlls use it, otherwise default to current working directory
// In cloud and CLI research cases we expect the parent directory to contain the Dlls; but locally it may be cwd
var directoryToLoad = Directory.GetFiles(parentDirectory, "QuantConnect.*.dll").Any() ? parentDirectory : currentDirectory;

// Load in all dll's from this directory
Console.WriteLine($"Initialize.csx: Loading assemblies from {directoryToLoad}");
foreach (var file in Directory.GetFiles(directoryToLoad, "*.dll"))
{
    try
    {
        Assembly.LoadFrom(file.ToString());
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
    }
}
<commit_msg>C# research will pre load all QC dlls (#5820)<commit_after>using System;
using System.IO;
using System.Linq;
using System.Reflection;

var currentDirectory = Directory.GetCurrentDirectory();
var parentDirectory = Directory.GetParent(currentDirectory).FullName;

// If our parent directory contains QC Dlls use it, otherwise default to current working directory
// In cloud and CLI research cases we expect the parent directory to contain the Dlls; but locally it may be cwd
var directoryToLoad = Directory.GetFiles(parentDirectory, "QuantConnect.*.dll").Any() ? parentDirectory : currentDirectory;

// Load in all QC dll's from this directory
Console.WriteLine($"Initialize.csx: Loading assemblies from {directoryToLoad}");
foreach (var file in Directory.GetFiles(directoryToLoad, "QuantConnect.*.dll"))
{
    try
    {
        Assembly.LoadFrom(file.ToString());
    }
    catch (Exception e)
    {
        Console.WriteLine($"File: {file}. Exception: {e}");
    }
}

{'fraction_non_alphanumeric': 0.10064585575888052, 'fraction_numerical': 0.002152852529601722, 'mean_word_length': 4.549253731343284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '319316', 'n_tokens_mistral': 522, 'n_tokens_neox': 495, 'n_words': 172}