Exemplo n.º 1
0
        public async Task RemoveDatabaseAsync(IFile dbFile)
        {
            var token = dbFile.IdFromPath();

            _accessList.Remove(GetDatabaseToken(token));

            var keyToken = GetKeyToken(token);

            if (_accessList.ContainsItem(keyToken))
            {
                _accessList.Remove(keyToken);
            }

            var folder = await _folder;

            try
            {
                var file = await folder.GetFileAsync((string)token);

                await file.DeleteAsync(StorageDeleteOption.PermanentDelete);
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 2
0
        public async Task Handle(DeleteDatabaseMessage message)
        {
            var tile = message.Tile;

            if (tile != null)
            {
                if (!await tile.RequestDeleteAsync())
                {
                    return;
                }
            }

            _accessList.Remove(message.Id);

            var cache = await GetCachedFile(message.Id);

            await cache.DeleteAsync();

            _events.PublishOnCurrentThread(
                new DatabaseRegistrationMessage
            {
                Id     = message.Id,
                Action = DatabaseRegistrationActions.Removed,
            });
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Removes the record of the given file transfer.
        /// </summary>
        /// <param name="friendNumber">The friend number of the transfer</param>
        /// <param name="fileNumber">The file number of the transfer</param>
        public void RemoveTransfer(int friendNumber, int fileNumber)
        {
            var entry = FindEntry(friendNumber, fileNumber);

            if (entry.Token != null)
            {
                _futureAccesList.Remove(entry.Token);
            }
        }
Exemplo n.º 4
0
        public static string Enqueue(this StorageItemAccessList list, IStorageItem item)
        {
            if (list.MaximumItemsAllowed - 10 >= list.Entries.Count)
            {
                var first = list.Entries.FirstOrDefault();
                var token = first.Token;

                list.Remove(token);
            }

            try
            {
                return(list.Add(item));
            }
            catch
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        public static string Enqueue(this StorageItemAccessList list, IStorageItem item)
        {
            try
            {
                if (list.Entries.Count >= list.MaximumItemsAllowed - 10)
                {
                    var first = list.Entries.LastOrDefault();
                    if (first.Token != null)
                    {
                        list.Remove(first.Token);
                    }
                }
            }
            catch { }

            try
            {
                return(list.Add(item));
            }
            catch
            {
                return(null);
            }
        }
Exemplo n.º 6
0
 public static void Remove(StorageFolder accessFolder)
 {
     FolderAccess.Remove(Tokenize(accessFolder.Path));
 }