Пример #1
0
        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());
            }
        }
Пример #2
0
        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());
            }
        }