Esempio n. 1
0
        // Graphs

        public async Task <List <JsonGraphRootObject> > GetLocalStorageGraphs()
        {
            var localStorageGraphs = new List <JsonGraphRootObject>();

            for (var i = 0; i < await _localStorage.LengthAsync(); i++)
            {
                var key = await _localStorage.KeyAsync(i);

                JsonGraphRootObject jsonObject = null;

                try
                {
                    jsonObject = await _localStorage.GetItemAsync <JsonGraphRootObject>(key);

                    if (!(jsonObject.Vertices?.Count > 0))
                    {
                        continue;
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine($"Could not convert local storage object with key '{ key }' to graph object, ignoring object.");
                }

                if (jsonObject != null)
                {
                    localStorageGraphs.Add(jsonObject);
                }
            }

            return(localStorageGraphs);
        }
        public async IAsyncEnumerable <string> GetKeysAsync([EnumeratorCancellation] CancellationToken cancellationToken)
        {
            for (int i = 0; i < await LocalStorage.LengthAsync(cancellationToken); i++)
            {
                string key = await LocalStorage.KeyAsync(i, cancellationToken);

                yield return(key);
            }
        }
Esempio n. 3
0
        public async ValueTask <ICollection <string> > GetAllMComponentKeys()
        {
            int length = await mLocalStorage.LengthAsync();

            var keys = new List <string>();

            for (int i = 0; i < length; i++)
            {
                var key = await mLocalStorage.KeyAsync(i);

                if (!key.StartsWith(LOCAL_STORAGE_PREFIX))
                {
                    continue;
                }

                keys.Add(key);
            }

            return(keys);
        }
Esempio n. 4
0
 private async Task <int> StorageLengthAsync() => await _db.LengthAsync();