Beispiel #1
0
        public static IMain Map(PickAspect aspect)
        {
            switch (aspect)
            {
            case PickAspect.SequenceGen:
                return(new SequenceGen.Start());

            case PickAspect.AltMat:
                return(new AltMath.Start());

            case PickAspect.PrimeGen:
                return(new PrimeGen.Start());

            case PickAspect.Factors:
                return(new Factors.Start());
            }
            return(null);
        }
Beispiel #2
0
        public static void Usage(PickAspect aspect = PickAspect.None)
        {
            StringBuilder sb   = new StringBuilder();
            string        name = nameof(MathVenture);

            sb
            .WL(0, $"Usage {name} (aspect) [options]")
            .WL(0, "Options:")
            .WL(1, "-h / --help", "Show full help")
            .WL(1, "(aspect) -h", "Aspect specific help")
            .WL(1, "--aspects", "List possible aspects")
            ;

            if (ShowFullHelp)
            {
                foreach (PickAspect a in Aids.EnumAll <PickAspect>())
                {
                    IMain func = Registry.Map(a);
                    func.Usage(sb);
                }
            }
            else if (aspect != PickAspect.None)
            {
                IMain func = Registry.Map(aspect);
                func.Usage(sb);
            }
            else
            {
                if (ShowHelpAspects)
                {
                    sb
                    .WL()
                    .WL(0, "Aspects:")
                    .PrintEnum <PickAspect>(1)
                    ;
                }
            }

            Log.Message(sb.ToString());
        }
Beispiel #3
0
 public static string AspectName(PickAspect a)
 {
     return(((int)a).ToString() + ". " + a.ToString());
 }