示例#1
0
        private void SaveToFileInner()
        {
            ApiCallSource.AssertAccess(Permissions, Access.Write);

            long pos = SharedStream.Stream.Position;

            SharedStream.Seek(0);
            File.WriteAllBytes(SourcePath, SharedStream.ReadToEnd());
            SharedStream.Seek(pos);
        }
示例#2
0
        internal void SaveToFileInner()
        {
            ApiCallSource.AssertAccess(Permissions, Access.Write);

            var pos = SharedStream.Stream.Position;

            SharedStream.Seek(0);
            File.WriteAllText(SourcePath, SharedStream.ReadToEnd());
            SharedStream.Seek(pos);
        }
示例#3
0
        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);
        }
示例#4
0
 internal byte[]? ReadToEndInner()
 {
     ApiCallSource.AssertAccess(Permissions, Access.Read);
     return(SharedStream?.ReadToEnd());
 }