private static void ProcessUpload(Properties props) { Stream input; if (props.filename.Length > 0) { input = File.Open(props.filename, FileMode.Open); } else { input = Console.OpenStandardInput(); } GlacierAPIInterface api = new PWGlacierAPI(props.vault, props.archive); GlacierizerUploader uploader = new GlacierizerUploader(api, input, props.size, props.threads); if (uploader.Upload()) { Console.WriteLine("Uploaded: " + Utilities.BytesToHuman(uploader.TotalBytesUploaded)); Console.WriteLine("Success!"); Console.WriteLine("ArchiveId: " + uploader.ArchiveId); string archiveIdPath = "./" + props.vault + "_" + props.archive + "_uploaded.archive.id"; System.IO.File.WriteAllText(archiveIdPath, uploader.ArchiveId); string hashPath = "./" + props.vault + "_" + props.archive + "_uploaded.hashlist"; System.IO.File.WriteAllText(hashPath, uploader.GetHashList()); } }
public DownloadWorker(ref PWGlacierAPI api, string jobId, long start, long end, ref BufferBucket bucket, ref TransferMetric metric) { this.api = api; this.jobId = jobId; this.start = start; this.end = end; this.bucket = bucket; this.metric = metric; }
public GlacierizerVaults(Properties props) { vaultName = props.vault; if (props.jobId.Length != 0) jobId = props.jobId; glacierAPI = new PWGlacierAPI(vaultName, ""); if (props.filename.Length != 0) outputStream = File.Open(props.filename, FileMode.OpenOrCreate); else outputStream = Console.OpenStandardOutput(); }
public GlacierizerDownloader(Properties props) { glacierAPI = new PWGlacierAPI(props.vault, props.archive); if (props.jobId.Length != 0) jobId = props.jobId; archiveId = props.archive; partSize = props.size; maxNumThreads = props.threads; if (props.filename == null) outputStream = Console.OpenStandardOutput(); else outputStream = File.Open(props.filename, FileMode.OpenOrCreate); }
public GlacierizerVaults(Properties props) { vaultName = props.vault; if (props.jobId.Length != 0) { jobId = props.jobId; } glacierAPI = new PWGlacierAPI(vaultName, ""); if (props.filename.Length != 0) { outputStream = File.Open(props.filename, FileMode.OpenOrCreate); } else { outputStream = Console.OpenStandardOutput(); } }
public GlacierizerDownloader(Properties props) { glacierAPI = new PWGlacierAPI(props.vault, props.archive); if (props.jobId.Length != 0) { jobId = props.jobId; } archiveId = props.archive; partSize = props.size; maxNumThreads = props.threads; if (props.filename == null) { outputStream = Console.OpenStandardOutput(); } else { outputStream = File.Open(props.filename, FileMode.OpenOrCreate); } }
private static void ProcessUpload(Properties props) { Stream input; if (props.filename.Length > 0) { input = File.Open(props.filename, FileMode.Open); } else input = Console.OpenStandardInput(); GlacierAPIInterface api = new PWGlacierAPI(props.vault, props.archive); GlacierizerUploader uploader = new GlacierizerUploader(api, input, props.size, props.threads); if (uploader.Upload()) { Console.WriteLine("Uploaded: " + Utilities.BytesToHuman(uploader.TotalBytesUploaded)); Console.WriteLine("Success!"); Console.WriteLine("ArchiveId: " + uploader.ArchiveId); string archiveIdPath = "./" + props.vault + "_" + props.archive + "_uploaded.archive.id"; System.IO.File.WriteAllText(archiveIdPath, uploader.ArchiveId); string hashPath = "./" + props.vault + "_" + props.archive + "_uploaded.hashlist"; System.IO.File.WriteAllText(hashPath, uploader.GetHashList()); } }