Beispiel #1
0
 public void Generate(CfgSystem system)
 {
     foreach (ICfgOutput output in Outputs)
     {
         output.Generate(system);
     }
 }
Beispiel #2
0
        public void Generate(CfgSystem system)
        {
            this.system = system;

            bool outputFolderOk = checkAndConfirmOutputFolder(Settings.OutputPath);

            if (outputFolderOk)
            {
                doGenerate();
            }
        }
Beispiel #3
0
        public void Generate(CfgSystem system)
        {
            Visio.Application visio = new Visio.Application();
            Visio.Document    doc   = visio.Documents.Add("");
            Visio.Page        page  = doc.Pages[1];
            page.Name = "Architecture";

            // Open with flags Visio.VisOpenSaveArgs.visOpenRO | Visio.VisOpenSaveArgs.visOpenDocked.
            Visio.Document stencil      = visio.Documents.OpenEx(Settings.StencilName, 0x2 | 0x4);
            Visio.Master   serverMaster = stencil.Masters["Server"];

            double paperHeight = doc.get_PaperHeight(Visio.VisUnitCodes.visInches);
            double paperWidth  = doc.get_PaperWidth(Visio.VisUnitCodes.visInches);

            int    numColumns       = 2;
            int    numRows          = (system.Hosts.Count + (numColumns - 1)) / numColumns;
            double verticalGap      = paperHeight / numRows;
            double horizontalGap    = paperWidth / numColumns;
            double verticalMargin   = verticalGap / 2;
            double horizontalMargin = horizontalGap / 2;

            double verticalPosition   = verticalMargin;
            double horizontalPosition = horizontalMargin;
            int    verticalIndex      = 1;
            int    horizontalIndex    = 1;

            foreach (CfgHost host in system.Hosts)
            {
                Visio.Shape shape = page.Drop(serverMaster, horizontalPosition, verticalPosition);
                modifyShapeText(shape, host);

                if (verticalIndex == numRows)
                {
                    verticalIndex       = 1;
                    verticalPosition    = verticalMargin;
                    horizontalIndex    += 1;
                    horizontalPosition += horizontalGap;
                }
                else
                {
                    verticalIndex    += 1;
                    verticalPosition += verticalGap;
                }
            }
        }
Beispiel #4
0
        public CfgSystem GetSystemConfiguration(ILog log)
        {
            ExportFileParser parser = new ExportFileParser();

            parser.ExportReader = ExportReader;
            parser.RowParsed   +=
                new ExportFileParser.RowParsedDelegate(parser_RowParsed);
            parser.InfoParsed +=
                new ExportFileParser.InfoParsedDelegate(parser_InfoParsed);
            parser.Log = log;

            cfgDb = new DatabaseContents();
            parser.parse();
            cfgDb.ResolveReferences();
            CfgSystem result =
                new CfgSystem(
                    new DefaultCfgObjectDecorator(
                        new ExportFileCfgSystem(cfgDb)));

            return(result);
        }
 public void Generate(CfgSystem system)
 {
     indent = 0;
     w("System:");
     writeObject(system, 2);
 }
Beispiel #6
0
        public void Generate(CfgSystem system)
        {
            createFile(FilePath, CfgDoc.Properties.Resources.WordRunBookTemplate);

            word         = new Word.Application();
            word.Visible = true;
            doc          = wordOpen(FilePath);

            ICollection <CfgHost> hosts = system.Hosts;

            string[] headers;
            string[] queries;

            wordGotoBookmark("HostsList");

            headers = new string[] {
                "DBID", "Name", "IP Address", "OS", "OS version", "LCA Port"
            };
            queries = new string[] {
                "dbid", "name", "ip_address", "(enum)os_type", "os_version", "lca_port"
            };

            wordAddCfgObjectTable(queries, headers, system.Hosts);

            wordGotoBookmark("ServersList");

            headers = new string[] {
                "Host name", "App name"
            };
            queries = new string[] {
                "host_dbid.name", "app_dbid.name"
            };

            wordAddCfgObjectTable(queries, headers, system.Servers);

            wordGotoBookmark("DapsList");

            headers = new string[] {
                "Host name", "App name"
            };
            queries = new string[] {
                "host_dbid.name", "app_dbid.name"
            };

            wordAddCfgObjectTable(queries, headers, system.Servers);

            wordGotoBookmark("DNsList");

            foreach (var switch_ in system.Switches)
            {
                wordSetStyleHeading(2);
                word.Selection.TypeText(switch_.Name);
                word.Selection.TypeParagraph();

                headers = new string[] {
                    "Number", "Type", "Annex options"
                };
                queries = new string[] {
                    "number_", "(enum)type", "(flexprops)cfg_flex_prop_DN"
                };

                wordAddCfgObjectTable(queries, headers, switch_.DNs);

                word.Selection.Move(Word.WdUnits.wdLine, 2);
            }

            wordGotoBookmark("TenantsList");

            foreach (var tenant in system.Tenants)
            {
                wordSetStyleHeading(2);
                word.Selection.TypeText(tenant.Name);
                word.Selection.TypeParagraph();

                wordSetStyleNormal();
                word.Selection.TypeText((string)CfgObjectUtil.Query(tenant, "(flexprops)cfg_flex_prop_Tenant"));
            }

            wordGotoBookmark("ServerOptions");

            foreach (CfgHost host in system.Hosts)
            {
                wordSetStyleHeading(2);
                word.Selection.TypeText(host.Name);
                word.Selection.TypeParagraph();

                foreach (CfgServer server in host.Servers)
                {
                    wordSetStyleHeading(3);
                    word.Selection.TypeText(server.Application.Name);
                    word.Selection.TypeParagraph();

                    wordSetStyleHeading(4);
                    word.Selection.TypeText("Options");
                    word.Selection.TypeParagraph();

                    wordSetStyleNormal();
                    word.Selection.TypeText(CfgObjectUtil.OptionsToString(server.Application.Options));

                    if (server.Application.FlexProperties.Count != 0)
                    {
                        wordSetStyleHeading(4);
                        word.Selection.TypeText("Annex options");
                        word.Selection.TypeParagraph();

                        wordSetStyleNormal();
                        word.Selection.TypeText(CfgObjectUtil.FlexPropsToString(server.Application.FlexProperties));
                    }
                }
            }

            wordGotoEnd();
        }