diff --git a/Tunny/Component/Operation/ConstructFishAttribute.cs b/Tunny/Component/Operation/ConstructFishAttribute.cs index 293461de..d06d367c 100644 --- a/Tunny/Component/Operation/ConstructFishAttribute.cs +++ b/Tunny/Component/Operation/ConstructFishAttribute.cs @@ -71,36 +71,51 @@ private void GetInputData(IGH_DataAccess DA, int paramCount, Dictionary(); - if (DA.GetDataList(i, direction)) - { - if (direction.Any(x => x != 1 && x != -1)) - { - AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Direction must be either 1(maximize) or -1(minimize)."); - return; - } - dict.Add(key, direction); - } + SetDirectionDataList(DA, dict, i, key); break; case 2: - var constraint = new List(); - if (DA.GetDataList(i, constraint)) - { - dict.Add(key, constraint); - } + SetConstraintDataList(DA, dict, i, key); break; default: - var list = new List(); - if (!DA.GetDataList(i, list)) - { - continue; - } - dict.Add(key, list); + SetGenericDataList(DA, dict, i, key); break; } } } + private static void SetGenericDataList(IGH_DataAccess DA, Dictionary dict, int i, string key) + { + var list = new List(); + if (!DA.GetDataList(i, list)) + { + return; + } + dict.Add(key, list); + } + + private static void SetConstraintDataList(IGH_DataAccess DA, Dictionary dict, int i, string key) + { + var constraint = new List(); + if (DA.GetDataList(i, constraint)) + { + dict.Add(key, constraint); + } + } + + private void SetDirectionDataList(IGH_DataAccess DA, Dictionary dict, int i, string key) + { + var direction = new List(); + if (DA.GetDataList(i, direction)) + { + if (direction.Any(x => x != 1 && x != -1)) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Direction must be either 1(maximize) or -1(minimize)."); + return; + } + dict.Add(key, direction); + } + } + //FIXME: Should be modified to capture and check for change events. private bool CheckIsNicknameDuplicated() {