Ejemplo n.º 1
0
        /// <summary>
        /// Implements <see cref="IMessageRepository.LoadMessages(string, bool)" />
        /// </summary>
        public bool LoadMessages(string path, bool overwrite = false)
        {
            (string Events, string Messages) = AllIO.ImportChanges(path);
            List <AppMessage> messages = io.Parse(Messages);
            List <AppMessage> filtered = overwrite ? messages : messages.Where(x => !AppMessages.Any(y => y.Id == x.Id)).ToList();

            if (overwrite)
            {
                AppMessages.Clear();
            }

            if (messages.Any())
            {
                AppMessages.AddRange(filtered);
            }

            return(io.FullyLoaded);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Implements <see cref="IEventRepository.LoadEvents(string, bool)" />
        /// </summary>
        public bool LoadEvents(string path, bool overwrite = false)
        {
            (string Events, string Messages) = AllIO.ImportChanges(path);
            List <SavedEvent> events   = io.Parse(Events);
            List <SavedEvent> filtered = overwrite ? events : events.Where(x => !SavedEvents.Any(y => y.Id == x.Id)).ToList();

            if (overwrite)
            {
                SavedEvents.Clear();
            }

            if (events.Any())
            {
                SavedEvents.AddRange(events);
            }

            return(io.FullyLoaded);
        }