public IModulePipeline GetPipeLineByFrom(IModulePipeline from, IModuleInstance to) { var fromstr = from.IsLocal ? from.path : (from.system.Remote.ToString() + "/" + from.path); var pipestr = to.path + "_" + fromstr; var isExist = this.refPipelines.TryGetValue(pipestr, out IModulePipeline pipe); if (isExist) { //现有的pipe可能是一个已经关闭的,但是传进来的from始终是对,所以获取后再重新设置下 (pipe as PipelineRefLocal)?.SetFromPipeline(from); return(pipe); } else { PipelineRefLocal _pipe = new PipelineRefLocal(_System, to); this.refPipelines[pipestr] = _pipe; _pipe.SetFromPipeline(from); return(_pipe); } }
public IModulePipeline GetPipeline(IModuleInstance user, string path) { var pipestr = path + "_"; if (user != null) { pipestr += user.path; } if (this.refPipelines.TryGetValue(pipestr, out IModulePipeline pipe)) { return(pipe); } IModuleInstance module = this._System.GetModule(path); PipelineRefLocal _pipe = new PipelineRefLocal(_System, module); this.refPipelines[pipestr] = _pipe; var userpipe = user == null ? null : _System.GetPipeline(module, "this/" + user.path); _pipe.SetFromPipeline(userpipe); return(_pipe); }