public void TestAssemblyCreate() { string fileName = "strategy.common.strategyconfig"; string filePath = TestCaseManager.GetTestCasePath(typeof(TestStrategyAssemblyConfig), fileName); //StrategyAssembly config = new StrategyAssembly(); //config.Load(filePath); StrategyAssembly strategyAssembly = StrategyAssembly.Create(filePath); IStrategyInfo strategyInfo = strategyAssembly.GetStrategyInfo("com.wer.sc.strategy.common.ma.Strategy_MultiMa"); Console.WriteLine(strategyInfo); }
/// <summary> /// 刷新一个assembly /// </summary> /// <param name="ass"></param> public void Refresh(IStrategyAssembly ass) { int index = this.assemblies.IndexOf(ass); this.assemblies.Remove(ass); string path = ass.ConfigPath; StrategyAssembly newAss = StrategyAssembly.Create(path); if (newAss != null) { this.assemblies.Insert(index, newAss); } }
public IList <IStrategyAssembly> Scan(String path) { if (!Directory.Exists(path)) { return(new List <IStrategyAssembly>()); } String[] configfiles = Directory.GetFiles(path, "*.strategyconfig", SearchOption.AllDirectories); List <IStrategyAssembly> plugins = new List <IStrategyAssembly>(); for (int i = 0; i < configfiles.Length; i++) { string file = configfiles[i]; //StrategyAssembly strategyAssembly = new StrategyAssembly(); //strategyAssembly.Load(file); StrategyAssembly strategyAssembly = StrategyAssembly.Create(file); plugins.Add(strategyAssembly); } return(plugins); }