Exemple #1
0
        protected override bool ApplyPropertyValues(ChoPlugInBuilderProperty plugInBuilderProperty, string propertyName)
        {
            if (plugInBuilderProperty == null)
            {
                return(false);
            }
            base.ApplyPropertyValues(plugInBuilderProperty, propertyName);

            ChoVBScriptFilePlugInBuilderProperty o = plugInBuilderProperty as ChoVBScriptFilePlugInBuilderProperty;

            if (o == null)
            {
                return(false);
            }

            if (propertyName == "ScriptFilePath")
            {
                ScriptFilePath = o.ScriptFilePath;
            }
            else if (propertyName == "Arguments")
            {
                Arguments = new ChoCDATA(o.Arguments);
            }
            else if (propertyName == "WorkingDirectory")
            {
                WorkingDirectory = o.WorkingDirectory;
            }
            else
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        protected virtual bool ApplyPropertyValues(ChoPlugInBuilderProperty plugInBuilderProperty, string propertyName)
        {
            if (plugInBuilderProperty == null)
            {
                return(false);
            }

            if (propertyName == "Name")
            {
                Name = plugInBuilderProperty.Name;
            }
            else if (propertyName == "Description")
            {
                Description = plugInBuilderProperty.Description;
            }
            else if (propertyName == "DoPropertyResolve")
            {
                DoPropertyResolve = plugInBuilderProperty.DoPropertyResolve;
            }
            else if (propertyName == "Enabled")
            {
                Enabled = plugInBuilderProperty.Enabled;
            }
            else
            {
                return(false);
            }

            return(true);
        }
Exemple #3
0
        protected virtual void InitPlugInBuilderProperty(ChoPlugInBuilderProperty plugInBuilderProperty)
        {
            if (plugInBuilderProperty == null)
            {
                return;
            }

            plugInBuilderProperty.Name              = Name;
            plugInBuilderProperty.Description       = Description;
            plugInBuilderProperty.DoPropertyResolve = DoPropertyResolve;
            plugInBuilderProperty.Enabled           = Enabled;
        }
Exemple #4
0
        protected override void InitPlugInBuilderProperty(ChoPlugInBuilderProperty plugInBuilderProperty)
        {
            if (plugInBuilderProperty == null)
            {
                return;
            }

            base.InitPlugInBuilderProperty(plugInBuilderProperty);

            ChoVBNETCodeSnippetPlugInBuilderProperty o = plugInBuilderProperty as ChoVBNETCodeSnippetPlugInBuilderProperty;

            if (o == null)
            {
                return;
            }

            o.CodeSnippet = CodeSnippet.GetValue();
            o.Arguments   = Arguments.GetValue();
            o.Namespaces  = Namespaces;
        }
        protected override void InitPlugInBuilderProperty(ChoPlugInBuilderProperty plugInBuilderProperty)
        {
            if (plugInBuilderProperty == null)
            {
                return;
            }

            base.InitPlugInBuilderProperty(plugInBuilderProperty);

            ChoJavaScriptPlugInBuilderProperty o = plugInBuilderProperty as ChoJavaScriptPlugInBuilderProperty;

            if (o == null)
            {
                return;
            }

            o.Script           = Script.GetValue();
            o.Arguments        = Arguments.GetValue();
            o.WorkingDirectory = WorkingDirectory;
        }
        protected override void InitPlugInBuilderProperty(ChoPlugInBuilderProperty plugInBuilderProperty)
        {
            if (plugInBuilderProperty == null)
            {
                return;
            }

            base.InitPlugInBuilderProperty(plugInBuilderProperty);

            ChoDotNetAssemblyPlugInBuilderProperty o = plugInBuilderProperty as ChoDotNetAssemblyPlugInBuilderProperty;

            if (o == null)
            {
                return;
            }

            o.TypeName       = TypeName;
            o.MethodName     = MethodName;
            o.IsStaticMethod = IsStaticMethod;
            o.Arguments      = Arguments.GetValue();
        }
        protected override bool ApplyPropertyValues(ChoPlugInBuilderProperty plugInBuilderProperty, string propertyName)
        {
            if (plugInBuilderProperty == null)
            {
                return(false);
            }
            base.ApplyPropertyValues(plugInBuilderProperty, propertyName);

            ChoDotNetAssemblyPlugInBuilderProperty o = plugInBuilderProperty as ChoDotNetAssemblyPlugInBuilderProperty;

            if (o == null)
            {
                return(false);
            }

            if (propertyName == "TypeName")
            {
                TypeName = o.TypeName;
            }
            else if (propertyName == "MethodName")
            {
                MethodName = o.MethodName;
            }
            else if (propertyName == "IsStaticMethod")
            {
                IsStaticMethod = o.IsStaticMethod;
            }
            else if (propertyName == "Arguments")
            {
                Arguments = new ChoCDATA(o.Arguments);
            }
            else
            {
                return(false);
            }

            return(true);
        }
Exemple #8
0
        protected override bool ApplyPropertyValues(ChoPlugInBuilderProperty plugInBuilderProperty, string propertyName)
        {
            if (plugInBuilderProperty == null)
            {
                return(false);
            }
            if (base.ApplyPropertyValues(plugInBuilderProperty, propertyName))
            {
                return(true);
            }

            ChoVBNETCodeSnippetPlugInBuilderProperty o = plugInBuilderProperty as ChoVBNETCodeSnippetPlugInBuilderProperty;

            if (o == null)
            {
                return(false);
            }

            if (propertyName == "CodeSnippet")
            {
                CodeSnippet = new ChoCDATA(o.CodeSnippet);
            }
            else if (propertyName == "Arguments")
            {
                Arguments = o.Arguments;
            }
            else if (propertyName == "Namespaces")
            {
                Namespaces = o.Namespaces;
            }
            else
            {
                return(false);
            }

            return(true);
        }
Exemple #9
0
        public ChoPlugInBuilder()
        {
            _plugInBuilderProperty = new Lazy <ChoPlugInBuilderProperty>(() =>
            {
                ChoPlugInAttribute plugInAttribute = ChoType.GetAttribute <ChoPlugInAttribute>(GetType());
                if (plugInAttribute == null)
                {
                    throw new ChoPlugInException("Missing ChoPlugInAttribute decorated for '{0}' plugin builder.".FormatString(GetType().Name));
                }

                Type type = plugInAttribute.PlugInBuilderPropertyType;
                if (type == null)
                {
                    throw new ChoPlugInException("Can't find plugin property for '{0}' plugin builder.".FormatString(GetType().Name));
                }

                ChoPlugInBuilderProperty p = ChoActivator.CreateInstance(type) as ChoPlugInBuilderProperty;
                if (p == null)
                {
                    throw new ChoPlugInException("Can't find plugin property for '{0}' plugin builder.".FormatString(GetType().Name));
                }

                try
                {
                    InitPlugInBuilderProperty(p);
                }
                catch { }

                p.PropertyChanged += ((s, e) =>
                {
                    ApplyPropertyValues(p, e.PropertyName);
                });

                return(p);
            }, true);
        }