protected async Task<ACD.IAmazonDrive> GetApi()
        {
            if (_api == null)
            {
                _api = AmazonDriveHelper.GetApi();
                var isOk = await _api.AuthenticationByTokens(null, this.account.Secret, DateTime.Now);

                if (!isOk)
                    throw new InvalidOperationException("Authentication to Amazon Drive failed.");
            }

            return _api;
        }
Beispiel #2
0
        protected async Task <ACD.IAmazonDrive> GetApi()
        {
            if (_api == null)
            {
                _api = AmazonDriveHelper.GetApi();
                var isOk = await _api.AuthenticationByTokens(null, this.account.Secret, DateTime.Now);

                if (!isOk)
                {
                    throw new InvalidOperationException("Authentication to Amazon Drive failed.");
                }
            }

            return(_api);
        }
        public static async Task <AmazonNode> GetNodeByPath(this Azi.Amazon.CloudDrive.IAmazonDrive api, string path)
        {
            var        parts  = path.Split('/');
            AmazonNode node   = null;
            string     parent = null;

            foreach (var part in parts)
            {
                node = await api.Nodes.GetChild(parent, part);

                if (node == null)
                {
                    return(null);
                }
                parent = node.id;
            }

            return(node);
        }
 public AmazonDriveStorageConfigurator()
 {
     _api = AmazonDriveHelper.GetApi();
     _api.OnTokenUpdate = this;
 }
 public AmazonDriveStorageConfigurator()
 {
     _api = AmazonDriveHelper.GetApi();
     _api.OnTokenUpdate = this;
 }