Ejemplo n.º 1
0
        /// <summary>
        /// Writes backup start info to file. <br/>
        /// The file is created new or overwritten if it exists.
        /// </summary>
        /// <param name="filePath">The path of the file to write to.</param>
        /// <param name="value">The backup start info to write.</param>
        /// <exception cref="BackupStartInfoFileIOException">If the file could not be written to.</exception>
        public static void Write(string filePath, BackupStartInfo value)
        {
            JsonSerializerOptions jsonOptions = new() { WriteIndented = true };     // Pretty print for human reading.
            var bytes = JsonSerializer.SerializeToUtf8Bytes(value, jsonOptions);

            try {
                FilesystemException.ConvertSystemException(() => File.WriteAllBytes(filePath, bytes), () => filePath);
            }
            catch (FilesystemException e) {
                throw new BackupStartInfoFileIOException(filePath, e);
            }
        }
    }
Ejemplo n.º 2
0
 public BackupMetadata(string name, BackupStartInfo startInfo, BackupManifest manifest)
 {
     Name      = name;
     StartInfo = startInfo;
     Manifest  = manifest;
 }