public List <AlgorithmInfo> LoadFromNamespace(string assemblyNamespace, string assemblyFile = null)
        {
            var      list = new List <AlgorithmInfo>();
            Assembly asm;

            if (assemblyFile == null)
            {
                asm = Assembly.GetCallingAssembly();
                Log.Write($"Searching algorithms in namespace {assemblyNamespace} from {asm.EscapedCodeBase}.");
            }
            else
            {
                asm = Assembly.LoadFrom(assemblyFile);
                Log.Write($"Searching algorithms in namespace {assemblyNamespace} from {assemblyFile}.");
            }
            Type[] typelist = asm.GetTypes();

            foreach (Type type in typelist)
            {
                try
                {
                    if (type.Namespace == assemblyNamespace && type.IsSubclassOf(typeof(BaseMaxFlowAlgorithm)))
                    {
                        BaseMaxFlowAlgorithm var = (BaseMaxFlowAlgorithm)asm.CreateInstance(type.FullName);
                        Log.Write($"  Found algorithm class {type.Name}: {var.GetName()}");
                        list.Add(new AlgorithmInfo(var.GetName(), var.GetDescription(), var.GetUrl(), type.FullName, var));
                    }
                }
                catch (Exception e)
                {
                    Log.Write($"  {e.Message}", Log.ERROR);
                }
            }
            return(list);
        }
        public List <AlgorithmInfo> LoadFromSource(DirectoryInfo directory)
        {
            var list = new List <AlgorithmInfo>();

            Log.Write($"Loading algorithms files from {directory.FullName}");
            foreach (FileInfo file in directory.GetFiles("*.cs"))
            {
                Log.Write($"Found file {file.Name}");
                var asm = CompileExecutable(file);
                if (asm != null)
                {
                    foreach (var type in asm.GetTypes())
                    {
                        if (type.IsSubclassOf(typeof(BaseMaxFlowAlgorithm)))
                        {
                            BaseMaxFlowAlgorithm var = (BaseMaxFlowAlgorithm)asm.CreateInstance(type.FullName);
                            Log.Write($"  Found algorithm class {type.Name}: {var.GetName()}");
                            list.Add(new AlgorithmInfo(var.GetName(), var.GetDescription(), var.GetUrl(), type.FullName, var));
                        }
                    }
                }
            }
            return(list);
        }