コード例 #1
0
        public ParameterStack GetParameters(IComponentSearchMethod compSearchMethod)
        {
            ParameterStack parameters = Plugin.Parameters;
            string         grpId      = string.Empty;

            if (null != compSearchMethod)
            {
                foreach (Parameter p in parameters)
                {
                    try
                    {
                        if (p is ParameterAngle pa)
                        {
                            parameters.SetAngleParameter(pa.Name, compSearchMethod.GetAngleParameterDefaultValue(grpId, Guid, pa.Name));
                        }
                        if (p is ParameterDouble pd)
                        {
                            parameters.SetDoubleParameter(pd.Name, compSearchMethod.GetDoubleParameterDefaultValue(grpId, Guid, pd.Name));
                        }
                        if (p is ParameterBool pb)
                        {
                            parameters.SetBoolParameter(pb.Name, compSearchMethod.GetBoolParameterDefaultValue(grpId, Guid, pb.Name));
                        }
                        if (p is ParameterInt pi)
                        {
                            parameters.SetIntegerParameter(pi.Name, compSearchMethod.GetIntParameterDefaultValue(grpId, Guid, pi.Name));
                        }
                        if (p is ParameterMulti pm)
                        {
                            parameters.SetMultiParameter(pm.Name, 0);
                        }
                    }
                    catch (Exception /*ex*/)
                    {
                    }
                }
            }
            return(parameters);
        }
コード例 #2
0
        public ParameterStack GetParameters(IComponentSearchMethod compSearchMethod)
        {
            ParameterStack parameters = _instance.Parameters;

            if (null != compSearchMethod)
            {
                foreach (Parameter p in parameters)
                {
                    try
                    {
                        ParameterDouble pd = p as ParameterDouble;
                        if (null != pd)
                        {
                            parameters.SetDoubleParameter(pd.Name, compSearchMethod.GetDoubleParameterDefaultValue(Guid, pd.Name));
                        }
                        ParameterBool pb = p as ParameterBool;
                        if (null != pb)
                        {
                            parameters.SetBoolParameter(pb.Name, compSearchMethod.GetBoolParameterDefaultValue(Guid, pb.Name));
                        }
                        ParameterInt pi = p as ParameterInt;
                        if (null != pi)
                        {
                            parameters.SetIntegerParameter(pb.Name, compSearchMethod.GetIntParameterDefaultValue(Guid, pi.Name));
                        }
                        ParameterMulti pm = p as ParameterMulti;
                        if (null != pm)
                        {
                            parameters.SetMultiParameter(pm.Name, 0);
                        }
                    }
                    catch (Exception /*ex*/)
                    {
                    }
                }
            }
            return(parameters);
        }
コード例 #3
0
ファイル: ComponentLoader.cs プロジェクト: ddanninger/PLMPack
        public ParameterStack GetInitializedParameterStack(IPlugin plugin)
        {
            // check if already available in cache
            ParameterStack stack = null;

            stack = ComponentLoader.GetStackFromCache(plugin.Guid);
            if (null == stack)
            {
                if (!(_searchMethod is IComponentSearchMethod))
                {
                    throw new PluginException("Component loader was not initialized with a valid plugin search method.");
                }

                IPluginExt1 pluginExt1 = plugin as IPluginExt1;
                IPluginExt2 pluginExt2 = plugin as IPluginExt2;
                IPluginExt3 pluginExt3 = plugin as IPluginExt3;

                // get parameter stack
                if (null != pluginExt1)
                {
                    stack = plugin.Parameters;
                }
                else if (null != pluginExt2)
                {
                    stack = pluginExt2.BuildParameterStack(null);
                }
                else if (null != pluginExt3)
                {
                    stack = pluginExt3.BuildParameterStack(null);
                }
                // check parameter stack
                if (null == stack)
                {
                    throw new PluginException("Failed to build initial parameter stack.");
                }

                // load parameter values from plugins
                foreach (Parameter param in stack)
                {
                    try
                    {
                        ParameterDouble pd = param as ParameterDouble;
                        if (null != pd)
                        {
                            stack.SetDoubleParameter(pd.Name, _searchMethod.GetDoubleParameterDefaultValue(plugin.Guid, pd.Name));
                        }
                        ParameterBool pb = param as ParameterBool;
                        if (null != pb)
                        {
                            stack.SetBoolParameter(pb.Name, _searchMethod.GetBoolParameterDefaultValue(plugin.Guid, pb.Name));
                        }
                        ParameterInt pi = param as ParameterInt;
                        if (null != pi)
                        {
                            stack.SetIntParameter(pi.Name, _searchMethod.GetIntParameterDefaultValue(plugin.Guid, pi.Name));
                        }
                        ParameterMulti pm = param as ParameterMulti;
                        if (null != pm)
                        {
                            stack.SetMultiParameter(pm.Name, _searchMethod.GetMultiParameterDefaultValue(plugin.Guid, pm.Name));
                        }
                    }
                    catch (Exception /*ex*/)
                    {
                    }
                }
                // save in cache
                ComponentLoader.InsertParameterStackInCache(plugin.Guid, stack);
            }
            return(stack.Clone());
        }
コード例 #4
0
ファイル: Component.cs プロジェクト: minrogi/PLMPack
 public ParameterStack GetParameters(IComponentSearchMethod compSearchMethod)
 {
     ParameterStack parameters = _instance.Parameters;
     if (null != compSearchMethod)
     {
         foreach (Parameter p in parameters)
         {
             try
             {
                 ParameterDouble pd = p as ParameterDouble;
                 if (null != pd) parameters.SetDoubleParameter(pd.Name, compSearchMethod.GetDoubleParameterDefaultValue(Guid, pd.Name));
                 ParameterBool pb = p as ParameterBool;
                 if (null != pb) parameters.SetBoolParameter(pb.Name, compSearchMethod.GetBoolParameterDefaultValue(Guid, pb.Name));
                 ParameterInt pi = p as ParameterInt;
                 if (null != pi) parameters.SetIntegerParameter(pb.Name, compSearchMethod.GetIntParameterDefaultValue(Guid, pi.Name));
                 ParameterMulti pm = p as ParameterMulti;
                 if (null != pm) parameters.SetMultiParameter(pm.Name, 0);
             }
             catch (Exception /*ex*/)
             {
             }
         }
     }
     return parameters;
 }