Ejemplo n.º 1
0
        private string GenerateHstCIncludes(ControllerModel c)
        {
            var sb = new StringBuilder();

            sb.AppendLine("#include \"halfstar.c\"");
            sb.AppendLine("#include \"tx_synch.h\"");
            if (c.OVData.OVIngreepType != OVIngreepTypeEnum.Geen && c.HasPTorHD())
            {
                sb.AppendLine("#include \"halfstar_ov.c\"");
            }
            sb.AppendLine();
            sb.AppendLine($"#include \"{c.Data.Naam}hst.add\"");
            sb.AppendLine();

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        private string GenerateRegelingC(ControllerModel c)
        {
            var sb = new StringBuilder();

            sb.AppendLine("/* Compileerbestand */");
            sb.AppendLine("/* ---------------- */");
            sb.AppendLine();
            sb.Append(GenerateFileHeader(c.Data, "regeling.c"));
            sb.AppendLine();
            sb.Append(GenerateVersionHeader(c.Data));
            sb.AppendLine();
            sb.AppendLine("/* Functionaliteiten regeling:");
            sb.AppendLine($"{ts}RIS: {(c.RISData.RISToepassen ? "ja" : "nee")}");
            sb.AppendLine($"{ts}PTP: {(c.PTPData.PTPKoppelingen.Any() ? "ja" : "nee")}");
            sb.AppendLine($"{ts}Intergroen: {(c.Data.Intergroen ? "ja" : "nee")}");
            sb.AppendLine("*/");
            sb.AppendLine();
            sb.AppendLine("#ifndef AUTOMAAT");
            sb.AppendLine($"{ts}#pragma region CCOL library dependencies");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolreg.lib\")");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolsim.lib\")");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"lwmlfunc.lib\")");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"stdfunc.lib\")");
            if (c.Data.CCOLVersie <= CCOLVersieEnum.CCOL8 && c.Data.VLOGType != VLOGTypeEnum.Geen ||
                c.Data.CCOLVersie >= CCOLVersieEnum.CCOL9 && c.Data.VLOGSettings.VLOGToepassen)
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolvlog.lib\")");
            }
            if (c.HasDSI())
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"dsifunc.lib\")");
            }
            if (c.PTPData.PTPKoppelingen.Any())
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolks.lib\")");
            }
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolmain.lib\")");
            if (c.HalfstarData.IsHalfstar)
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"plfunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"plefunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"tx_synch.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"{(c.Data.CCOLVersie >= CCOLVersieEnum.CCOL95 && c.Data.Intergroen ? "trigfunc.lib" : "tigfunc.lib")}\")");
            }
            if (c.RISData.RISToepassen)
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"risfunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"rissimfunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"comctl32.lib\")");
                if (c.Data.CCOLVersie > CCOLVersieEnum.CCOL8)
                {
                    sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"htmlhelp.lib\")");
                }
                sb.AppendLine($"{ts}{ts}/* Voor Visual 2017 en hoger: haal onderstaande regel uit het commentaar */");
                sb.AppendLine($"{ts}{ts}/* #pragma comment(lib, \"legacy_stdio_definitions.lib\") */");
            }
            sb.AppendLine($"{ts}#pragma endregion");
            sb.AppendLine("#endif");
            sb.AppendLine();
            sb.AppendLine("#ifndef CCOLTIG     /* Intergroentijden worden toegepast */");
            sb.AppendLine($"{ts}#define CCOLTIG");
            sb.AppendLine("#endif");
            sb.AppendLine();
            if (c.PTPData.PTPKoppelingen.Any())
            {
                sb.AppendLine($"#include \"PTPWIN.C\"");
            }
            sb.AppendLine($"#include \"{c.Data.Naam}sys.h\"");
            sb.AppendLine($"#include \"{c.Data.Naam}reg.c\"");
            if (c.HasPTorHD())
            {
                sb.AppendLine($"#include \"{c.Data.Naam}prio.c\"");
            }
            sb.AppendLine($"#include \"{c.Data.Naam}tab.c\"");
            if (c.Data.SynchronisatiesType == SynchronisatiesTypeEnum.SyncFunc &&
                (c.InterSignaalGroep.Gelijkstarten.Any() || c.InterSignaalGroep.Voorstarten.Any()))
            {
                sb.AppendLine("#include \"syncfunc.c\"");
            }
            sb.AppendLine("#ifndef AUTOMAAT");
            if (!c.Data.NietGebruikenBitmap)
            {
                sb.AppendLine($"{ts}#include \"{c.Data.Naam}dpl.c\"");
            }
            sb.AppendLine($"{ts}#include \"{c.Data.Naam}sim.c\"");
            if (c.RISData.RISToepassen)
            {
                sb.AppendLine($"{ts}#include \"{c.Data.Naam}rissim.c\"");
            }

            sb.AppendLine("#endif");

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public static void GenerateSpecification(string filename, ControllerModel c, SpecificatorDataModel model)
        {
            using (var doc = WordprocessingDocument.Open(filename, true))
            {
                // Add a main document part.
                Body body = doc.MainDocumentPart.Document.Body;
                body.RemoveAllChildren <Paragraph>();

                //var gensWithElems = CCOLGenerator.GetAllGeneratorsWithElements(c);

                // Headers, title page, versioning
                FunctionalityGenerator.AddHeaderTextsToDocument(doc, model, c.Data);
                body.Append(FunctionalityGenerator.GetFirstPage(c.Data));
                body.Append(FunctionalityGenerator.GetVersionControl(c.Data));


                // Chap 1: Introduction
                FunctionalityGenerator.GetIntroChapter(doc, c, model);

                // Chap 2: Structuur en afwikkeling
                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_StructuurEnAfwikkeling"]}", 1));
                body.Append(FunctionalityGenerator.GetChapter_StructureIntroduction(c));
                body.Append(FunctionalityGenerator.GetChapter_Perioden(c));
                body.Append(FunctionalityGenerator.GetChapter_SignaalGroepAfhandeling(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_SignaalGroepInstellingen(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_Groentijden(c));
                body.Append(FunctionalityGenerator.GetChapter_Modulestructuur(doc, c));

                // Chap 3: Detectoren
                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Detectoren"]}", 1));
                body.Append(FunctionalityGenerator.GetChapter_DetectieConfiguratie(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_DetectieInstellingen(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_DetectieRichtingGevoelig(c));
                body.Append(FunctionalityGenerator.GetChapter_DetectieStoring(doc, c));

                // Chap 4: Intersignaalgroep
                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Intersignaalgroep"]}", 1));
                body.Append(FunctionalityGenerator.GetChapter_Ontruimingstijden(c));
                body.Append(FunctionalityGenerator.GetChapter_OntruimingstijdenGarantie(c));
                body.Append(FunctionalityGenerator.GetChapter_Synchronisaties(c, doc));

                if (c.OVData.OVIngreepType != Models.Enumerations.OVIngreepTypeEnum.Geen && c.HasPTorHD())
                {
                    if (c.HasPT() && c.HasHD())
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_OVHD"]}", 1));
                        body.Append(FunctionalityGenerator.GetChapter_OVHDIntro(c));
                    }
                    if (c.HasPT())
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_OV"]}", c.HasHD() ? 2 : 1));
                        body.Append(FunctionalityGenerator.GetChapter_OV(c, doc, c.HasHD() ? 2 : 1));
                    }
                    if (c.HasHD())
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_HD"]}", c.HasPT() ? 2 : 1));
                        body.Append(FunctionalityGenerator.GetChapter_HD(c, doc, c.HasHD() ? 2 : 1));
                    }
                }

                if (c.HalfstarData.IsHalfstar)
                {
                    body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Halfstar"]}", 1));
                    body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Hoofdstuk inzake halfstar regelen.", "TODO")));
                }

                if (model.SpecialsParagrafen.Any())
                {
                    body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Specials"]}", 1));
                    foreach (var par in model.SpecialsParagrafen)
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph(par.Titel, 2));
                        foreach (var parpar in par.Text.Split('\n'))
                        {
                            if (!string.IsNullOrWhiteSpace(parpar))
                            {
                                body.Append(OpenXmlHelper.GetTextParagraph(parpar));
                            }
                        }
                    }
                }

                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"TODO", 1));
                body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Hoofdstuk OV: details toevoegen, zoals: " +
                                                            $"lijnnummers, details rond in/uitmelden, inmelden koplus, .", "TODO")));
                body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Overige punten, zoals: PTP, VA ontruimen, file ingrepen, rateltikkers, " +
                                                            $"ingangen, selectieve detectie, uitgestelde vaste aanvragen, hard meeverlengen, veiligheidsgroen, RoBuGrover, special van plugins zoals AFM, etc.", "TODO")));
                body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Opnemen verwijzingen naar CCOL benaming van instellingen (?).", "TODO")));

                // TODO: signaalplannen

                // dan: afhandeling signaalgroepen (nalopen, gelijkstarten, etc)
                // tabel functies hiernaartoe verplaatsen (?)

                // dan: OV, HD

                // dan: overig: fixatie -> onderbrengen in H1 (intro) bij algemene instellingen

                //body.Append(FunctionalityGenerator.GetModulenChapter(doc, c));

                doc.Close();
                //foreach (var g in gensWithElems)
                //{
                //    if (g.Item2.Any())
                //    {
                //        AddChapterTitle(doc, $"{g.Item1.GetType().Name.ToString()}", 2);
                //        AddSettingsTable(doc, g.Item2);
                //    }
                //}
            }
        }