Example #1
0
        private static IBlock BuildOptionInfo(Option option)
        {
            Section result = new Section(
                new Header(option.Documentation?.Title ?? option.GetMainRepresentation()));
            ISpanBuilder content = new SpanBuilder();

            foreach (string representation in option.Representations)
            {
                using (content.StartStrongContext())
                {
                    string optionInput = representation.Length > 2
                        ? $"--{representation}"
                        : $"-{representation}";

                    content.Link(optionInput, ActionBuilder.InputAddUri(optionInput));
                }

                content.WriteLine();
            }

            result = result.AddChild(new Paragraph(content.Span));

            if (!string.IsNullOrEmpty(option.Documentation?.Description))
            {
                result = result.AddChild(new Paragraph(option.Documentation.Description));
            }

            if (option.Parameters.Count > 0)
            {
                result = result.AddChild(BuildParametersSection(option));
            }

            return(result);
        }
Example #2
0
        public FilesConfig(Section parent)
        {
            Section = parent.AddChild("Files");

            AUDIOHEAD =
                Section.AddVariable("AUDIOHEAD").Set(@"DATA\AUDIOHEAD.WL1");

            AUDIOT =
                Section.AddVariable("AUDIOT").Set(@"DATA\AUDIOT.WL1");

            CONFIG =
                Section.AddVariable("CONFIG").Set(@"DATA\CONFIG.WL1");

            VGAHEAD =
                Section.AddVariable("VGAHEAD").Set(@"DATA\VGAHEAD.WL1");

            VGADICT =
                Section.AddVariable("VGADICT").Set(@"DATA\VGADICT.WL1");

            VGAGRAPH =
                Section.AddVariable("VGAGRAPH").Set(@"DATA\VGAGRAPH.WL1");

            VSWAP =
                Section.AddVariable("VSWAP").Set(@"DATA\VSWAP.WL1");

            MAPHEAD =
                Section.AddVariable("MAPHEAD").Set(@"DATA\MAPHEAD.WL1");

            GAMEMAPS =
                Section.AddVariable("GAMEMAPS").Set(@"DATA\GAMEMAPS.WL1");

            WOLFPAL =
                Section.AddVariable("WOLFPAL").Set(@"DATA\WOLFPAL.INC");
        }
Example #3
0
        public DemonstrationSection(Section parent)
        {
            Section = parent.AddChild("Demonstration");

            TestVariable =
                Section.AddVariable("TestVariable").Set("Hello World!");
        }
Example #4
0
        private static IBlock BuildParametersSection(InputStatement statement)
        {
            Section result = new Section(new Header("Parameters"));

            foreach (Parameter parameter in statement.Parameters)
            {
                result = result.AddChild(BuildParameterInfo(parameter));
            }

            return(result);
        }
Example #5
0
        private static IBlock BuildOptionsSection(Query query)
        {
            Section result = new Section(new Header("Options"));

            foreach (Option option in query.Options.OrderBy(o => o.Key))
            {
                result = result.AddChild(BuildOptionInfo(option));
            }

            return(result);
        }
Example #6
0
        private static IBlock BuildQueriesSection(Query query, string input)
        {
            Section result = new Section(new Header("Sub-Commands"));

            foreach (Query subQuery in query.Queries.OrderBy(q => q.Key))
            {
                result = result.AddChild(BuildQueryInfo(subQuery, input, false));
            }

            return(result);
        }
Example #7
0
        private static IBlock BuildParameterInfo(Parameter parameter)
        {
            Section result = new Section(
                new Header(parameter.Documentation.Title ?? parameter.Key));

            if (!string.IsNullOrEmpty(parameter.ArgumentTemplate))
            {
                result = result.AddChild(new Paragraph(
                                             SpanBuilder.Create()
                                             .Write("Regular expression: ")
                                             .Italic($"/{parameter.ArgumentTemplate}/")));
            }

            if (!string.IsNullOrEmpty(parameter.Documentation?.Description))
            {
                result = result.AddChild(new Paragraph(parameter.Documentation.Description));
            }

            return(result);
        }
Example #8
0
        private static IBlock BuildQueryInfo(Query query, string input, bool listChildren)
        {
            input += " " + query.GetMainRepresentation();
            input  = input.Trim();

            Section result = new Section(
                new Header(query.Documentation?.Title ?? query.GetMainRepresentation()),
                new Paragraph(
                    new Model.Text.Link(input, ActionBuilder.CommandRunUri($"help info {input}"))));

            if (!string.IsNullOrEmpty(query.Documentation?.Description))
            {
                result = result.AddChild(new Paragraph(query.Documentation.Description));
            }

            if (!listChildren)
            {
                return(result);
            }

            if (query.Queries.Count > 0)
            {
                result = result.AddChild(BuildQueriesSection(query, input));
            }

            if (query.Options.Count > 0)
            {
                result = result.AddChild(BuildOptionsSection(query));
            }

            if (query.Parameters.Count > 0)
            {
                result = result.AddChild(BuildParametersSection(query));
            }

            return(result);
        }
Example #9
0
        public AssetsConfig(Section parent)
        {
            Section = parent.AddChild("Assets");

            wolfread.VGAGRAPH.Definitions defs =
                wolfread.VGAGRAPH.Definitions.ForWL1();

            TEXTUREWIDTH =
                Section.AddVariable(nameof(TEXTUREWIDTH)).Set(64);
            TEXTUREHEIGHT =
                Section.AddVariable(nameof(TEXTUREHEIGHT)).Set(64);
            SPRITEWIDTH =
                Section.AddVariable(nameof(SPRITEWIDTH)).Set(64);
            SPRITEHEIGHT =
                Section.AddVariable(nameof(SPRITEHEIGHT)).Set(64);
            NUMMAPS =
                Section.AddVariable(nameof(NUMMAPS)).Set(100);
            BLOCK =
                Section.AddVariable(nameof(BLOCK)).Set(defs.BLOCK);
            MASKBLOCK =
                Section.AddVariable(nameof(MASKBLOCK)).Set(defs.MASKBLOCK);
            NUMCHUNKS =
                Section.AddVariable(nameof(NUMCHUNKS)).Set(defs.NUMCHUNKS);
            NUMFONT =
                Section.AddVariable(nameof(NUMFONT)).Set(defs.NUMFONT);
            NUMFONTM =
                Section.AddVariable(nameof(NUMFONTM)).Set(defs.NUMFONTM);
            NUMPICS =
                Section.AddVariable(nameof(NUMPICS)).Set(defs.NUMPICS);
            NUMPICM =
                Section.AddVariable(nameof(NUMPICM)).Set(defs.NUMPICM);
            NUMSPRITES =
                Section.AddVariable(nameof(NUMSPRITES)).Set(defs.NUMSPRITES);
            NUMTILE8 =
                Section.AddVariable(nameof(NUMTILE8)).Set(defs.NUMTILE8);
            NUMTILE8M =
                Section.AddVariable(nameof(NUMTILE8M)).Set(defs.NUMTILE8M);
            NUMTILE16 =
                Section.AddVariable(nameof(NUMTILE16)).Set(defs.NUMTILE16);
            NUMTILE16M =
                Section.AddVariable(nameof(NUMTILE16M)).Set(defs.NUMTILE16M);
            NUMTILE32 =
                Section.AddVariable(nameof(NUMTILE32)).Set(defs.NUMTILE32);
            NUMTILE32M =
                Section.AddVariable(nameof(NUMTILE32M)).Set(defs.NUMTILE32M);
            NUMEXTERNS =
                Section.AddVariable(nameof(NUMEXTERNS)).Set(defs.NUMEXTERNS);
            STRUCTPIC =
                Section.AddVariable(nameof(STRUCTPIC)).Set(defs.STRUCTPIC);
            STARTFONT =
                Section.AddVariable(nameof(STARTFONT)).Set(defs.STARTFONT);
            STARTFONTM =
                Section.AddVariable(nameof(STARTFONTM)).Set(defs.STARTFONTM);
            STARTPICS =
                Section.AddVariable(nameof(STARTPICS)).Set(defs.STARTPICS);
            STARTPICM =
                Section.AddVariable(nameof(STARTPICM)).Set(defs.STARTPICM);
            STARTSPRITES =
                Section.AddVariable(nameof(STARTSPRITES)).Set(defs.STARTSPRITES);
            STARTTILE8 =
                Section.AddVariable(nameof(STARTTILE8)).Set(defs.STARTTILE8);
            STARTTILE8M =
                Section.AddVariable(nameof(STARTTILE8M)).Set(defs.STARTTILE8M);
            STARTTILE16 =
                Section.AddVariable(nameof(STARTTILE16)).Set(defs.STARTTILE16);
            STARTTILE16M =
                Section.AddVariable(nameof(STARTTILE16M)).Set(defs.STARTTILE16M);
            STARTTILE32 =
                Section.AddVariable(nameof(STARTTILE32)).Set(defs.STARTTILE32);
            STARTTILE32M =
                Section.AddVariable(nameof(STARTTILE32M)).Set(defs.STARTTILE32M);
            STARTEXTERNS =
                Section.AddVariable(nameof(STARTEXTERNS)).Set(defs.STARTEXTERNS);
        }