コード例 #1
0
        /// <summary>
        /// Instantiates the <see cref="Tools"/> class
        /// </summary>
        /// <param name="filepath">Component file path</param>
        public Tools(string filepath, IComponentSearchMethod searchMethod)
        {
            ComponentLoader loader = new ComponentLoader();

            loader.SearchMethod = searchMethod;
            _component          = loader.LoadComponent(filepath);
        }
コード例 #2
0
        public Tools(Guid compGuid, IComponentSearchMethod searchMethod)
        {
            ComponentLoader loader = new ComponentLoader();

            loader.SearchMethod = searchMethod;
            Component           = loader.LoadComponent(compGuid);
        }
コード例 #3
0
        public PluginViewer(IComponentSearchMethod pluginSearchMethod, string pluginPath)
        {
            InitializeComponent();
            ctrlPluginViewer.SearchMethod = pluginSearchMethod;
            ctrlPluginViewer.PluginPath   = pluginPath;

            ctrlPluginViewer.ValidateButtonVisible = true;
            ctrlPluginViewer.CloseButtonVisible    = true;
            ctrlPluginViewer.CloseClicked         += new EventHandler(OnCloseClicked);
            ctrlPluginViewer.ValidateClicked      += new EventHandler(OnValidateClicked);
        }
コード例 #4
0
ファイル: PluginViewer.cs プロジェクト: minrogi/PLMPack
        public PluginViewer(IComponentSearchMethod pluginSearchMethod, string pluginPath)
        {
            InitializeComponent();
            ctrlPluginViewer.SearchMethod = pluginSearchMethod;
            ctrlPluginViewer.PluginPath = pluginPath;

            ctrlPluginViewer.ValidateButtonVisible = true;
            ctrlPluginViewer.CloseButtonVisible = true;
            ctrlPluginViewer.CloseClicked += new EventHandler(ctrlPluginViewer_CloseClicked);
            ctrlPluginViewer.ValidateClicked += new EventHandler(ctrlPluginViewer_ValidateClicked);
        }
コード例 #5
0
ファイル: PluginGenerator.cs プロジェクト: treeDiM/PackLib4ES
        public static bool Regenerate(string inputPath, string outputPath, Guid guid, string name, string description)
        {
            // load existing component
            IComponentSearchMethod searchMethod    = null;
            ComponentLoader        componentLoader = new ComponentLoader
            {
                SearchMethod = searchMethod
            };
            Component comp = componentLoader.LoadComponent(inputPath);

            // instantiate PluginGenerator
            PluginGenerator generator = new PluginGenerator
            {
                AssemblyCompany     = comp.Author,
                AssemblyDescription = comp.Description,
                AssemblyVersion     = comp.Version,
                DrawingName         = string.IsNullOrEmpty(name) ? comp.Name : name,
                DrawingDescription  = string.IsNullOrEmpty(description) ? comp.Description : description,
                Guid        = guid != Guid.Empty ? guid : Guid.NewGuid(),
                DrawingCode = comp.SourceCode
            };

            if (comp.HasEmbeddedThumbnail)
            {
                // get thumbnail image
                Bitmap bmp = comp.Thumbnail;
                // save thumbnail image as bmp
                string bitmapPath = Path.ChangeExtension(Path.GetTempFileName(), "bmp");
                bmp.Save(bitmapPath, System.Drawing.Imaging.ImageFormat.Bmp);
                // set thumbnail path in generator
                generator.ThumbnailPath = bitmapPath;
            }
            generator.OutputDirectory = Path.GetTempPath();
            CompilerResults res = generator.Build();

            if (res.Errors.Count > 0)
            {
                return(false);
            }

            // copy compiler output to new path
            File.Copy(
                res.PathToAssembly
                , outputPath
                , true /*overwrite*/
                );

            return(true);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }
コード例 #8
0
ファイル: Pic.Plugin.Tools.cs プロジェクト: minrogi/PLMPack
 /// <summary>
 /// Instantiates the <see cref="Tools"/> class
 /// </summary>
 /// <param name="component">An instance of the <see cref="Component"/> class.</param>
 public Tools(Component component, IComponentSearchMethod searchMethod)
 {
     _component = component;
 }
コード例 #9
0
ファイル: Pic.Plugin.Tools.cs プロジェクト: minrogi/PLMPack
 /// <summary>
 /// Instantiates the <see cref="Tools"/> class
 /// </summary>
 /// <param name="filepath">Component file path</param>
 public Tools(string filepath, IComponentSearchMethod searchMethod)
 {
     ComponentLoader loader = new ComponentLoader();
     loader.SearchMethod = searchMethod;
     _component = loader.LoadComponent(filepath);
 }
コード例 #10
0
 /// <summary>
 /// Instantiates the <see cref="Tools"/> class
 /// </summary>
 /// <param name="component">An instance of the <see cref="Component"/> class.</param>
 public Tools(Component component, IComponentSearchMethod searchMethod)
 {
     _component = component;
 }
コード例 #11
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;
 }