Exemple #1
0
        /// <summary>
        /// Writes a DocumentObjectCollection type object to string. Indent a new block by
        /// indent + initialIndent characters.
        /// </summary>
        public static string WriteToString(DocumentObjectCollection docObjectContainer, int indent, int initialIndent)
        {
            StringBuilder strBuilder = new StringBuilder();
            StringWriter  writer     = null;
            DdlWriter     wrt        = null;

            try
            {
                writer = new StringWriter(strBuilder);

                wrt               = new DdlWriter(writer);
                wrt.Indent        = indent;
                wrt.InitialIndent = initialIndent;

                wrt.WriteDocument(docObjectContainer);
                wrt.Close();
            }
            finally
            {
                if (wrt != null)
                {
                    wrt.Close();
                }
                if (writer != null)
                {
#if !NETFX_CORE
                    writer.Close();
#else
                    writer.Dispose();
#endif
                }
            }
            return(strBuilder.ToString());
        }
        /// <summary>
        /// Writes a DocumentObject type object to string. Indent a new block by indent + initialIndent characters.
        /// </summary>
        public static string WriteToString(DocumentObject docObject, int indent, int initialIndent)
        {
            StringBuilder strBuilder = new StringBuilder();
            StringWriter  writer     = null;
            DdlWriter     wrt        = null;

            try
            {
                writer = new StringWriter(strBuilder);

                wrt               = new DdlWriter(writer);
                wrt.Indent        = indent;
                wrt.InitialIndent = initialIndent;

                wrt.WriteDocument(docObject);
                wrt.Close();
            }
            finally
            {
                if (wrt != null)
                {
                    wrt.Close();
                }
                if (writer != null)
                {
                    writer.Close();
                }
            }
            return(strBuilder.ToString());
        }
Exemple #3
0
        /// <summary>
        /// Writes a DocumentObjectCollection type object to a DDL file. Indent a new block by
        /// indent + initialIndent characters.
        /// </summary>
        public static void WriteToFile(DocumentObjectCollection docObjectContainer, string filename, int indent, int initialIndent)
        {
            DdlWriter wrt = null;

            try
            {
                wrt               = new DdlWriter(filename);
                wrt.Indent        = indent;
                wrt.InitialIndent = initialIndent;

                wrt.WriteDocument(docObjectContainer);
            }
            finally
            {
                if (wrt != null)
                {
                    wrt.Close();
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Writes a DocumentObjectCollection type object to a DDL file. Indent a new block by
        /// indent + initialIndent characters.
        /// </summary>
        public static void WriteToFile(DocumentObjectCollection docObjectContainer, string filename, int indent, int initialIndent)
        {
            DdlWriter wrt = null;
            try
            {
                wrt = new DdlWriter(filename);
                wrt.Indent = indent;
                wrt.InitialIndent = initialIndent;

                wrt.WriteDocument(docObjectContainer);
            }
            finally
            {
                if (wrt != null)
                    wrt.Close();
            }
        }
Exemple #5
0
        /// <summary>
        /// Writes a DocumentObjectCollection type object to string. Indent a new block by
        /// indent + initialIndent characters.
        /// </summary>
        public static string WriteToString(DocumentObjectCollection docObjectContainer, int indent, int initialIndent)
        {
            StringBuilder strBuilder = new StringBuilder();
            StringWriter writer = null;
            DdlWriter wrt = null;
            try
            {
                writer = new StringWriter(strBuilder);

                wrt = new DdlWriter(writer);
                wrt.Indent = indent;
                wrt.InitialIndent = initialIndent;

                wrt.WriteDocument(docObjectContainer);
                wrt.Close();
            }
            finally
            {
                if (wrt != null)
                    wrt.Close();
                if (writer != null)
                {
#if !NETFX_CORE
                    writer.Close();
#else
                    writer.Dispose();
#endif
                }
            }
            return strBuilder.ToString();
        }
Exemple #6
0
    /// <summary>
    /// Writes a DocumentObject type object to string. Indent a new block by indent + initialIndent characters.
    /// </summary>
    public static string WriteToString(DocumentObject docObject, int indent, int initialIndent)
    {
      StringBuilder strBuilder = new StringBuilder();
      StringWriter writer = null;
      DdlWriter wrt = null;
      try
      {
        writer = new StringWriter(strBuilder);

        wrt = new DdlWriter(writer);
        wrt.Indent = indent;
        wrt.InitialIndent = initialIndent;

        wrt.WriteDocument(docObject);
        wrt.Close();
      }
      finally
      {
        if (wrt != null)
          wrt.Close();
        if (writer != null)
          writer.Close();
      }
      return strBuilder.ToString();
    }