コード例 #1
0
        public static IEnumerable <object> Pull(BHoMAdapter adapter, object request = null,
                                                PullType pullType = PullType.AdapterDefault, ActionConfig actionConfig = null,
                                                bool active       = false)
        {
            if (!active)
            {
                return(new List <object>());
            }

            IRequest actualRequest = null;

            if (!adapter.SetupPullRequest(request, out actualRequest))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(request)}` input.");
                return(null);
            }

            ActionConfig pullConfig = null;

            if (!adapter.SetupPullConfig(actionConfig, out pullConfig))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(actionConfig)}` input.");
                return(null);
            }

            return(adapter.Pull(actualRequest, pullType, pullConfig));
        }
コード例 #2
0
        public static bool Move(BHoMAdapter source, BHoMAdapter target, object request = null,
                                PullType pullType = PullType.AdapterDefault, ActionConfig pullConfig = null,
                                PushType pushType = PushType.AdapterDefault, ActionConfig pushConfig = null, bool active = false)
        {
            if (!active)
            {
                return(false);
            }

            IRequest actualRequest = null;

            if (!source.SetupPullRequest(request, out actualRequest))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(request)}` input.");
                return(false);
            }

            ActionConfig pullCfg = null;

            if (!source.SetupPullConfig(pullConfig, out pullCfg))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(pullConfig)}` input.");
                return(false);
            }

            ActionConfig pushCfg = null;

            if (!source.SetupPushConfig(pushConfig, out pushCfg))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(pushConfig)}` input.");
                return(false);
            }


            return(source.Move(target, actualRequest, pullType, pullCfg, pushType, pushCfg));
        }