コード例 #1
0
ファイル: Upload.cs プロジェクト: yovannyr/bigstash-windows
 public Upload(JObject json)
 {
     this.Url        = (string)json["url"];
     this.ArchiveUrl = (string)json["archive"];
     this.Created    = (DateTime)json["created"];
     this.Status     = Enumerations.GetStatusFromString((string)json["status"]);
     this.Comment    = (string)json["comment"];
     this.S3         = JsonConvert.DeserializeObject <S3Info>(json["s3"].ToString());
 }
コード例 #2
0
        /// <summary>
        /// Setup the S3 Client with the user credentials and the correct S3 Configuation.
        /// </summary>
        /// <param name="accessKeyID"></param>
        /// <param name="secretAccessKey"></param>
        //public void Setup(string accessKeyID, string secretAccessKey)
        //{
        //    _s3Config = new AmazonS3Config() { RegionEndpoint = Amazon.RegionEndpoint.EUWest1 };
        //    s3Client = AWSClientFactory.CreateAmazonS3Client(accessKeyID, secretAccessKey, _s3Config);
        //    _accessKeyID = accessKeyID;
        //    _secretAccessKey = secretAccessKey;
        //}

        public void Setup(S3Info s3)
        {
            try
            {
                // enable clock skew correction since it defaults to false (should always be true though)
                if (!AWSConfigs.CorrectForClockSkew)
                {
                    AWSConfigs.CorrectForClockSkew = true;
                }

                // set the standard us region endpoint.
                _s3Config = new AmazonS3Config();
                _s3Config.ProgressUpdateInterval = 2 * 100 * 1024; // fire progress update event every 200 KB.
                _s3Config.RegionEndpoint = Amazon.RegionEndpoint.GetBySystemName(s3.Region);
                s3Client = new AmazonS3Client(s3.TokenAccessKey, s3.TokenSecretKey, s3.TokenSession, _s3Config);
            }
            catch (Exception) { throw; }
        }