Example #1
0
        private void getScripts(Type t, string location)
        {
            ScriptMarshal s     = null;
            var           sattr = t.GetCustomAttribute <ScriptAttribute>(true);

            if (sattr != null)
            {
                s       = new ScriptMarshal();
                s.Steps = new List <StepMarshal>();

                s.Name        = sattr.Name;
                s.Description = sattr.Description;
                s.HelpLink    = sattr.HelpLink;
                s.Location    = location;
                s.TargetClass = t.FullName;

                foreach (var m in t.GetMethods())
                {
                    var stepAttr = m.GetCustomAttribute <StepAttribute>(true);
                    if (stepAttr != null)
                    {
                        StepMarshal step = new StepMarshal();
                        step.Id          = stepAttr.Id;
                        step.Name        = stepAttr.Name;
                        step.Description = stepAttr.Description;
                        s.Steps.Add(step);
                    }
                }
                var dataType = t.BaseType.GetGenericArguments().First();
                s.Types = new List <InputDataMarshal>();
                s.Types.AddRange(getDataTypes(dataType));
                _scripts.Add(s);
            }
        }
Example #2
0
        private ScriptMarshal getScripts(Type t)
        {
            ScriptMarshal s = null;

            var attrs = t.GetCustomAttributes();
            var sattr = t.GetCustomAttribute <ScriptAttribute>(true);

            if (sattr != null)
            {
                s       = new ScriptMarshal();
                s.Steps = new List <StepMarshal>();

                s.Name        = sattr.Name;
                s.Description = sattr.Description;
                s.HelpLink    = sattr.HelpLink;

                foreach (var m in t.GetMethods())
                {
                    var stepAttr = m.GetCustomAttribute <StepAttribute>(true);
                    if (stepAttr != null)
                    {
                        StepMarshal step = new StepMarshal();
                        step.Id          = stepAttr.Id;
                        step.Name        = stepAttr.Name;
                        step.Description = stepAttr.Description;
                        s.Steps.Add(step);
                    }
                }

                var dataType = Type.GetType(sattr.InputDataType);

                s.Types = new List <InputDataMarshal>();

                foreach (var prop in dataType.GetProperties().Where(p => p.PropertyType == typeof(string) || p.PropertyType.IsPrimitive))
                {
                    s.Types.Add(new InputDataMarshal()
                    {
                        Name = prop.Name, Type = prop.PropertyType.FullName
                    });
                }
            }



            return(s);
        }