internal void SerializeInner <TObject>(TObject obj, WriteMode writeMode = WriteMode.Overwrite) { ApiCallSource.AssertAccess(Permissions, Access.Write); if (writeMode == WriteMode.Overwrite) { SharedStream.Seek(0); SharedStream.SetLength(0); } else { SharedStream.Seek(0, SeekOrigin.End); } SharedStream.WriteLine(JsonConvert.SerializeObject(obj, Formatting.Indented)); }
internal void SerializeInner <TObject>(TObject obj, WriteMode writeMode = WriteMode.Overwrite) { ApiCallSource.AssertAccess(Permissions, Access.Write); if (writeMode == WriteMode.Overwrite) { SharedStream.Seek(0); SharedStream.SetLength(0); } else { SharedStream.Seek(0, SeekOrigin.End); } using (var writer = new StringWriter()) { new XmlSerializer(typeof(TObject)).Serialize(writer, obj); SharedStream.WriteLine(writer.ToString()); } }