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("""); break; case '&': writer.Write("&"); break; case '<': writer.Write("<"); break; case '>': writer.Write(">"); break; default: writer.Write(val[i]); break; } } }
public override void Stringify(StreamWriter writer, StringifyOptions options) { writer.Write(Name); writer.Write("=\""); Value.Stringify(writer, options); writer.Write("\""); }
/// <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()); } }
/// <summary> /// Serializes the object into a string form /// </summary> public abstract void Stringify(StreamWriter writer, StringifyOptions options);