예제 #1
0
파일: DBRunner.cs 프로젝트: AYCHErp/Pgdoc
        private static void BuildDocumentation(string content, IEnumerable <string> matches)
        {
            PGDatabase database = DbProcessor.GetDatabase();

            content = content.Replace("[DBName]", Program.Database.ToUpperInvariant());
            content = content.Replace("[DBComment]", database.Comment);

            foreach (string match in matches)
            {
                string comment = HtmlHelper.RemoveComment(match);

                if (!comment.StartsWith("PostgreSQLDatabase"))
                {
                    continue;
                }

                comment = comment.Replace("PostgreSQLDatabase", "");

                StringBuilder items = new StringBuilder();

                foreach (PGDatabase.PGDatabaseSetting setting in database.Settings)
                {
                    items.Append(comment.Replace("[Name]", setting.Name)
                                 .Replace("[Setting]", setting.Setting)
                                 .Replace("[Description]", setting.Description));
                }

                content = content.Replace(match, items.ToString());
            }

            FileHelper.WriteFile(content, OutputPath);
            Console.WriteLine("Writing schemas.");
            SchemasRunner.Run();
        }