public void RemoveCio(object obj) { string id = ""; if (obj is CioBase cio) { id = cio.ID; } if (obj is string str) { id = str; } foreach (var item in Cios.Where(a => a.ID == id).ToArray()) { if (item is CiBase ci) { InCommands.Remove(ci); } else if (item is CoBase co) { Constraints.Remove(co); } else { throw new JacException(JacException.Codes.TypeMismatch, $"Cio.Remove type mismatch Name={id}"); } } }
public void AddCio(object obj) { if (obj is CiBase ci) { ci.ParentProcess = this; InCommands.Add(ci); } else if (obj is CoBase co) { co.ParentProcess = this; Constraints.Add(co); } else { throw new JacException(JacException.Codes.TypeMismatch, $"Cio.Add type mismatch arg type={(obj?.GetType().Name ?? "null")}"); } }