/// <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); }
public Tools(Guid compGuid, IComponentSearchMethod searchMethod) { ComponentLoader loader = new ComponentLoader(); loader.SearchMethod = searchMethod; Component = loader.LoadComponent(compGuid); }
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); }
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); }
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); }
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); }
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); }
/// <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; }
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; }