Example #1
0
        private HistoryItem[] GetHistoryItems()
        {
            List <HistoryItem> result = new List <HistoryItem>();

            List <HistoryItem> allHistoryItems = history.GetHistoryItems();

            int itemCount = 0;

            for (int i = allHistoryItems.Count - 1; i >= 0; i--)
            {
                HistoryItem hi = allHistoryItems[i];

                if (!string.IsNullOrEmpty(hi.Filepath) && Helpers.IsImageFile(hi.Filepath) && File.Exists(hi.Filepath))
                {
                    result.Add(hi);

                    itemCount++;

                    if (MaxItemCount > 0 && itemCount >= MaxItemCount)
                    {
                        break;
                    }
                }
            }

            return(result.ToArray());
        }
Example #2
0
        private IEnumerable <HistoryItem> GetHistoryItems()
        {
            if (history == null)
            {
                history = new HistoryManager(HistoryPath);
            }

            List <HistoryItem> historyItems         = history.GetHistoryItems();
            List <HistoryItem> filteredHistoryItems = new List <HistoryItem>();

            for (int i = historyItems.Count - 1; i >= 0; i--)
            {
                HistoryItem hi = historyItems[i];

                if (!string.IsNullOrEmpty(hi.Filepath) && Helpers.IsImageFile(hi.Filepath) &&
                    (string.IsNullOrEmpty(SearchText) || hi.Filename.Contains(SearchText, StringComparison.InvariantCultureIgnoreCase)) &&
                    (!Settings.FilterMissingFiles || File.Exists(hi.Filepath)))
                {
                    filteredHistoryItems.Add(hi);

                    if (Settings.MaxItemCount > 0 && filteredHistoryItems.Count >= Settings.MaxItemCount)
                    {
                        break;
                    }
                }
            }

            UpdateTitle(historyItems.Count, filteredHistoryItems.Count);

            return(filteredHistoryItems);
        }
Example #3
0
        private IEnumerable <HistoryItem> GetHistoryItems()
        {
            List <HistoryItem> historyItems         = history.GetHistoryItems();
            List <HistoryItem> filteredHistoryItems = new List <HistoryItem>();

            int itemCount = 0;

            for (int i = historyItems.Count - 1; i >= 0; i--)
            {
                HistoryItem hi = historyItems[i];

                if (!string.IsNullOrEmpty(hi.Filepath) && Helpers.IsImageFile(hi.Filepath) &&
                    (string.IsNullOrEmpty(SearchText) || Helpers.GetFilenameSafe(hi.Filepath).Contains(SearchText, StringComparison.InvariantCultureIgnoreCase)))
                {
                    filteredHistoryItems.Add(hi);

                    itemCount++;

                    if (Settings.MaxItemCount > 0 && itemCount >= Settings.MaxItemCount)
                    {
                        break;
                    }
                }
            }

            UpdateTitle(historyItems.Count, itemCount);

            return(filteredHistoryItems);
        }
Example #4
0
        private HistoryItem[] GetHistoryItems()
        {
            if (history == null)
            {
                history = new HistoryManagerJSON(HistoryPath);
            }

            List <HistoryItem> historyItems = history.GetHistoryItems();

            historyItems.Reverse();
            return(historyItems.ToArray());
        }
Example #5
0
        private IEnumerable <HistoryItem> GetHistoryItems()
        {
            List <HistoryItem>        historyItems         = history.GetHistoryItems();
            IEnumerable <HistoryItem> filteredHistoryItems = historyItems.Where(hi => !string.IsNullOrEmpty(hi.Filepath) && Helpers.IsImageFile(hi.Filepath)).Reverse();

            if (!string.IsNullOrEmpty(SearchText))
            {
                filteredHistoryItems = filteredHistoryItems.Where(hi => Helpers.GetFilenameSafe(hi.Filepath).Contains(SearchText, StringComparison.InvariantCultureIgnoreCase));
            }

            return(filteredHistoryItems);
        }
Example #6
0
        private HistoryItem[] GetHistoryItems()
        {
            IEnumerable <HistoryItem> tempHistoryItems = history.GetHistoryItems();

            tempHistoryItems = tempHistoryItems.Reverse();

            if (MaxItemCount > 0)
            {
                tempHistoryItems = tempHistoryItems.Take(MaxItemCount);
            }

            return(tempHistoryItems.ToArray());
        }
Example #7
0
        private HistoryItem[] GetHistoryItems()
        {
            IEnumerable <HistoryItem> tempHistoryItems = history.GetHistoryItems();

            if (MaxItemCount > -1)
            {
                int skip = tempHistoryItems.Count() - MaxItemCount;

                if (skip > 0)
                {
                    tempHistoryItems = tempHistoryItems.Skip(skip);
                }
            }

            return(tempHistoryItems.OrderByDescending(x => x.DateTimeUtc).ToArray());
        }
Example #8
0
        private HistoryItem[] GetHistoryItems()
        {
            IEnumerable <HistoryItem> tempHistoryItems = history.GetHistoryItems().Where(x => !string.IsNullOrEmpty(x.Filepath) && Helpers.IsImageFile(x.Filepath) && File.Exists(x.Filepath));

            if (MaxItemCount > -1)
            {
                int skip = tempHistoryItems.Count() - MaxItemCount;

                if (skip > 0)
                {
                    tempHistoryItems = tempHistoryItems.Skip(skip);
                }
            }

            return(tempHistoryItems.OrderByDescending(x => x.DateTimeUtc).ToArray());
        }
Example #9
0
        private HistoryItem[] GetHistoryItems()
        {
            if (history == null)
            {
                history = new HistoryManager(HistoryPath);
            }

            IEnumerable <HistoryItem> tempHistoryItems = history.GetHistoryItems();

            tempHistoryItems = tempHistoryItems.Reverse();

            if (Settings.MaxItemCount > 0)
            {
                tempHistoryItems = tempHistoryItems.Take(Settings.MaxItemCount);
            }

            return(tempHistoryItems.ToArray());
        }
Example #10
0
        private IEnumerable <HistoryItem> GetHistoryItems()
        {
            if (history == null)
            {
                history = new HistoryManagerJSON(HistoryPath);
            }

            List <HistoryItem> historyItems         = history.GetHistoryItems();
            List <HistoryItem> filteredHistoryItems = new List <HistoryItem>();

            Regex regex = null;

            if (!string.IsNullOrEmpty(SearchText))
            {
                string pattern = Regex.Escape(SearchText).Replace("\\?", ".").Replace("\\*", ".*");
                regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            }

            for (int i = historyItems.Count - 1; i >= 0; i--)
            {
                HistoryItem hi = historyItems[i];

                if (!string.IsNullOrEmpty(hi.FilePath) && Helpers.IsImageFile(hi.FilePath) &&
                    (regex == null || regex.IsMatch(hi.FileName) || (SearchInTags && hi.Tags != null && hi.Tags.Any(tag => regex.IsMatch(tag.Value)))) &&
                    (!Settings.FilterMissingFiles || File.Exists(hi.FilePath)))
                {
                    filteredHistoryItems.Add(hi);

                    if (Settings.MaxItemCount > 0 && filteredHistoryItems.Count >= Settings.MaxItemCount)
                    {
                        break;
                    }
                }
            }

            UpdateTitle(historyItems.Count, filteredHistoryItems.Count);

            return(filteredHistoryItems);
        }