コード例 #1
0
        /// <summary>
        /// Saves the INI document to the specified file.
        /// </summary>
        /// <param name="fileName">The location of the file where you want to save the document.</param>
        public void Save(string fileName, IniWriterFormattingSettings formatting)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }

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

            this.Save(new FileStream(fileName, FileMode.CreateNew));
        }
コード例 #2
0
        /// <summary>
        /// Saves the INI document to the specified stream.
        /// </summary>
        /// <param name="strm">The stream to which you want to save.</param>
        public void Save(Stream strm, IniWriterFormattingSettings formatting)
        {
            if (strm == null)
            {
                throw new ArgumentNullException("strm");
            }

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

            using (TextWriter sw = new StreamWriter(strm))
                this.Save(sw, formatting);
        }
コード例 #3
0
        /// <summary>
        /// Saves the INI document to the specified TextWriter.
        /// </summary>
        /// <param name="tw">The TextWriter to which you want to save.</param>
        /// <param name="formatting">Formatting options used to render the content.</param>
        public void Save(TextWriter tw, IniWriterFormattingSettings formatting)
        {
            if (tw == null)
            {
                throw new ArgumentNullException("tw");
            }

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

            using (IniWriter iw = new IniWriter(tw))
            {
                iw.SyntaxDefinition = this.SyntaxDefinition;
                iw.Formatting       = formatting;

                this.Save(iw);
            }
        }