Ejemplo n.º 1
0
 protected BUCommon.Account _getAcct(BUCommon.AccountList accts, string account)
 {
     BUCommon.Account acct = null;
     if (!string.IsNullOrWhiteSpace(account))
     {
         acct = accts.Where(x => x.name == account).FirstOrDefault();
     }
     return(acct);
 }
Ejemplo n.º 2
0
        public BUCommon.Container containerCreate(BUCommon.Account account, string name)
        {
            var bo = new B2Net.Models.B2BucketOptions();

            var res = _client.Buckets.Create(name, bo).Result;

            return(new BUCommon.Container
            {
                accountID = account.id, account = account
                , id = res.BucketId, name = res.BucketName, type = res.BucketType
            });
        }
Ejemplo n.º 3
0
        public static void Load(BUCommon.AccountList accounts, BUCommon.Account account)
        {
            Func <BUCommon.IFileSvc> svc = null;

            if (_SvcMapping.TryGetValue(account.svcName, out svc))
            {
                account.service           = svc();
                account.service.account   = account;
                account.service.fileCache = accounts.filecache;
                account.service.setParams(account.connStr);
            }
            else
            {
                account.service = null;
            }
        }
Ejemplo n.º 4
0
        protected BUCommon.AccountList _makeSvc()
        {
            var acct = new BUCommon.Account();

            acct.connStr = @"c:\tmp\b2test";
            acct.svcName = "BackupLib.LocalService";
            acct.id      = 1;
            acct.name    = "localtest";
            var acctlst = new BUCommon.AccountList();

            acctlst.filecache = BUCommon.FileCache.Load(@"c:\tmp\b2test\cache_sync.json");

            System.IO.Directory.CreateDirectory(@"c:\tmp\b2test\cont1");

            BackupLib.AccountBuilder.Load(acctlst, acct);
            acctlst.Add(acct);

            return(acctlst);
        }