示例#1
0
        private void Delete()
        {
            // TODO: Delete [for deletion, loop while there are items to delete => then sleep)
            var items = _playerItemDao.GetItemsMarkedForOnlineDeletion();

            if (items.Count > 0)
            {
                var ids        = Uri.EscapeDataString(JsonConvert.SerializeObject(items.Select(m => m.OID)));
                var parameters = $"token={_token}&ids={ids}";
                var result     = Post(parameters, DeleteUrl);
                if (string.IsNullOrEmpty(result))
                {
                    Logger.Warn("Error removing items from remote backup server");
                    return;
                }

                var obj = JsonConvert.DeserializeObject <PlayerItemBackupDeleteResponse>(result);
                if (!obj.Success)
                {
                    Logger.Warn($"Error {obj.ErrorCode} deleting items from online backup.");
                }
                else
                {
                    if (_playerItemDao.ClearItemsMarkedForOnlineDeletion() != items.Count)
                    {
                        Logger.Warn($"Not all deletion tags were removed.");
                    }
                    else
                    {
                        Logger.Info("Remove backup server notified of deleted items");
                    }
                }
            }
        }
示例#2
0
 public int ClearItemsMarkedForOnlineDeletion()
 {
     return(ThreadExecuter.Execute(
                () => repo.ClearItemsMarkedForOnlineDeletion()
                ));
 }
示例#3
0
 public void ClearItemsMarkedForOnlineDeletion()
 {
     ThreadExecuter.Execute(
         () => _repo.ClearItemsMarkedForOnlineDeletion()
         );
 }
示例#4
0
 public void ClearItemsMarkedForOnlineDeletion()
 {
     _playerItemDao.ClearItemsMarkedForOnlineDeletion();
 }