Esempio n. 1
0
        public Task AddKeyFileAsync(IFile dbFile, IFile keyFile)
        {
            var token = GetKeyToken(dbFile.IdFromPath());

            _accessList.AddOrReplace(token, keyFile.AsStorageItem());

            return(Task.CompletedTask);
        }
Esempio n. 2
0
        public async Task <bool> AddDatabaseAsync(IFile dbFile)
        {
            var token = dbFile.IdFromPath();

            _accessList.AddOrReplace(GetDatabaseToken(token), dbFile.AsStorageItem());

            var folder = await _folder;

            // Check if file already has been created
            var files = await folder.CreateFileQuery().GetFilesAsync();

            if (files.Any(f => string.Equals(f.Name, (string)token, StringComparison.OrdinalIgnoreCase)))
            {
                return(false);
            }

            // File doesn't exist, so we will now create it. We don't need any contents in, just to be present
            await folder.CreateFileAsync((string)token, CreationCollisionOption.FailIfExists);

            return(true);
        }