protected Dictionary <Assembly, List <Script> > StrategiesScanDllsInitDeserialized(string dataOrStartupPath) { ScriptRepository repo = new ScriptRepository(); repo.InitializeAndScan(dataOrStartupPath); Dictionary <Assembly, List <Script> > ret = repo.CloneableInstancesByAssemblies; foreach (Assembly assembly in ret.Keys) { List <Script> cloneableInstancesForAssembly = ret[assembly]; // WONT_BE_EMPTY if (cloneableInstancesForAssembly.Count == 0) continue; string assemblyName = Path.GetFileName(assembly.Location); if (this.StrategiesInFolders.ContainsKey(assemblyName) == false) { //this.StrategiesInFolders.Add(assemblyName, new List<Strategy>()); this.FolderAdd(assemblyName, false); //} else { // string msg = "StrategyRepository::StrategiesScanDllsInitDeserialized(" + dataOrStartupPath + "):" // + " Assembly [" + assembly.Location + "] wasn't added to this.StrategiesInFolders" // + " because already existed among AllFoldersAvailable[" + AllFoldersAvailable + "]"; // Assembler.Constructed.StatusReporter.PopupException(msg); // continue; } List <Strategy> strategiesForAssmbly = this.StrategiesInFolders[assemblyName]; foreach (Script script in cloneableInstancesForAssembly) { string scriptName = script.GetType().Name; Strategy strategyFound = this.LookupByName(scriptName, assemblyName); if (strategyFound == null) { strategyFound = new Strategy(scriptName); strategyFound.StoredInJsonAbspath = Path.Combine(this.FolderAbsPathFor(assemblyName), scriptName + ".json"); strategiesForAssmbly.Add(strategyFound); } strategyFound.Script = script; strategyFound.DllPathIfNoSourceCode = assembly.Location; this.StrategySave(strategyFound); } } return(ret); }
protected Dictionary<Assembly, List<Script>> StrategiesScanDllsInitDeserialized(string dataOrStartupPath) { ScriptRepository repo = new ScriptRepository(); repo.InitializeAndScan(dataOrStartupPath); Dictionary<Assembly, List<Script>> ret = repo.CloneableInstancesByAssemblies; foreach (Assembly assembly in ret.Keys) { List<Script> cloneableInstancesForAssembly = ret[assembly]; // WONT_BE_EMPTY if (cloneableInstancesForAssembly.Count == 0) continue; string assemblyName = Path.GetFileName(assembly.Location); if (this.StrategiesInFolders.ContainsKey(assemblyName) == false) { //this.StrategiesInFolders.Add(assemblyName, new List<Strategy>()); this.FolderAdd(assemblyName, false); //} else { // string msg = "StrategyRepository::StrategiesScanDllsInitDeserialized(" + dataOrStartupPath + "):" // + " Assembly [" + assembly.Location + "] wasn't added to this.StrategiesInFolders" // + " because already existed among AllFoldersAvailable[" + AllFoldersAvailable + "]"; // Assembler.Constructed.StatusReporter.PopupException(msg); // continue; } List<Strategy> strategiesForAssmbly = this.StrategiesInFolders[assemblyName]; foreach (Script script in cloneableInstancesForAssembly) { string scriptName = script.GetType().Name; Strategy strategyFound = this.LookupByName(scriptName, assemblyName); if (strategyFound == null) { strategyFound = new Strategy(scriptName); strategyFound.StoredInJsonAbspath = Path.Combine(this.FolderAbsPathFor(assemblyName), scriptName + ".json"); strategiesForAssmbly.Add(strategyFound); } strategyFound.Script = script; strategyFound.DllPathIfNoSourceCode = assembly.Location; this.StrategySave(strategyFound); } } return ret; }