/// <summary> /// Merges the given mapinfo to the current. /// </summary> /// <param name="mapInfo">Map information that will be merged.</param> /// <returns>merged map informations</returns> public MapInfo Merge(MapInfo mapInfo) { var opNames = new Dictionary <string, string>(); var returnValues = new Dictionary <string, ReturnDataType>(); var parameters = new Dictionary <string, Dictionary <string, string> >(); var keys = this.OpNames.Keys; foreach (var key in keys) { opNames.Add(key, this.OpNames[key]); returnValues.Add(key, this.ReturnValues[key]); parameters.Add(key, this.Parameters[key]); } keys = mapInfo.OpNames.Keys; foreach (var key in keys) { if (!OpNames.ContainsKey(key)) { opNames.Add(key, mapInfo.OpNames[key]); returnValues.Add(key, mapInfo.ReturnValues[key]); parameters.Add(key, mapInfo.Parameters[key]); } } var result = new MapInfo(); result._isConstructed = true; result.ConstructMapInfo(opNames, returnValues, parameters); return(result); }
public void Add(Operation op) { if (OpNames.Contains(op.OperationName)) { throw new InvalidOperationException("Operation name already exists"); } this.Ops.Add(op); this.OpNames.Add(op.OperationName); }
public Operation Delete(string operationName) { if (!OpNames.Remove(operationName)) { throw new KeyNotFoundException("Operation name not exists"); } Operation op = this.GetOperation(operationName); Ops.Remove(op); return(op); }