Example #1
0
        public void Visit(IArgumentVisitor visitor)
        {
            Type propertyType = _property.PropertyType;

            // Ignore indexer properties
            if (_property.GetIndexParameters().Length > 0)
            {
                return;
            }

            if (propertyType.IsPrimitive())
            {
                visitor.PrimitiveSetter(_property, IsMandatory);
            }
            if (propertyType.IsChild())
            {
                visitor.ChildSetter(_property, IsMandatory);
            }
            if (propertyType.IsChildArray())
            {
                visitor.ChildArraySetter(_property, IsMandatory);
            }
            if (propertyType.IsEnum)
            {
                visitor.EnumSetter(_property, IsMandatory);
            }
            if (propertyType.IsString())
            {
                visitor.StringSetter(_property, IsMandatory);
            }
        }
 public void Visit(IArgumentVisitor visitor)
 {
     foreach (SetterProperty setter in this)
     {
         setter.Visit(visitor);
     }
 }
 public void Visit(IArgumentVisitor visitor)
 {
     try
     {
         foreach (ParameterInfo info in _ctor.GetParameters())
         {
             try
             {
                 Type parameterType = info.ParameterType;
                 visitParameter(info, parameterType, visitor);
             }
             catch (Exception e)
             {
                 string message =
                     "Trying to visit parameter {0} of type {1} in the constructor for {2}"
                     .ToFormat(info.Name, info.ParameterType, _pluggedType.AssemblyQualifiedName);
                 throw new ApplicationException(message, e);
             }
         }
     }
     catch (Exception e)
     {
         string message = "Failed while trying to visit the constructor for " +
                          _pluggedType.AssemblyQualifiedName;
         throw new ApplicationException(message, e);
     }
 }
Example #4
0
        private static void PrintFullUsage(string program, IArgumentCollection settings)
        {
            IArgumentVisitor argVisitor = ArgumentVisitorFactory.CreateArgumentVisitor(true);

            settings.Accept(argVisitor);

            Console.WriteLine(argVisitor.GetUsage(program));
        }
        public void Visit(IArgumentVisitor visitor)
        {
            Type propertyType = _property.PropertyType;

            // Ignore indexer properties
            if (_property.GetIndexParameters().Length > 0) return;

            if (propertyType.IsPrimitive()) visitor.PrimitiveSetter(_property, IsMandatory);
            if (propertyType.IsChild()) visitor.ChildSetter(_property, IsMandatory);
            if (propertyType.IsChildArray()) visitor.ChildArraySetter(_property, IsMandatory);
            if (propertyType.IsEnum) visitor.EnumSetter(_property, IsMandatory);
            if (propertyType.IsString()) visitor.StringSetter(_property, IsMandatory);
        }
 private void visitParameter(ParameterInfo info, Type parameterType, IArgumentVisitor visitor)
 {
     if (parameterType.IsPrimitive())
     {
         visitor.PrimitiveParameter(info);
     }
     if (parameterType.IsChild())
     {
         visitor.ChildParameter(info);
     }
     if (parameterType.IsChildArray())
     {
         visitor.ChildArrayParameter(info);
     }
     if (parameterType.IsEnum)
     {
         visitor.EnumParameter(info);
     }
     if (parameterType.IsString())
     {
         visitor.StringParameter(info);
     }
 }
Example #7
0
 public void Accept(IArgumentVisitor visitor)
 {
     visitor.VisitArgument(this);
 }
Example #8
0
 private void visitParameter(ParameterInfo info, Type parameterType, IArgumentVisitor visitor)
 {
     if (parameterType.IsPrimitive()) visitor.PrimitiveParameter(info);
     if (parameterType.IsChild()) visitor.ChildParameter(info);
     if (parameterType.IsChildArray()) visitor.ChildArrayParameter(info);
     if (parameterType.IsEnum) visitor.EnumParameter(info);
     if (parameterType.IsString()) visitor.StringParameter(info);
 }
Example #9
0
 public void Visit(IArgumentVisitor visitor)
 {
     try
     {
         foreach (ParameterInfo info in _ctor.GetParameters())
         {
             try
             {
                 Type parameterType = info.ParameterType;
                 visitParameter(info, parameterType, visitor);
             }
             catch (Exception e)
             {
                 string message =
                     "Trying to visit parameter {0} of type {1} in the constructor for {2}"
                         .ToFormat(info.Name, info.ParameterType, _pluggedType.AssemblyQualifiedName);
                 throw new ApplicationException(message, e);
             }
         }
     }
     catch (Exception e)
     {
         string message = "Failed while trying to visit the constructor for " +
                          _pluggedType.AssemblyQualifiedName;
         throw new ApplicationException(message, e);
     }
 }
Example #10
0
 T IArgument.Accept <T>(IArgumentVisitor <T> visitor)
 {
     return(visitor.Visit(this));
 }
Example #11
0
 public void Accept(IArgumentVisitor argVisitor)
 {
     _arguments.ForEach(a => a.Accept(argVisitor));
 }
Example #12
0
 public void VisitSetters(IArgumentVisitor arguments)
 {
     _setters.Visit(arguments);
 }
Example #13
0
 public void VisitConstructor(IArgumentVisitor arguments)
 {
     _constructor.Visit(arguments);
 }
Example #14
0
 public void VisitArguments(IArgumentVisitor visitor)
 {
     _constructor.Visit(visitor);
     _setters.Visit(visitor);
 }