コード例 #1
0
        public override void Stringify(StreamWriter writer, StringifyOptions options)
        {
            string val = Value;

            if (options.trimStrings)
            {
                val = Value.Trim();
            }

            for (int i = 0; i < val.Length; i++)
            {
                switch (val[i])
                {
                case '"': writer.Write("&quot;"); break;

                case '&': writer.Write("&amp;"); break;

                case '<': writer.Write("&lt;"); break;

                case '>': writer.Write("&gt;"); break;

                default: writer.Write(val[i]); break;
                }
            }
        }
コード例 #2
0
ファイル: XmlAttribute.cs プロジェクト: Jirka-Mayer/Lemon
 public override void Stringify(StreamWriter writer, StringifyOptions options)
 {
     writer.Write(Name);
     writer.Write("=\"");
     Value.Stringify(writer, options);
     writer.Write("\"");
 }
コード例 #3
0
        /// <summary>
        /// Serializes the object into a string
        /// </summary>
        public string Stringify(StringifyOptions options = new StringifyOptions())
        {
            using (MemoryStream stream = new MemoryStream())
                using (StreamWriter writer = new StreamWriter(stream))
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        this.Stringify(writer, options);

                        writer.Flush();

                        stream.Position = 0;

                        return(reader.ReadToEnd());
                    }
        }
コード例 #4
0
 /// <summary>
 /// Serializes the object into a string form
 /// </summary>
 public abstract void Stringify(StreamWriter writer, StringifyOptions options);