Baconography.NeutralServices.KitaroDB.Links.AllLinks C# (CSharp) Method

AllLinks() public method

public AllLinks ( string after ) : Task
after string
return Task
        public async Task<Listing> AllLinks(string after)
        {
            DBCursor linkCursor = null;
            try
            {
                if (after != null && after.Length > 0)
                {
                    var afterKeyspace = new byte[16];

                    for (int i = 0; i < 16 && i < after.Length; i++)
                        afterKeyspace[i] = (byte)after[i]; //skip ahead past the after type identifier

                    linkCursor = await _linksDB.SeekAsync(_linksDB.GetKeys().First(), afterKeyspace, DBReadFlags.NoLock);
                }
                else
                {
                    linkCursor = await _linksDB.SeekAsync(DBReadFlags.NoLock);
                }

                return await DeserializeCursor(linkCursor, 25);
                
            }
            catch (Exception ex)
            {
                var errorCode = DBError.TranslateError((uint)ex.HResult);
                Debug.WriteLine(errorCode);
                return new Listing { Data = new ListingData { Children = new List<Thing>() } };
            }
            finally
            {
                if (linkCursor != null)
                    linkCursor.Dispose();
            }
        }