Example #1
0
 /// <summary>
 /// Update legalization information
 /// </summary>
 internal static void UpdateLegalInfo(MohawkCollege.EHR.gpmr.COR.Documentation documentation, Header header)
 {
     // Add legalese and other fun stuff
     if (header.Contributor != null)
     {
         documentation.Contributors = new List <string>(header.Contributor.Count);
         foreach (var kv in header.Contributor)
         {
             documentation.Contributors.Add(String.Format("{0}: {1} ({2})", kv.Role, kv.Name.Name, kv.Affiliation));
         }
     }
     // Disclaimer
     if (header.Copyright != null && header.Copyright.Disclaimer != null)
     {
         documentation.Disclaimer = new List <string>();
         foreach (XmlElement xel in header.Copyright.Disclaimer.MarkupElements ?? new List <XmlElement>().ToArray())
         {
             documentation.Disclaimer.Add(xel.OuterXml.Replace(" xmlns:html=\"http://www.w3.org/1999/xhtml\"", "").Replace("html:", "")); // Clean mif doc data from docs
         }
         if (header.Copyright.Disclaimer.MarkupText != null)
         {
             documentation.Disclaimer.Add(header.Copyright.Disclaimer.MarkupText);
         }
     }
     // Disclaimer
     if (header.Copyright != null && header.Copyright.LicenseTerms != null)
     {
         documentation.LicenseTerms = new List <string>();
         foreach (XmlElement xel in header.Copyright.LicenseTerms.MarkupElements ?? new List <XmlElement>().ToArray())
         {
             documentation.LicenseTerms.Add(xel.OuterXml.Replace(" xmlns:html=\"http://www.w3.org/1999/xhtml\"", "").Replace("html:", "")); // Clean mif doc data from docs
         }
         if (header.Copyright.LicenseTerms.MarkupText != null)
         {
             documentation.LicenseTerms.Add(header.Copyright.LicenseTerms.MarkupText);
         }
     }
 }
Example #2
0
        /// <summary>
        /// Merge <paramref name="documentation"/> with the current documentation
        /// </summary>
        public void Merge(Documentation documentation)
        {
            // Appendix
            if (documentation.Appendix != null)
            {
                if (this.Appendix == null)
                {
                    this.Appendix = new List <TitledDocumentation>();
                }
                this.Appendix.AddRange(documentation.Appendix);
            }

            // Contributors
            if (documentation.Contributors != null)
            {
                if (this.Contributors == null)
                {
                    this.Contributors = new List <String>();
                }
                this.Contributors.AddRange(documentation.Contributors);
            }

            // Definition
            if (documentation.Definition != null)
            {
                if (this.Definition == null)
                {
                    this.Definition = new List <String>();
                }
                this.Definition.AddRange(documentation.Definition);
            }

            // Description
            if (documentation.Description != null)
            {
                if (this.Description == null)
                {
                    this.Description = new List <String>();
                }
                this.Description.AddRange(documentation.Description);
            }

            // Disclaimer
            if (documentation.Disclaimer != null)
            {
                if (this.Disclaimer == null)
                {
                    this.Disclaimer = new List <String>();
                }
                this.Disclaimer.AddRange(documentation.Disclaimer);
            }

            // Other
            if (documentation.Other != null)
            {
                if (this.Other == null)
                {
                    this.Other = new List <TitledDocumentation>();
                }
                this.Other.AddRange(documentation.Other);
            }

            // Rationale
            if (documentation.Rationale != null)
            {
                if (this.Rationale == null)
                {
                    this.Rationale = new List <String>();
                }
                this.Rationale.AddRange(documentation.Rationale);
            }

            // Usage
            if (documentation.Usage != null)
            {
                if (this.Usage == null)
                {
                    this.Usage = new List <String>();
                }
                this.Usage.AddRange(documentation.Usage);
            }

            // Walkthrough
            if (documentation.Walkthrough != null)
            {
                if (this.Walkthrough == null)
                {
                    this.Walkthrough = new List <String>();
                }
                this.Walkthrough.AddRange(documentation.Walkthrough);
            }

            // License terms
            if (documentation.LicenseTerms != null)
            {
                if (this.LicenseTerms == null)
                {
                    this.LicenseTerms = new List <string>();
                }
                this.LicenseTerms.AddRange(documentation.LicenseTerms);
            }
        }
Example #3
0
 public static bool IsEmpty(Documentation d)
 {
     return(d == null || (d.Appendix == null || d.Appendix.Count == 0) && d.Copyright == null && (d.Definition == null || d.Definition.Count == 0) &&
            (d.Description == null || d.Description.Count == 0) && (d.Other == null || d.other.Count == 0) && (d.Rationale == null || d.Rationale.Count == 0) &&
            (d.Usage == null || d.usage.Count == 0) && (d.Walkthrough == null || d.Walkthrough.Count == 0));
 }
Example #4
0
        /// <summary>
        /// Merge <paramref name="documentation"/> with the current documentation
        /// </summary>
        public void Merge(Documentation documentation)
        {

            // Appendix
            if (documentation.Appendix != null)
            {
                if (this.Appendix == null) this.Appendix = new List<TitledDocumentation>();
                this.Appendix.AddRange(documentation.Appendix);
            }

            // Contributors
            if (documentation.Contributors != null)
            {
                if (this.Contributors == null) this.Contributors = new List<String>();
                this.Contributors.AddRange(documentation.Contributors);
            }

            // Definition
            if (documentation.Definition != null)
            {
                if (this.Definition == null) this.Definition = new List<String>();
                this.Definition.AddRange(documentation.Definition);
            }

            // Description
            if (documentation.Description != null)
            {
                if (this.Description == null) this.Description = new List<String>();
                this.Description.AddRange(documentation.Description);
            }

            // Disclaimer
            if (documentation.Disclaimer != null)
            {
                if (this.Disclaimer == null) this.Disclaimer = new List<String>();
                this.Disclaimer.AddRange(documentation.Disclaimer);
            }

            // Other
            if (documentation.Other != null)
            {
                if (this.Other == null) this.Other = new List<TitledDocumentation>();
                this.Other.AddRange(documentation.Other);
            }

            // Rationale
            if (documentation.Rationale != null)
            {
                if (this.Rationale == null) this.Rationale = new List<String>();
                this.Rationale.AddRange(documentation.Rationale);
            }

            // Usage
            if (documentation.Usage != null)
            {
                if (this.Usage == null) this.Usage = new List<String>();
                this.Usage.AddRange(documentation.Usage);
            }

            // Walkthrough
            if (documentation.Walkthrough != null)
            {
                if (this.Walkthrough == null) this.Walkthrough = new List<String>();
                this.Walkthrough.AddRange(documentation.Walkthrough);
            }

            // License terms
            if (documentation.LicenseTerms != null)
            {
                if (this.LicenseTerms == null) this.LicenseTerms = new List<string>();
                this.LicenseTerms.AddRange(documentation.LicenseTerms);
            }
        }
Example #5
0
        public static bool IsEmpty(Documentation d)
        {

            return d == null || (d.Appendix == null || d.Appendix.Count == 0) && d.Copyright == null && (d.Definition == null || d.Definition.Count == 0) &&
                (d.Description == null || d.Description.Count == 0) && (d.Other == null || d.other.Count == 0) && (d.Rationale == null || d.Rationale.Count == 0) 
                && (d.Usage == null || d.usage.Count == 0) && (d.Walkthrough == null || d.Walkthrough.Count == 0);
        }
        internal static string Render(Documentation doc, int tabLevel)
        {
            StringWriter sw = new StringWriter();

            if (doc == null) return "";

            #region Description

            string tabPrefix = new String('\t', tabLevel);
            sw.WriteLine(tabPrefix + "/** ");

            if (doc.Definition != null || doc.Description != null)
            {

                sw.WriteLine(tabPrefix + " * Summary:");

                List<String> defn = new List<string>();
                defn.AddRange(doc.Definition ?? new List<String>());
                defn.AddRange(doc.Description ?? new List<String>());
                foreach (String s in defn)
                {
                    sw.WriteLine(tabPrefix + " * ");
                    foreach (String line in s.Split('\n'))
                        sw.WriteLine(tabPrefix + " * {0}", line.Replace("\r", "").Replace("&", "&amp;"));
                    sw.WriteLine(tabPrefix + " * ");

                }

            }
            #endregion

            #region Walkthrough = Example

            if (doc.Walkthrough != null || doc.Usage != null)
            {
                sw.WriteLine(tabPrefix + " * Example:");
                sw.WriteLine(tabPrefix + " * Walkthrough:");
                foreach (string s in doc.Walkthrough ?? new List<String>())
                    foreach (String line in s.Split('\n'))
                        sw.WriteLine(tabPrefix + " * {0}", line.Replace("\r", "").Replace("&", "&amp;"));
                sw.WriteLine(tabPrefix + " * Usage Notes:");
                foreach (string s in doc.Usage ?? new List<String>())
                    foreach (String line in s.Split('\n'))
                        sw.WriteLine(tabPrefix + " * {0}", line.Replace("\r", "").Replace("&", "&amp;"));
            }

            #endregion

            #region Remarks
            if (doc.Rationale != null)
            {
                sw.WriteLine(tabPrefix + " * Remarks:");
                foreach (String s in doc.Rationale)
                {
                    foreach (String line in s.Split('\n'))
                        sw.WriteLine(tabPrefix + " * {0}", line.Replace("\r", "").Replace("&", "&amp;"));
                }
                sw.WriteLine(tabPrefix + " * {0}", doc.Copyright);
            }
            #endregion

            sw.WriteLine(tabPrefix + " */");

            return sw.ToString();
        }
        internal static string Render(Documentation doc, int tabLevel)
        {
            StringWriter sw = new StringWriter();

            if (doc == null ) return "";
            
            #region Description

            if (RimbaCsRenderer.SuppressDoc)
                return string.Empty;

            string tabPrefix = new String('\t', tabLevel);

            if (doc.Definition != null || doc.Description != null)
            {

                sw.WriteLine(tabPrefix + "/// <summary>");

                if (!RimbaCsRenderer.SuppressDoc)
                {
                    List<String> defn = new List<string>();
                    defn.AddRange(doc.Definition ?? new List<String>());
                    defn.AddRange(doc.Description ?? new List<String>());
                    foreach (String s in defn)
                    {
                        sw.WriteLine(tabPrefix + "/// ");
                        foreach (String line in s.Split('\n'))
                            sw.WriteLine(tabPrefix + "/// {0}", line.Replace("\r", "").Replace("&", "&amp;"));
                        sw.WriteLine(tabPrefix + "/// ");

                    }
                }
                sw.WriteLine(tabPrefix + "/// </summary>");
            }
            #endregion
            
            #region Walkthrough = Example

            if (doc.Walkthrough != null || doc.Usage != null)
            {
                if (!RimbaCsRenderer.SuppressDoc)
                {
                    sw.WriteLine(tabPrefix + "/// <example>");
                    sw.WriteLine(tabPrefix + "/// <para><b>Walkthrough</b></para>");
                    foreach (string s in doc.Walkthrough ?? new List<String>())
                        foreach (String line in s.Split('\n'))
                            sw.WriteLine(tabPrefix + "/// {0}", line.Replace("\r", "").Replace("&", "&amp;"));
                    sw.WriteLine(tabPrefix + "/// <para><b>Usage Notes</b></para>");
                    foreach (string s in doc.Usage ?? new List<String>())
                        foreach (String line in s.Split('\n'))
                            sw.WriteLine(tabPrefix + "/// {0}", line.Replace("\r", "").Replace("&", "&amp;"));
                    sw.WriteLine(tabPrefix + "/// </example>");
                }
            }

            #endregion

            #region Remarks
            if (doc.Rationale != null)
            {
                if (!RimbaCsRenderer.SuppressDoc)
                {
                    sw.WriteLine(tabPrefix + "/// <remarks>");
                    foreach (String s in doc.Rationale)
                    {
                        foreach (String line in s.Split('\n'))
                            sw.WriteLine(tabPrefix + "/// {0}", line.Replace("\r", "").Replace("&", "&amp;"));
                    }
                    sw.WriteLine(tabPrefix + "/// {0}", doc.Copyright);
                    sw.WriteLine(tabPrefix + "/// </remarks>");
                }
            }
            #endregion

            return sw.ToString();
        }