Ejemplo n.º 1
0
        public string GetRecentOutputFolder(IMangaRecord mangaRecord)
        {
            if (mangaRecord == null)
            {
                throw new ArgumentNullException("mangaRecord");
            }

            try
            {
                IDictionary <string, int> folders = _storage.GetRecentFolders(mangaRecord.Scraper, mangaRecord.MangaId);

                if (folders.Count == 0)
                {
                    return(null);
                }

                // return the folder name with most usages
                return(folders.Aggregate((l, r) => l.Value > r.Value ? l : r).Key);
            }
            catch (StorageException)
            {
                throw;
            }
            catch (Exception)
            {
                return(null);
            }
        }