Beispiel #1
0
        private static Tuple <List <VisualBubble>, List <Tuple <BubbleGroup, long> > > LoadDatabaseBubblesOnUnitInto
            (List <BubbleGroup> groups, int day, List <Tuple <BubbleGroup, Stream> > handles,
            List <Tuple <BubbleGroup, long> > cursors, string[] bubbleTypes = null, Func <VisualBubble, bool> comparer = null)
        {
            var allBubbles   = new List <VisualBubble>();
            var cursorTuples = new List <Tuple <BubbleGroup, long> >();

            foreach (var innerGroup in groups)
            {
                var bubbles = new List <VisualBubble>();

                var cursor = cursors.FirstOrDefault(x => x.Item1 == innerGroup);
                if (cursor == null)
                {
                    continue;
                }

                if (cursor.Item2 == -2)
                {
                    cursorTuples.Add(cursor);
                    continue;
                }

                var innerGroupCursor = BubbleGroupDatabase.FetchBubblesOnDay(innerGroup,
                                                                             handles.FirstOrDefault(x => x.Item1 == innerGroup).Item2,
                                                                             bubbles.Add, day, cursor.Item2, bubbleTypes, comparer);
                cursorTuples.Add(new Tuple <BubbleGroup, long>(innerGroup, innerGroupCursor));
                bubbles.Reverse();
                allBubbles.AddRange(bubbles);
            }

            return(allBubbles.Count == 0
                ? new Tuple <List <VisualBubble>, List <Tuple <BubbleGroup, long> > >(
                       null, cursorTuples)
                    : new Tuple <List <VisualBubble>, List <Tuple <BubbleGroup, long> > >(
                       allBubbles, cursorTuples));
        }