private void SaveToFileInner() { ApiCallSource.AssertAccess(Permissions, Access.Write); long pos = SharedStream.Stream.Position; SharedStream.Seek(0); File.WriteAllBytes(SourcePath, SharedStream.ReadToEnd()); SharedStream.Seek(pos); }
internal void SaveToFileInner() { ApiCallSource.AssertAccess(Permissions, Access.Write); var pos = SharedStream.Stream.Position; SharedStream.Seek(0); File.WriteAllText(SourcePath, SharedStream.ReadToEnd()); SharedStream.Seek(pos); }
internal TObject DeserializeInner <TObject>(long offset = long.MaxValue, SeekOrigin loc = SeekOrigin.Begin, bool retainPosition = true) { ApiCallSource.AssertAccess(Permissions, Access.Read); long?returnPosition = null; if (offset != long.MaxValue) { if (retainPosition) { returnPosition = SharedStream.Stream.Position; } SharedStream.Seek(offset, loc); } var obj = JsonConvert.DeserializeObject <TObject>(SharedStream.ReadToEnd()); if (returnPosition != null) { SharedStream.Seek(returnPosition.Value); } return(obj); }
internal byte[]? ReadToEndInner() { ApiCallSource.AssertAccess(Permissions, Access.Read); return(SharedStream?.ReadToEnd()); }