Esempio n. 1
0
 private static void PrintOutput(System.IO.TextWriter writer, string caption)
 {
     Console.WriteLine("==============================");
     Console.WriteLine(caption);
     Console.WriteLine("==============================");
     Console.WriteLine(writer.ToString());
 }
Esempio n. 2
0
 protected void Initialize()
 {
     KmlFramework framework = new KmlFramework("aaa");
     writer = new StringWriter();
     XmlWriter xmlWriter = framework.GenerateWriter(writer);
     xmlWriter.Close();
     reader = new StringReader(writer.ToString());
 }
 public override int Run(TextWriter consoleOutput, CancellationToken cancellationToken)
 {
     int runResult;
     CompilerServerLogger.Log("****Running VB compiler...");
     runResult = base.Run(consoleOutput, cancellationToken);
     CompilerServerLogger.Log("****VB Compilation complete.\r\n****Return code: {0}\r\n****Output:\r\n{1}\r\n", runResult, consoleOutput.ToString());
     return runResult;
 }
 internal void ExecuteInternal() {
     // See comments in GetSafeExecuteStartPageThunk().
     _safeExecuteStartPageThunk(() => {
         Output = new StringWriter(CultureInfo.InvariantCulture);
         Execute();
         Markup = new HtmlString(Output.ToString());
     });
 }
Esempio n. 5
0
        /// <summary>
        /// Generates output using the specified writer and output strategy.
        /// </summary>
        /// <param name="writer">The writer that should be used to generate the output.</param>
        /// <param name="outputStrategy">The output strategy that should be used to generate the output.</param>
        /// <returns>The output of a benchmark.</returns>
        public string Generate(TextWriter writer, IOutputStrategy outputStrategy)
        {
            Ensure.NotNull(writer, "writer");
            Ensure.NotNull(outputStrategy, "outputStrategy");

            builder.ToCustom(writer).AsCustom(outputStrategy);
            return writer.ToString();
        }
Esempio n. 6
0
 public string WriteToString(JSONNode pNode)
 {
     using (textWriter = new StringWriter())
     {
         WriteToStream(pNode, textWriter);
         return textWriter.ToString();
     }
 }
Esempio n. 7
0
        public override int Run(TextWriter consoleOutput, CancellationToken cancellationToken = default(CancellationToken))
        {
            int returnCode;

            CompilerServerLogger.Log("****Running C# compiler...");
            returnCode = base.Run(consoleOutput, cancellationToken);
            CompilerServerLogger.Log("****C# Compilation complete.\r\n****Return code: {0}\r\n****Output:\r\n{1}\r\n", returnCode, consoleOutput.ToString());
            return returnCode;
        }
Esempio n. 8
0
 public static IHtmlString ContextInfo(TextWriter writer)
 {
     var res = new StringBuilder();
     res.AppendLine("<pre style='margin:10px'>");
     res.AppendLine("TextWriter");
     res.AppendLine("Type: {0}", writer.GetType().Name);
     res.AppendLine("TextWriter.GetHashCode:{0}", writer.GetHashCode());
     res.AppendLine("TextWriter.ToString:{0}", writer.ToString());
     res.AppendLine("</pre>");
     return new MvcHtmlString(res.ToString());
 }
Esempio n. 9
0
 public string MinifyToString(string src)
 {
     using(sr = new StreamReader(src))
     {
         using(sw = new StringWriter())
         {
             jsmin();
             return sw.ToString();
         }
     }
 }
Esempio n. 10
0
 //static void Main(string[] args)
 //{
 //    if (args.Length != 2)
 //    {
 //        Console.WriteLine("invalid arguments, 2 required, 1 in, 1 out");
 //        return;
 //    }
 //    new JavaScriptMinifier().Minify(args[0], args[1]);
 //}
 public string Minify(string src)
 {
     using (sr = new StringReader(src))
     {
         using (sw = new StringWriter())
         {
             jsmin();
             return sw.ToString(); // return the minified string
         }
     }
 }
		public override string ToString() {
			m_Text = m_ScriptPrescription.m_Template;
			m_Writer = new StringWriter();
			m_Writer.NewLine = "\n";
			
			// Make sure all line endings are Unix (Mac OS X) format
			m_Text = Regex.Replace(m_Text, @"\r\n?", delegate(Match m) {
				return "\n";
			});
			
			// Class Name
			m_Text = m_Text.Replace("$ClassName", ClassName);
			m_Text = m_Text.Replace("$NicifiedClassName", ObjectNames.NicifyVariableName(ClassName));
			
			// Other replacements
			foreach (KeyValuePair<string, string> kvp in m_ScriptPrescription.m_StringReplacements) m_Text = m_Text.Replace(kvp.Key, kvp.Value);
			
			// Functions
			// Find $Functions keyword including leading tabs
			Match match = Regex.Match(m_Text, @"(\t*)\$Functions");
			if (match.Success) {
				// Set indent level to number of tabs before $Functions keyword
				IndentLevel = match.Groups[1].Value.Length;
				bool hasFunctions = false;
				if (m_ScriptPrescription.m_Functions != null) {
					foreach (var function in m_ScriptPrescription.m_Functions.Where (f => f.include)) {
						WriteFunction(function);
						WriteBlankLine();
						hasFunctions = true;
					}
					
					// Replace $Functions keyword plus newline with generated functions text
					if (hasFunctions) m_Text = m_Text.Replace(match.Value + "\n", m_Writer.ToString());
				}
				
				if (!hasFunctions) {
					/*if (m_ScriptPrescription.m_Lang == Language.Boo && !m_Text.Contains ("def"))
						// Replace $Functions keyword with "pass" if no functions in Boo
						m_Text = m_Text.Replace (match.Value, m_Indentation + "pass");
					else*/
					// Otherwise just remove $Functions keyword plus newline
					m_Text = m_Text.Replace(match.Value + "\n", string.Empty);
				}
			}
			
			// Put curly vraces on new line if specified in editor prefs
			if (EditorPrefs.GetBool("CurlyBracesOnNewLine")) PutCurveBracesOnNewLine();
			
			// Return the text of the script
			return m_Text;
		}
 public string DumpToString(IEnumerable objects, SceneVisitor.Options options)
 {
     string results = null;
     using (StringWriter stringWriter = new StringWriter())
     {
         mWriter = stringWriter;
         Traverse(objects, options);
         results = mWriter.ToString();
     }
     
     mWriter = null;
     
     return results;
 }
Esempio n. 13
0
        public string MinifyToString(string src)
        {
            using(sr = new StreamReader(src))
            {
                using(sw = new StringWriter())
                {
					//try
					//{
						jsmin();
					//}
					//catch { }
                    return sw.ToString();
                }
            }
        }
Esempio n. 14
0
        public void Assert_Stream_File_Are_Equals(TextWriter writer, string expectedFile)
        {
            string tempFileName = System.IO.Path.GetTempFileName();
            File.WriteAllBytes(tempFileName, Encoding.UTF8.GetBytes(writer.ToString()));

            BinaryReader expected = new BinaryReader(File.OpenRead(expectedFile));
            BinaryReader actual = new BinaryReader(File.OpenRead(tempFileName));

            Assert.AreEqual(expected.BaseStream.Length, actual.BaseStream.Length);
            while(expected.BaseStream.Length == expected.BaseStream.Position || actual.BaseStream.Length == actual.BaseStream.Position) {
                Assert.AreEqual(expected.ReadByte(), actual.ReadByte());
            }
            expected.Close();
            actual.Close();

            File.Delete(tempFileName);
        }
        protected void ProcessTemplate(string name, Tag tag)
        {
            if (customTags != null && customTags.ContainsKey(name))
            {
                ExecuteCustomTag(tag);
                return;
            }

            Template useTemplate = currentTemplate.FindTemplate(name);
            if (useTemplate == null)
            {
                string msg = string.Format("Template '{0}' not found", name);
                throw new TemplateRuntimeException(msg, tag.Line, tag.Col);
            }

            // process inner elements and save content
            TextWriter saveWriter = writer;
            writer = new StringWriter();
            string content = string.Empty;

            try
            {
                ProcessElements(tag.InnerElements);

                content = writer.ToString();
            }
            finally
            {
                writer = saveWriter;
            }

            Template saveTemplate = currentTemplate;
            variables = new VariableScope(variables);
            variables["innerText"] = content;

            try
            {
                foreach (TagAttribute attrib in tag.Attributes)
                {
                    object val = EvalExpression(attrib.Expression);
                    variables[attrib.Name] = val;
                }

                currentTemplate = useTemplate;
                ProcessElements(currentTemplate.Elements);
            }
            finally
            {
                variables = variables.Parent;
                currentTemplate = saveTemplate;
            }
        }
Esempio n. 16
0
		/// <summary>
		/// 获取用户控件渲染的HTML代码
		/// </summary>
		/// <param name="writer"></param>
		/// <returns></returns>
		protected virtual string GetWriteText(TextWriter writer)
		{
			return writer.ToString();
		}
Esempio n. 17
0
		void CheckExternalMonodoc ()
		{
			firstCall = false;
			try {
				outWriter = new StringWriter ();
				errWriter = new StringWriter ();
				pw = Runtime.ProcessService.StartProcess (
					"monodoc", "--help", "", outWriter, errWriter, 
					delegate { 
						if (pw.ExitCode != 0) 
							MessageService.ShowError (
								String.Format (
								"MonoDoc exited with a exit code = {0}. Error : {1}", 
								pw.ExitCode, errWriter.ToString ()));
						pw = null;
					}, true);

				pw.WaitForOutput ();
				if (outWriter.ToString ().IndexOf ("--about") > 0)
					useExternalMonodoc = true;
				pw = null;
			} catch (Exception e) {
				MessageService.ShowError (String.Format (
					"Could not start monodoc : {0}", e.ToString ()));
			}

			if (!useExternalMonodoc)
				MessageService.ShowError (
					GettextCatalog.GetString ("You need a newer monodoc to use it externally from monodevelop. Using the integrated help viewer now."));
		}
Esempio n. 18
0
		void ShowHelpExternal (string topic)
		{
			try {
				if (pw == null || pw.HasExited == true) {
					outWriter = new StringWriter ();
					errWriter = new StringWriter ();
					
					pw = Runtime.ProcessService.StartProcess (
						"monodoc", "--remote-mode" + DirArgs, "", outWriter, errWriter, 
						delegate { 
							if (pw.ExitCode == 0)
								return;

							MessageService.ShowError (
								String.Format (
								"MonoDoc exited with a exit code = {0}.", 
								pw.ExitCode, errWriter.ToString ()));
							pw = null;
						}, true);
				}

				if (pw != null && !pw.HasExited) {
					pw.StandardInput.WriteLine (topic);
					Console.WriteLine (outWriter.ToString ());
					Console.WriteLine (errWriter.ToString ());
				}
			} catch (Exception e) {
				MessageService.ShowException (e);
				useExternalMonodoc = false;
			}
		}
Esempio n. 19
0
		void OnGotResponse (TextWriter tw)
		{
			Output = tw.ToString ();
			SetCompleted (true);
		}
Esempio n. 20
0
		void OnGotResponse (TextWriter tw)
		{
			pid = ParseResponse (packageName, tw.ToString ());
			SetCompleted (true);
		}
Esempio n. 21
0
		void OnGotResponse (TextWriter tw)
		{
			var sr = new StringReader (tw.ToString ());
			var props = new Dictionary<string,string> ();
			
			string s;
			var split = new char[] { '[', ']' };
			while ((s = sr.ReadLine ()) != null) {
				var arr = s.Split (split);
				if (arr.Length != 5 || string.IsNullOrEmpty (arr[1]) || arr[2] != ": ")
					throw new Exception ("Unknown property format: '" + s + "'");
				props [arr[1]] = arr[3];
			}
			Properties = props;
			
			SetCompleted (true);
		}
Esempio n. 22
0
		void OnGotResponse (TextWriter tw)
		{
			var sr = new StringReader (tw.ToString ());
			var list = new List<string> ();
			
			string s;
			while ((s = sr.ReadLine ()) != null) {
				//"Error: Could not access the Package Manager.  Is the system running?"
				if (s.StartsWith ("Error:"))
					throw new GetPackageListException (s.Substring ("Error:".Length));
				if (!s.StartsWith ("package:"))
					throw new GetPackageListException ("Unexpected package list output: '" + s + "'");
				s = s.Substring ("package:".Length);
				if (!string.IsNullOrEmpty (s))
					list.Add (s);
			}
			Packages = list;
			
			SetCompleted (true);
		}
Esempio n. 23
0
		public void ComplexEventSequence1 ()
		{
			string result = @"setting table...
---- OnListChanged PropertyDescriptorChanged,0,0
----- UpdateIndex : True
---- OnListChanged Reset,-1,-1
table was set.
---- OnListChanged PropertyDescriptorAdded,0,0
 col1 added.
---- OnListChanged PropertyDescriptorAdded,0,0
 col2 added.
---- OnListChanged PropertyDescriptorAdded,0,0
 col3 added.
 uniq added.
----- UpdateIndex : True
---- OnListChanged Reset,-1,-1
 sort changed.
---- OnListChanged PropertyDescriptorDeleted,0,0
 col3 removed.
----- UpdateIndex : True
---- OnListChanged Reset,-1,-1
 rowfilter changed.
----- UpdateIndex : True
---- OnListChanged Reset,-1,-1
 rowstatefilter changed.
----- UpdateIndex : True
---- OnListChanged Reset,-1,-1
 rowstatefilter changed.
---- OnListChanged ItemAdded,0,-1
 added row to Rows.
---- OnListChanged ItemAdded,0,-1
 added row to Rows.
---- OnListChanged ItemAdded,0,-1
 added row to Rows.
---- OnListChanged ItemAdded,3,-1
 AddNew() invoked.
4
---- OnListChanged ItemDeleted,3,-1
---- OnListChanged ItemMoved,-2147483648,3
 EndEdit() invoked.
3
---- OnListChanged ItemMoved,0,-2147483648
 value changed to appear.
4
---- OnListChanged ItemMoved,3,0
 value moved.
4
---- OnListChanged ItemMoved,1,3
 value moved again.
4
---- OnListChanged PropertyDescriptorChanged,0,0
----- UpdateIndex : True
---- OnListChanged Reset,-1,-1
table changed.
";

			eventWriter = new StringWriter ();

			DataTable dt = new DataTable ("table");
			ComplexEventSequence1View dv =
				new ComplexEventSequence1View (dt, eventWriter);
			dt.Columns.Add ("col1");
			eventWriter.WriteLine (" col1 added.");
			dt.Columns.Add ("col2");
			eventWriter.WriteLine (" col2 added.");
			dt.Columns.Add ("col3");
			eventWriter.WriteLine (" col3 added.");
			dt.Constraints.Add (new UniqueConstraint (dt.Columns [0]));
			eventWriter.WriteLine (" uniq added.");
			dv.Sort = "col2";
			eventWriter.WriteLine (" sort changed.");
			dt.Columns.Remove ("col3");
			eventWriter.WriteLine (" col3 removed.");
			dv.RowFilter = "col1 <> 0";
			eventWriter.WriteLine (" rowfilter changed.");
			dv.RowStateFilter = DataViewRowState.Deleted;
			eventWriter.WriteLine (" rowstatefilter changed.");
			// FIXME: should be also tested.
//			dv.ApplyDefaultSort = true;
//			eventWriter.WriteLine (" apply default sort changed.");
			dv.RowStateFilter = DataViewRowState.CurrentRows;
			eventWriter.WriteLine (" rowstatefilter changed.");
			dt.Rows.Add (new object [] {1, 3});
			eventWriter.WriteLine (" added row to Rows.");
			dt.Rows.Add (new object [] {2, 2});
			eventWriter.WriteLine (" added row to Rows.");
			dt.Rows.Add (new object [] {3, 1});
			eventWriter.WriteLine (" added row to Rows.");
			DataRowView drv = dv.AddNew ();
			eventWriter.WriteLine (" AddNew() invoked.");
			eventWriter.WriteLine (dv.Count);
			drv [0] = 0;
			drv.EndEdit ();
			eventWriter.WriteLine (" EndEdit() invoked.");
			eventWriter.WriteLine (dv.Count);
			dt.Rows [dt.Rows.Count - 1] [0] = 4;
			eventWriter.WriteLine (" value changed to appear.");
			eventWriter.WriteLine (dv.Count);
			dt.Rows [dt.Rows.Count - 1] [1] = 4;
			eventWriter.WriteLine (" value moved.");
			eventWriter.WriteLine (dv.Count);
			dt.Rows [dt.Rows.Count - 1] [1] = 1.5;
			eventWriter.WriteLine (" value moved again.");
			eventWriter.WriteLine (dv.Count);
			dv.Table = new DataTable ("table2");
			eventWriter.WriteLine ("table changed.");

			AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
		}
Esempio n. 24
0
		public void ColumnChangeName ()
		{
			string result = @"setting table...
---- OnListChanged PropertyDescriptorChanged,0,0
---- OnListChanged Reset,-1,-1
table was set.
---- OnListChanged PropertyDescriptorChanged,0,0
";

			eventWriter = new StringWriter ();

			ComplexEventSequence1View dv =
				new ComplexEventSequence1View (dataTable, eventWriter);

			dc2.ColumnName = "new_column_name";

			AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
		}
Esempio n. 25
0
		void OnGotResponse (TextWriter tw)
		{
			XDocument doc = XDocument.Parse (tw.ToString ());
			var list = new PackageList ();

			foreach (var elem in doc.Element ("packages").Elements ("package")) {
				var name = elem.Attribute ("name").Value;
				var apk = elem.Attribute ("codePath").Value;
				var version = int.Parse (elem.Attribute ("version").Value);

				list.Packages.Add (new InstalledPackage (name, apk, version));
			}

			PackageList = list;
			
			SetCompleted (true);
		}
Esempio n. 26
0
		public void CancelEditAndEvents ()
		{
			string reference = " =====ItemAdded:3 ------4 =====ItemAdded:3 =====ItemAdded:4 ------5 =====ItemAdded:4 =====ItemAdded:5 ------6 =====ItemDeleted:5 ------5 =====ItemAdded:5";

			eventWriter = new StringWriter ();

			DataTable dt = new DataTable ();
			dt.Columns.Add ("col1");
			dt.Columns.Add ("col2");
			dt.Columns.Add ("col3");
			dt.Rows.Add (new object [] {1,2,3});
			dt.Rows.Add (new object [] {1,2,3});
			dt.Rows.Add (new object [] {1,2,3});

			DataView dv = new DataView (dt);
			dv.ListChanged += new ListChangedEventHandler (ListChanged);
			DataRowView a1 = dv.AddNew ();
			eventWriter.Write (" ------" + dv.Count);
			// I wonder why but MS fires another event here.
			a1 = dv.AddNew ();
			eventWriter.Write (" ------" + dv.Count);
			// I wonder why but MS fires another event here.
			DataRowView a2 = dv.AddNew ();
			eventWriter.Write (" ------" + dv.Count);
			a2.CancelEdit ();
			eventWriter.Write (" ------" + dv.Count);
			DataRowView a3 = dv.AddNew ();

			AssertEquals (reference, eventWriter.ToString ());
		}
Esempio n. 27
0
        private void ProcessTmpl(string name, Tag tag)
        {
            if (customTags != null && customTags.ContainsKey(name)) {
                ExecuteCustomTag(tag);
                return;
            }

            Tmpl useTmpl = _currentTmpl.FindTmpl(name);

            if (useTmpl == null) {
                string msg = string.Format("Tmpl '{0}' not found", name);
                throw new TmplException(msg, tag.Line, tag.Col);
            }

            TextWriter saveWriter = writer;
            writer                = new StringWriter();
            string content        = string.Empty;

            try {
                ProcessElements(tag.InnerTokens);

                content = writer.ToString();
            } finally {
                writer = saveWriter;
            }

            Tmpl saveTmpl           = _currentTmpl;
            _variables              = new Variable(_variables);
            _variables["innerText"] = content;

            try {
                foreach (DotAttribute attrib in tag.Attributes) {
                    object val = EvalExpression(attrib.Expression);
                    _variables[attrib.Name] = val;
                }

                _currentTmpl = useTmpl;
                ProcessElements(_currentTmpl.Elements);
            } finally {
                _variables   = _variables.Parent;
                _currentTmpl = saveTmpl;
            }
        }
Esempio n. 28
0
		public void ComplexEventSequence2 ()
		{
			string result = @"setting table...
---- OnListChanged PropertyDescriptorChanged,0,0
----- UpdateIndex : True
---- OnListChanged Reset,-1,-1
table was set.
---- OnListChanged PropertyDescriptorAdded,0,0
 col1 added.
---- OnListChanged PropertyDescriptorAdded,0,0
 col2 added.
---- OnListChanged PropertyDescriptorAdded,0,0
 col3 added.
---- OnListChanged Reset,-1,-1
added tables to dataset
---- OnListChanged PropertyDescriptorAdded,0,0
added relation 1
---- OnListChanged PropertyDescriptorAdded,0,0
added relation 2
---- OnListChanged PropertyDescriptorDeleted,0,0
removed relation 2
";

			eventWriter = new StringWriter ();

			DataSet ds = new DataSet ();
			DataTable dt = new DataTable ("table");
			DataTable dt2 = new DataTable ("table2");
			ComplexEventSequence1View dv =
				new ComplexEventSequence1View (dt, eventWriter);
			dt.Columns.Add ("col1");
			eventWriter.WriteLine (" col1 added.");
			dt.Columns.Add ("col2");
			eventWriter.WriteLine (" col2 added.");
			dt.Columns.Add ("col3");
			eventWriter.WriteLine (" col3 added.");

			dt2.Columns.Add ("col1");
			dt2.Columns.Add ("col2");
			dt2.Columns.Add ("col3");

			ds.Tables.Add (dt);
			ds.Tables.Add (dt2);

			eventWriter.WriteLine ("added tables to dataset");
			ds.Relations.Add ("Relation", dt.Columns ["col1"], dt2.Columns ["col1"]);
			eventWriter.WriteLine ("added relation 1");

			DataRelation dr = ds.Relations.Add ("Relation2", dt2.Columns ["col2"], dt.Columns ["col2"]);
			eventWriter.WriteLine ("added relation 2");

			ds.Relations.Remove (dr);
			eventWriter.WriteLine ("removed relation 2");

			AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
		}
        public string ExportToHtml(Database db, TextWriter textWriter, DocumentGeneratorConfiguration docGenConfig)
        {
            if (db == null)
                {
                    throw new ArgumentNullException("db");
                }

                if (textWriter == null)
                {
                    throw new ArgumentNullException("textWriter");
                }

                if (docGenConfig == null)
                {
                    throw new ArgumentNullException("docGenConfig");
                }

                //var sw = new StringWriter();

                using(var hw = new HtmlTextWriter(textWriter))
                {
                    hw.WriteLine("<!DOCTYPE HTML>");
                    hw.RenderBeginTag(HtmlTextWriterTag.Html);

                    hw.RenderBeginTag(HtmlTextWriterTag.Head);

                    hw.RenderBeginTag(HtmlTextWriterTag.Title);

                    hw.WriteEncodedText(db.DatabaseName); //TODO: does Write method escape HTML entities???

                    hw.RenderEndTag(); //title

                    hw.Write("<!-- ");
                    hw.WriteEncodedText(@"
            Bootstrap CSS is included.  Bootstrap is released under the MIT license and is copyright 2014 Twitter.
            The MIT License (MIT)

            Copyright (c) 2011-2014 Twitter, Inc

            Permission is hereby granted, free of charge, to any person obtaining a copy
            of this software and associated documentation files (the ""Software""), to deal
            in the Software without restriction, including without limitation the rights
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
            copies of the Software, and to permit persons to whom the Software is
            furnished to do so, subject to the following conditions:

            The above copyright notice and this permission notice shall be included in
            all copies or substantial portions of the Software.

            THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
            THE SOFTWARE.");
                    hw.Write(" -->");
                    hw.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
                    hw.RenderBeginTag(HtmlTextWriterTag.Style);
                    hw.Write(this.baseCss);
                    hw.RenderEndTag(); //style

                    hw.RenderEndTag(); //head

                    hw.RenderBeginTag(HtmlTextWriterTag.Body);

                    hw.RenderBeginTag(HtmlTextWriterTag.H1);

                    hw.WriteEncodedText(String.Format("{0} Database", db.DatabaseName));

                    hw.RenderEndTag(); //h1

                    if (!String.IsNullOrWhiteSpace(db.Description))
                    {
                        hw.RenderBeginTag(HtmlTextWriterTag.P);
                        hw.WriteEncodedText(db.Description);
                        hw.RenderEndTag(); //p
                    }

                    if (db.Schemas != null && db.Schemas.Count > 0)
                    {

                        for (int s = 0; s < db.Schemas.Count; s++)
                        {
                            var schema = db.Schemas[s];
                            bool hasTables = (schema.Tables != null && schema.Tables.Count > 0);

                            if (s > 0)
                            {
                                hw.RenderBeginTag(HtmlTextWriterTag.Hr);
                                hw.RenderEndTag(); //hr
                            }

                            hw.RenderBeginTag(HtmlTextWriterTag.H2);
                            hw.WriteEncodedText(String.Format("{0} (schema)", schema.SchemaName));
                            hw.RenderEndTag(); //h2

                            if (!String.IsNullOrWhiteSpace(schema.Description))
                            {
                                hw.RenderBeginTag(HtmlTextWriterTag.P);
                                hw.WriteEncodedText(schema.Description);
                                hw.RenderEndTag(); //p

                            }

                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed schema-objects-list-container");
                            hw.RenderBeginTag(HtmlTextWriterTag.Table);

                            hw.RenderBeginTag(HtmlTextWriterTag.Thead);

                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);
                            hw.RenderBeginTag(HtmlTextWriterTag.Th);
                            hw.Write("Object Type");
                            hw.RenderEndTag(); //th

                            hw.RenderBeginTag(HtmlTextWriterTag.Th);
                            hw.Write("Count");
                            hw.RenderEndTag(); //th

                            hw.RenderEndTag(); //tr

                            hw.RenderEndTag(); //thead

                            hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            hw.Write("Tables");
                            hw.RenderEndTag(); //td

                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            if (hasTables)
                            {
                                hw.WriteEncodedText(schema.Tables.Count.ToString());
                            }
                            else
                            {
                                hw.Write("0");
                            }

                            hw.RenderEndTag(); //td

                            hw.RenderEndTag(); //tr

                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            hw.Write("Views");
                            hw.RenderEndTag(); //td

                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            if (schema.Views != null)
                            {
                                hw.WriteEncodedText(schema.Views.Count.ToString());
                            }
                            else
                            {
                                hw.Write("0");
                            }

                            hw.RenderEndTag(); //td

                            hw.RenderEndTag(); //tr

                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            hw.Write("Stored procedures");
                            hw.RenderEndTag(); //td

                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            if (schema.StoredProcedures != null)
                            {
                                hw.WriteEncodedText(schema.StoredProcedures.Count.ToString());
                            }
                            else
                            {
                                hw.Write("0");
                            }

                            hw.RenderEndTag(); //td

                            hw.RenderEndTag(); //tr

                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            hw.Write("Scalar functions");
                            hw.RenderEndTag(); //td

                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            if (schema.ScalarFunctions != null)
                            {
                                hw.WriteEncodedText(schema.ScalarFunctions.Count.ToString());
                            }
                            else
                            {
                                hw.Write("0");
                            }

                            hw.RenderEndTag(); //td

                            hw.RenderEndTag(); //tr

                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            hw.Write("Table functions");
                            hw.RenderEndTag(); //td

                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            if (schema.TableFunctions != null)
                            {
                                hw.WriteEncodedText(schema.TableFunctions.Count.ToString());
                            }
                            else
                            {
                                hw.Write("0");
                            }

                            hw.RenderEndTag(); //td

                            hw.RenderEndTag(); //tr

                            hw.RenderEndTag(); //tbody

                            hw.RenderEndTag(); //table

                            //Render tables
                            if (hasTables)
                            {

                                for (int t = 0; t < schema.Tables.Count; t++)
                                {
                                    var table = schema.Tables[t];

                                    if (docGenConfig.ForeignKeyToTableHyperLink)
                                    {
                                        // create internel hyperlink target
                                        hw.AddAttribute("id", table.GetObjectAnchorId());
                                        hw.RenderBeginTag(HtmlTextWriterTag.A);
                                        hw.RenderEndTag(); //a
                                    }

                                    bool hasIndexes = (table.Indexes != null && table.Indexes.Count > 0);

                                    hw.RenderBeginTag(HtmlTextWriterTag.H3);
                                    hw.WriteEncodedText(String.Format("{0}.{1} (table)", schema.SchemaName, table.TableName));
                                    hw.RenderEndTag(); //h3

                                    hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                    hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                    if (!String.IsNullOrWhiteSpace(table.Description))
                                    {
                                        hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                        hw.WriteEncodedText(table.Description);
                                        hw.RenderEndTag(); //caption
                                    }

                                    hw.RenderBeginTag(HtmlTextWriterTag.Thead);
                                    hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Column Name");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("System Data Type");

                                    if (table.ContainsColumnsWithUserDefinedDataType())
                                    {
                                        hw.Write(" / User Defined Type");
                                    }

                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Size");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Allow Null");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Default");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Is Computed");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Description");
                                    hw.RenderEndTag(); //th

                                    hw.RenderEndTag(); //tr

                                    hw.RenderEndTag(); //thead

                                    hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                    for (int c = 0; c < table.Columns.Count; c++)
                                    {

                                        var col = table.Columns[c];

                                        bool colHasDefaultValue = (col.DefaultValue != null);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.ColumnName);
                                        hw.RenderEndTag();  //td

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.BaseDataTypeName);
                                        if (col.IsIdentity)
                                        {
                                            hw.WriteEncodedText(" (identity)");
                                        }

                                        if (col.IsUserDefinedType)
                                        {
                                            hw.Write(" / ");
                                            hw.WriteEncodedText(col.TypeName);
                                        }

                                        hw.RenderEndTag();  //td

                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);

                                        //show precision, scale when appliable, else use maxlength
                                        if (col.Precision.HasValue && col.Scale.HasValue && col.Precision > 0)
                                        {
                                            hw.WriteEncodedText(String.Format("{0},{1}",col.Precision.Value, col.Scale.Value));
                                        }
                                        else
                                        {
                                            if (col.MaximumLength.HasValue && col.MaximumLength.Value != -1)
                                            {
                                                hw.WriteEncodedText(col.MaximumLength.ToString());
                                            }

                                        }

                                        hw.RenderEndTag();  //td

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.AllowNull ? "Yes" : "No");
                                        hw.RenderEndTag(); //td

                                        if (!colHasDefaultValue)
                                        {
                                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "no-default");
                                        }

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(colHasDefaultValue ? col.DefaultValue : "none");
                                        hw.RenderEndTag(); //td

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.IsComputed ? "Yes" : "No");
                                        hw.RenderEndTag(); //td

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.Description ?? String.Empty);
                                        hw.RenderEndTag(); //td

                                        hw.RenderEndTag(); //tr

                                    } //for column loop

                                    hw.RenderEndTag(); //tbody

                                    hw.RenderEndTag(); //table

                                    if (hasIndexes)
                                    {
                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                        hw.WriteEncodedText(String.Format("Indexes on {0}", table.TableName));
                                        hw.RenderEndTag(); //caption

                                        hw.RenderBeginTag(HtmlTextWriterTag.Thead);
                                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Index Name");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Description");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Is Primary Key");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Is Unique");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Index Type");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Columns");
                                        hw.RenderEndTag(); //th

                                        hw.RenderEndTag(); //tr
                                        hw.RenderEndTag(); //thead

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                        for (int i = 0; i < table.Indexes.Count; i++)
                                        {
                                            var index = table.Indexes[i];

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.IndexName);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.Description ?? String.Empty);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.IsPrimaryKey.ToYesNo());
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.IsUnique.ToYesNo());
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.IndexTypeDescription);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(String.Join(", ", index.ColumnNames.ToArray()));
                                            hw.RenderEndTag(); //td

                                            hw.RenderEndTag(); //tr
                                        }

                                        hw.RenderEndTag(); //tbody

                                        hw.RenderEndTag(); //table

                                    } //end indexes

                                    if (table.ForeignKeys != null && table.ForeignKeys.Count > 0)
                                    {
                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                        hw.WriteEncodedText(String.Format("Foreign Keys in {0}", table.TableName));
                                        hw.RenderEndTag(); //caption

                                        hw.RenderBeginTag(HtmlTextWriterTag.Thead);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Foreign Key Name");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Columns");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("References Table (Columns)");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Description");
                                        hw.RenderEndTag(); //th

                                        hw.RenderEndTag(); //thead

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                        for (int f = 0; f < table.ForeignKeys.Count; f++)
                                        {
                                            var fk = table.ForeignKeys[f];

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(fk.ForeignKeyName);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(String.Join(", ", fk.GetForeignKeyParentColumnNames()));
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            //hw.WriteEncodedText(String.Format("{0}.{1} ({2})", fk.ReferencedObjectSchemaName, fk.ReferencedObjectName, String.Join(", ",fk.GetForeignKeyReferenceColumnNames())));

                                            if (docGenConfig.ForeignKeyToTableHyperLink)
                                            {
                                                hw.AddAttribute("href", fk.GetFkTargetAnchorId());
                                                hw.RenderBeginTag(HtmlTextWriterTag.A);
                                                hw.WriteEncodedText(String.Format("{0}.{1} ({2})", fk.ReferencedObjectSchemaName, fk.ReferencedObjectName, String.Join(", ", fk.GetForeignKeyReferenceColumnNames())));
                                                //hw.WriteEncodedText("table ->");
                                                hw.RenderEndTag(); //a
                                            }
                                            else
                                            {
                                                hw.WriteEncodedText(String.Format("{0}.{1} ({2})", fk.ReferencedObjectSchemaName, fk.ReferencedObjectName, String.Join(", ", fk.GetForeignKeyReferenceColumnNames())));
                                            }

                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(fk.Description ?? String.Empty);
                                            hw.RenderEndTag(); //td

                                            hw.RenderEndTag(); //tr
                                        }

                                        hw.RenderEndTag(); //tbody

                                        hw.RenderEndTag(); //table

                                    } //end foreign keys

                                } //end for table loop

                            }

                            if (schema.Views != null && schema.Views.Count > 0)
                            {
                                for (int v = 0; v < schema.Views.Count; v++)
                                {
                                    var view = schema.Views[v];

                                    hw.RenderBeginTag(HtmlTextWriterTag.H3);
                                    hw.WriteEncodedText(String.Format("{0}.{1} (view)", schema.SchemaName, view.ViewName));
                                    hw.RenderEndTag(); //h3

                                    //TODO: add columns and indexes for view, use view.Description as table caption
                                    hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                    hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                    if (!String.IsNullOrWhiteSpace(view.Description))
                                    {
                                        hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                        hw.WriteEncodedText(view.Description);
                                        hw.RenderEndTag(); //caption
                                    }

                                    hw.RenderBeginTag(HtmlTextWriterTag.Thead);
                                    hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Column Name");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("System Data Type");

                                    if (view.ContainsColumnsWithUserDefinedDataType())
                                    {
                                        hw.Write(" / User Defined Type");
                                    }

                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Size");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Allow Null");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Default");
                                    hw.RenderEndTag(); //th

                                    hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                    hw.Write("Is Computed");
                                    hw.RenderEndTag(); //th

                                    hw.RenderEndTag(); //tr

                                    hw.RenderEndTag(); //thead

                                    hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                    for (int c = 0; c < view.Columns.Count; c++)
                                    {

                                        var col = view.Columns[c];

                                        bool colHasDefaultValue = (col.DefaultValue != null);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.ColumnName);
                                        hw.RenderEndTag();  //td

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.BaseDataTypeName);
                                        if (col.IsIdentity)
                                        {
                                            hw.WriteEncodedText(" (identity)");
                                        }

                                        if (col.IsUserDefinedType)
                                        {
                                            hw.Write(" / ");
                                            hw.WriteEncodedText(col.TypeName);
                                        }
                                        hw.RenderEndTag();  //td

                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        //show precision, scale when appliable
                                        if (col.Precision.HasValue && col.Scale.HasValue && col.Precision > 0)
                                        {
                                            hw.WriteEncodedText(String.Format("{0},{1}",col.Precision.Value, col.Scale.Value));
                                        }
                                        else
                                        {
                                            if (col.MaximumLength.HasValue && col.MaximumLength.Value != -1)
                                            {
                                                hw.WriteEncodedText(col.MaximumLength.ToString());
                                            }
                                            //else
                                            //{
                                            //    hw.Write("n/a");
                                            //}
                                        }

                                        hw.RenderEndTag();  //td

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.AllowNull.ToYesNo());
                                        hw.RenderEndTag(); //td

                                        if (!colHasDefaultValue)
                                        {
                                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "no-default");
                                        }

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(colHasDefaultValue ? col.DefaultValue : "none");
                                        hw.RenderEndTag(); //td

                                        hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                        hw.WriteEncodedText(col.IsComputed.ToYesNo());
                                        hw.RenderEndTag(); //td

                                        hw.RenderEndTag(); //tr

                                    } //for column loop

                                    hw.RenderEndTag(); //tbody

                                    hw.RenderEndTag(); //table

                                    if (view.IsIndexedView)
                                    {
                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                        hw.WriteEncodedText(String.Format("Indexes on {0}", view.ViewName));
                                        hw.RenderEndTag(); //caption

                                        hw.RenderBeginTag(HtmlTextWriterTag.Thead);
                                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Index Name");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Description");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Is Unique");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Index Type");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Columns");
                                        hw.RenderEndTag(); //th

                                        hw.RenderEndTag(); //tr
                                        hw.RenderEndTag(); //thead

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                        for (int i = 0; i < view.Indexes.Count; i++)
                                        {
                                            var index = view.Indexes[i];

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.IndexName);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.Description ?? String.Empty);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.IsUnique.ToYesNo());
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(index.IndexTypeDescription);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(String.Join(", ", index.ColumnNames.ToArray()));
                                            hw.RenderEndTag(); //td

                                            hw.RenderEndTag(); //tr
                                        }

                                        hw.RenderEndTag(); //tbody

                                        hw.RenderEndTag(); //table

                                    } //end indexes

                                } //end views loop

                            }//end views

                            if (schema.StoredProcedures != null && schema.StoredProcedures.Count > 0)
                            {
                                for (int r = 0; r < schema.StoredProcedures.Count; r++)
                                {
                                    var sproc = schema.StoredProcedures[r];

                                    hw.RenderBeginTag(HtmlTextWriterTag.H3);
                                    hw.WriteEncodedText(String.Format("{0}.{1} (stored procedure)", schema.SchemaName,sproc.ProcedureName) );
                                    hw.RenderEndTag(); //h3

                                    if (!String.IsNullOrWhiteSpace(sproc.Description))
                                    {
                                        hw.RenderBeginTag(HtmlTextWriterTag.P);
                                        hw.WriteEncodedText(sproc.Description);
                                        hw.RenderEndTag(); //p
                                    }

                                    if (sproc.Parameters != null && sproc.Parameters.Count > 0)
                                    {
                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                        hw.Write("Parameters");
                                        hw.RenderEndTag();//caption

                                        hw.RenderBeginTag(HtmlTextWriterTag.Thead);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Paramater Name");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("System Data Type");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Size");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Direction");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Description");
                                        hw.RenderEndTag(); //th

                                        hw.RenderEndTag(); //tr

                                        hw.RenderEndTag(); //thead

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                        for (int m = 0; m < sproc.Parameters.Count; m++)
                                        {
                                            var param = sproc.Parameters[m];

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(param.ParameterName);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(param.DataType);
                                            hw.RenderEndTag(); //td

                                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            //show precision, scale when appliable
                                            if (param.Precision.HasValue && param.Scale.HasValue && param.Precision > 0)
                                            {
                                                hw.WriteEncodedText(String.Format("{0},{1}", param.Precision.Value, param.Scale.Value));
                                            }
                                            else
                                            {
                                                if (param.MaximumLength.HasValue && param.MaximumLength.Value != -1)
                                                {
                                                    hw.WriteEncodedText(param.MaximumLength.ToString());
                                                }
                                                //else
                                                //{
                                                //    hw.Write("n/a");
                                                //}
                                            }

                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(param.Direction);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(param.Description ?? String.Empty);
                                            hw.RenderEndTag(); //td

                                            hw.RenderEndTag(); //tr

                                        } //end parameter loop

                                        hw.RenderEndTag(); //tbody

                                        hw.RenderEndTag(); //table

                                    }  //end sproc parameters

                                } //end sproc loop

                            }// end stored procedures

                            if (schema.ScalarFunctions != null && schema.ScalarFunctions.Count > 0)
                            {
                                for (int f = 0; f < schema.ScalarFunctions.Count; f++)
                                {
                                    var func = schema.ScalarFunctions[f];

                                    hw.RenderBeginTag(HtmlTextWriterTag.H3);
                                    hw.WriteEncodedText(String.Format("{0}.{1} (scalar function)", schema.SchemaName, func.FunctionName));
                                    hw.RenderEndTag(); //h3

                                    if (!String.IsNullOrWhiteSpace(func.Description))
                                    {
                                        hw.RenderBeginTag(HtmlTextWriterTag.P);
                                        hw.WriteEncodedText(func.Description);
                                        hw.RenderEndTag(); //p
                                    }

                                    if (!String.IsNullOrEmpty(func.ReturnDataType))
                                    {

                                        hw.RenderBeginTag(HtmlTextWriterTag.P);
                                        hw.Write("Returns ");
                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "return-type");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Span);
                                        hw.WriteEncodedText(func.GetReturnTypeDisplayText());
                                        hw.RenderEndTag(); //span
                                        hw.RenderEndTag(); //p

                                    }

                                    if (func.Parameters != null && func.Parameters.Count > 0)
                                    {
                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                        hw.Write("Parameters");
                                        hw.RenderEndTag();//caption

                                        hw.RenderBeginTag(HtmlTextWriterTag.Thead);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Paramater Name");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("System Data Type");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Size");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Description");
                                        hw.RenderEndTag(); //th

                                        hw.RenderEndTag(); //tr

                                        hw.RenderEndTag(); //thead

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                        for (int m = 0; m < func.Parameters.Count; m++)
                                        {
                                            var param = func.Parameters[m];

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(param.ParameterName);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(param.DataType);
                                            hw.RenderEndTag(); //td

                                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            //show precision, scale when appliable
                                            if (param.Precision.HasValue && param.Scale.HasValue && param.Precision > 0)
                                            {
                                                hw.WriteEncodedText(String.Format("{0},{1}", param.Precision.Value, param.Scale.Value));
                                            }
                                            else
                                            {
                                                if (param.MaximumLength.HasValue && param.MaximumLength.Value != -1)
                                                {
                                                    hw.WriteEncodedText(param.MaximumLength.ToString());
                                                }

                                            }

                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(param.Description ?? String.Empty);
                                            hw.RenderEndTag(); //td

                                            hw.RenderEndTag(); //tr

                                        } //end scalar func parameter loop

                                        hw.RenderEndTag(); //tbody

                                        hw.RenderEndTag(); //table

                                    } //end scalar params
                                }

                            } //end scalar functions

                            if (schema.TableFunctions != null && schema.TableFunctions.Count > 0)
                            {
                                for (int t = 0; t < schema.TableFunctions.Count; t++)
                                {
                                    var tFunc = schema.TableFunctions[t];

                                    hw.RenderBeginTag(HtmlTextWriterTag.H3);
                                    hw.WriteEncodedText(String.Format("{0}.{1} (table function)", schema.SchemaName, tFunc.FunctionName));
                                    hw.RenderEndTag(); //h3

                                    if (!String.IsNullOrWhiteSpace(tFunc.Description))
                                    {
                                        hw.RenderBeginTag(HtmlTextWriterTag.P);
                                        hw.WriteEncodedText(tFunc.Description);
                                        hw.RenderEndTag(); //p
                                    }

                                    if (tFunc.Parameters != null && tFunc.Parameters.Count > 0)
                                    {
                                        if (tFunc.Parameters != null && tFunc.Parameters.Count > 0)
                                        {
                                            hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                                            hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Caption);
                                            hw.Write("Parameters");
                                            hw.RenderEndTag();//caption

                                            hw.RenderBeginTag(HtmlTextWriterTag.Thead);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                            hw.Write("Paramater Name");
                                            hw.RenderEndTag(); //th

                                            hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                            hw.Write("System Data Type");
                                            hw.RenderEndTag(); //th

                                            hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                            hw.Write("Size");
                                            hw.RenderEndTag(); //th

                                            hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                            hw.Write("Description");
                                            hw.RenderEndTag(); //th

                                            hw.RenderEndTag(); //tr

                                            hw.RenderEndTag(); //thead

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                            for (int m = 0; m < tFunc.Parameters.Count; m++)
                                            {
                                                var param = tFunc.Parameters[m];

                                                hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                                hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                                hw.WriteEncodedText(param.ParameterName);
                                                hw.RenderEndTag(); //td

                                                hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                                hw.WriteEncodedText(param.DataType);
                                                hw.RenderEndTag(); //td

                                                hw.AddAttribute(HtmlTextWriterAttribute.Class, "text-right");
                                                hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                                //show precision, scale when appliable
                                                if (param.Precision.HasValue && param.Scale.HasValue && param.Precision > 0)
                                                {
                                                    hw.WriteEncodedText(String.Format("{0},{1}", param.Precision.Value, param.Scale.Value));
                                                }
                                                else
                                                {
                                                    if (param.MaximumLength.HasValue && param.MaximumLength.Value != -1)
                                                    {
                                                        hw.WriteEncodedText(param.MaximumLength.ToString());
                                                    }

                                                }

                                                hw.RenderEndTag(); //td

                                                hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                                hw.WriteEncodedText(param.Description ?? String.Empty);
                                                hw.RenderEndTag(); //td

                                                hw.RenderEndTag(); //tr

                                            } //end table func parameter loop

                                            hw.RenderEndTag(); //tbody

                                            hw.RenderEndTag(); //table

                                        }

                                    }//end table function parameter

                                    if (tFunc.Columns != null && tFunc.Columns.Count > 0)
                                    {

                                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed schema-objects-list-container");
                                        hw.RenderBeginTag(HtmlTextWriterTag.Table);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Thead);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Column Name");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("System Data Type");
                                        hw.RenderEndTag(); //th

                                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                                        hw.Write("Allow Null");
                                        hw.RenderEndTag(); //th

                                        hw.RenderEndTag(); //tr

                                        hw.RenderEndTag(); //thead

                                        hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                                        for (int c = 0; c < tFunc.Columns.Count; c++)
                                        {
                                            var col = tFunc.Columns[c];

                                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(col.ColumnName);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(col.BaseDataTypeName);
                                            hw.RenderEndTag(); //td

                                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                                            hw.WriteEncodedText(col.AllowNull.ToYesNo());
                                            hw.RenderEndTag(); //td

                                            hw.RenderEndTag(); //tr

                                        } //end table function column loop

                                        hw.RenderEndTag(); //tbody

                                        hw.RenderEndTag(); //table

                                    } //end table function columns

                                }

                            } //end table functions

                        }// end for schema loop

                    }

                    //display design issues
                    if (docGenConfig.CheckForDesignIssues && db.DesignIssueWarnings.HasAny())
                    {
                        hw.RenderBeginTag(HtmlTextWriterTag.H2);
                        hw.WriteEncodedText(String.Format("Design Issue Warnings ({0})", db.DesignIssueWarnings.Count));
                        hw.RenderEndTag(); //h2

                        hw.AddAttribute(HtmlTextWriterAttribute.Class, "table table-bordered table-striped table-condensed");
                        hw.RenderBeginTag(HtmlTextWriterTag.Table);

                         hw.RenderBeginTag(HtmlTextWriterTag.Thead);

                        hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                        hw.Write("Warning Description");
                        hw.RenderEndTag(); //th

                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                        hw.Write("Reference URL");
                        hw.RenderEndTag(); //th

                        hw.RenderBeginTag(HtmlTextWriterTag.Th);
                        hw.Write("Object(s)");
                        hw.RenderEndTag(); //th

                        hw.RenderEndTag(); //tr

                        hw.RenderEndTag(); //thead

                        hw.RenderBeginTag(HtmlTextWriterTag.Tbody);

                        foreach(var warn in db.DesignIssueWarnings)
                        {

                            hw.RenderBeginTag(HtmlTextWriterTag.Tr);

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            hw.WriteEncodedText(warn.Description);
                            hw.RenderEndTag(); //td

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            if(warn.ReferenceUrl != null)
                            {
                                hw.AddAttribute("href", warn.ReferenceUrl.ToString());
                                hw.RenderBeginTag(HtmlTextWriterTag.A);
                                hw.WriteEncodedText(warn.ReferenceUrl.ToString());
                                hw.RenderEndTag(); //a
                            }
                            hw.RenderEndTag(); //td

                            hw.RenderBeginTag(HtmlTextWriterTag.Td);
                            foreach(IDbObject obj in warn.DatabaseObjects)
                            {
                                //hw.WriteEncodedText(obj.ObjectFullDisplayName);  //TODO: add internal hyperlinking
                                hw.WriteEncodedText(String.Format("{0} ( {1} )", obj.ObjectFullDisplayName, obj.ObjectTypeDisplayText));
                                hw.WriteBreak(); //br

                            }
                            //hw.WriteEncodedText(warn.Description);
                            hw.RenderEndTag(); //td

                            hw.RenderEndTag(); //tr
                        }

                        hw.RenderEndTag(); // tbody

                        hw.RenderEndTag(); //table
                    }

                    //footer
                    hw.RenderBeginTag(HtmlTextWriterTag.P);
                    hw.WriteEncodedText(String.Format("Documentation created using SQL Server Database Documentation Generator version {0}", this.appVersion));

                    hw.WriteBreak(); //br

                    hw.AddAttribute(HtmlTextWriterAttribute.Href, this.projectUrl);
                    hw.RenderBeginTag(HtmlTextWriterTag.A);
                    hw.WriteEncodedText(this.projectUrl);
                    hw.RenderEndTag(); //a

                    hw.RenderEndTag(); //p

                    hw.RenderEndTag(); //body

                    hw.RenderEndTag(); //html
                }

                return textWriter.ToString();
        }
Esempio n. 30
0
		public void DefaultColumnNameAddListChangedTest ()
		{
			string result = @"setting table...
---- OnListChanged PropertyDescriptorChanged,0,0
---- OnListChanged Reset,-1,-1
table was set.
---- OnListChanged PropertyDescriptorAdded,0,0
 default named column added.
---- OnListChanged PropertyDescriptorAdded,0,0
 non-default named column added.
---- OnListChanged PropertyDescriptorAdded,0,0
 another default named column added (Column2).
---- OnListChanged PropertyDescriptorAdded,0,0
 add a column with the same name as the default columnnames.
---- OnListChanged PropertyDescriptorAdded,0,0
 add a column with a null name.
---- OnListChanged PropertyDescriptorAdded,0,0
 add a column with an empty name.
";
			eventWriter = new StringWriter ();
			DataTable dt = new DataTable ("table");
			ComplexEventSequence1View dv =
				new ComplexEventSequence1View (dt, eventWriter);
			dt.Columns.Add ();
			eventWriter.WriteLine (" default named column added.");
			dt.Columns.Add ("non-defaultNamedColumn");
			eventWriter.WriteLine (" non-default named column added.");
			DataColumn c = dt.Columns.Add ();
			eventWriter.WriteLine (" another default named column added ({0}).", c.ColumnName);
			dt.Columns.Add ("Column3");
			eventWriter.WriteLine (" add a column with the same name as the default columnnames.");
			dt.Columns.Add ((string)null);
			eventWriter.WriteLine (" add a column with a null name.");
			dt.Columns.Add ("");
			eventWriter.WriteLine (" add a column with an empty name.");

			AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
			GC.KeepAlive (dv);
		}
Esempio n. 31
0
 private XmlDocument Serialize(object obj)
 {
     StringWriter writer = null;
     try
     {
         writer = new StringWriter(CultureInfo.InvariantCulture);
         XmlSerializer serializer = new XmlSerializer(obj.GetType());
         serializer.Serialize(writer, obj);
         XmlDocument xDoc = new XmlDocument();
         xDoc.LoadXml(writer.ToString());
         return xDoc;
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         if (writer != null)
         {
             writer.Close();
             writer.Dispose();
         }
     }
 }