/** * Checks which key to return from the dictionary based on types. */ public string GetKey(ITransformerItem transformerItem) { if (transformerItem is TransformerItemInput) { return(this.inputs); } if (transformerItem is TransformerItemOutput) { return(this.outputs); } return(""); }
/** * Adds a new item to the input or output area of the dictionary, depending on the type. */ public void Add(ITransformerItem transformerItem) { List <ITransformerItem> transformerItems; string key = this.GetKey(transformerItem); if (key == "") { Log.Warning("Empty Key."); return; } if (this.inputsOutputs.ContainsKey(key)) { transformerItems = this.inputsOutputs[key]; transformerItems.Add(transformerItem); this.inputsOutputs.Remove(key); this.inputsOutputs.Add(key, transformerItems); return; } transformerItems = new List <ITransformerItem>(); transformerItems.Add(transformerItem); this.inputsOutputs.Add(key, transformerItems); }