private void ReadFileset() { using (var s = m_compression.OpenRead(FILESET_FILENAME)) { if (s == null) { IsFullBackup = new FilesetData().IsFullBackup; // use default value } else { using (var fs = new StreamReader(s, ENCODING)) { FilesetData fileset = JsonConvert.DeserializeObject <FilesetData>(fs.ReadToEnd()); IsFullBackup = fileset.IsFullBackup; } } } }
public void Reset() { this.Dispose(); m_stream = new StreamReader(m_compression.OpenRead(FILELIST)); m_reader = new JsonTextReader(m_stream); SkipJsonToken(m_reader, JsonToken.StartArray); m_current = null; m_done = false; m_first = true; }
public static IEnumerable<string> ReadBlocklist(ICompression compression, string filename, long hashsize) { var buffer = new byte[hashsize]; using(var fs = compression.OpenRead(filename)) { int s; while ((s = Library.Utility.Utility.ForceStreamRead(fs, buffer, buffer.Length)) != 0) { if (s != buffer.Length) throw new InvalidDataException("Premature End-of-stream encountered while reading blocklist hashes"); yield return Convert.ToBase64String(buffer); } } }
public VolumeReaderBase(ICompression compression, Options options) : base(options) { m_compression = compression; if (!options.DontReadManifests) { using (var s = m_compression.OpenRead(MANIFEST_FILENAME)) { if (s == null) throw new InvalidManifestException("No manifest file found in volume"); using (var fs = new StreamReader(s, ENCODING)) ManifestData.VerifyManifest(fs.ReadToEnd(), m_blocksize, options.BlockHashAlgorithm, options.FileHashAlgorithm); } } }
private void ReadManifests(Options options) { if (!options.DontReadManifests) { using (var s = m_compression.OpenRead(MANIFEST_FILENAME)) { if (s == null) { throw new InvalidManifestException("No manifest file found in volume"); } using (var fs = new StreamReader(s, ENCODING)) ManifestData.VerifyManifest(fs.ReadToEnd(), m_blocksize, options.BlockHashAlgorithm, options.FileHashAlgorithm); } } }
public void Reset() { this.Dispose(); m_stream = new StreamReader(m_compression.OpenRead(m_filename)); m_reader = new JsonTextReader(m_stream); SkipJsonToken(m_reader, JsonToken.StartObject); var p = SkipJsonToken(m_reader, JsonToken.PropertyName); if (p == null || p.ToString() != "blocks") { throw new InvalidDataException(string.Format("Invalid JSON, expected property \"blocks\", but got {0}, {1}", m_reader.TokenType, m_reader.Value)); } SkipJsonToken(m_reader, JsonToken.StartArray); m_current = null; m_done = false; }
public static IEnumerable <string> ReadBlocklist(ICompression compression, string filename, long hashsize) { var buffer = new byte[hashsize]; using (var fs = compression.OpenRead(filename)) { int s; while ((s = Library.Utility.Utility.ForceStreamRead(fs, buffer, buffer.Length)) != 0) { if (s != buffer.Length) { throw new InvalidDataException("Premature End-of-stream encountered while reading blocklist hashes"); } yield return(Convert.ToBase64String(buffer)); } } }
public bool MoveNext() { if (m_index + 1 >= m_files.Length) { return(false); } m_index++; if (m_current != null) { try { m_current.Value.Value.Dispose(); } finally { m_current = null; } } m_current = new KeyValuePair <string, Stream>(m_files[m_index].Substring(CONTROL_FILES_FOLDER.Length), m_compression.OpenRead(m_files[m_index])); return(true); }
public void Reset() { this.Dispose(); m_current = null; m_stream = m_compression.OpenRead(m_filename); }