Exemplo n.º 1
0
        public void AddLogEntry_NotOk_NullEntry()
        {
            var      repository = new LogEntryRepository();
            LogEntry entry      = null;

            repository.AddLogEntry(entry);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor, taking a LogEntryRepository containing the source of the logentries
 /// </summary>
 /// <param name="repository"></param>
 public RepositoryViewModel(LogEntryRepository repository)
 {
     Repository = repository;
     Active     = true;
     CommandRemoveRepository = new CommandRelay(ExecuteRemoveRepository, CanExecuteRemoveRepository);
     CommandActiveRepository = new CommandRelay(ExecuteChangeActiveRepository, CanExecuteChangeActiveRepository);
 }
Exemplo n.º 3
0
        public void EqualsTest()
        {
            var repository1 = new LogEntryRepository();
            var repository2 = new LogEntryRepository();
            var entry       = new LogEntry();

            repository1.AddLogEntry(entry);
            repository2.AddLogEntry(entry);
            Assert.IsTrue(repository1.Equals(repository2));
        }
 public LogEntryViewModel()
 {
     LoggingEntries = new ObservableCollection <LoggingEntry>();
     //_connectionString = "server=localhost;database=musterag;uid=demo;password=JusKo1986;";
     _connectionString = @"Data Source = BPMNFOREVER\ZBWBINAER; Integrated Security = SSPI; Initial Catalog=musterag;";
     //_connectionString = "data source = BPMNFOREVER\\ZBWBINAER; initial catalog = musterag; Integrated Security =SSPI;";
     _dataRepository      = new LogEntryRepository();
     _clearRepository     = new LogEntryRepository();
     LoadCommand          = new RelayCommand(LoadEntries, CanLoadEntries);
     AddCommand           = new RelayCommand(AddEntries, CanAddEntries);
     ConfirmCommand       = new RelayCommand(ConfirmEntries, CanConfirmEntries);
     FindDuplicateCommand = new RelayCommand(FindDuplicates, CanFindDuplicates);
     LocationCommand      = new RelayCommand(OpenLocationDialog);
 }
Exemplo n.º 5
0
        public void AddLogEntry()
        {
            var repository = new LogEntryRepository();
            var entry      = new LogEntry();

            Assert.AreEqual((uint)0, entry.Id);
            repository.AddLogEntry(entry);
            Assert.AreEqual(1, repository.LogEntries.Count());
            Assert.AreEqual((uint)1, entry.Id);

            entry = new LogEntry();
            repository.AddLogEntry(entry);
            Assert.AreEqual((uint)2, entry.Id);
        }
        public MainWindowViewModel(string logFolder)
        {
            DisplayName = "FFXIV LogReader";

            _logEntryRepository = new LogEntryRepository(logFolder);

            _logEntryRepository.LogEntryAdded += OnLogEntryAddedToRepository;

            _logEntryRepository.LogEntriesCleared += OnLogEntriesCleared;

            var all = (from entry in _logEntryRepository.GetEntries() select new LogEntryViewModel(entry)).ToList();

            //foreach (LogEntryViewModel entryvm in all)
            //    entryvm.PropertyChanged += this.OnLogEntryViewModelPropertyChanged;

            AllLogEntries = new ObservableCollection <LogEntryViewModel>(all);
            AllLogEntries.CollectionChanged += OnCollectionChanged;
        }
 private void ExecuteLogClear()
 {
     if (this.ConnectionString == null && this.ConnectionString.Equals(""))
     {
         MessageBox.Show("Bitte Connectionstring eingeben!");
     }
     else
     {
         var logentryRepository = new LogEntryRepository();
         logentryRepository.ExecuteLogClear(SelectedEntry);
         LogEntriesList = logentryRepository.GetAll().ToList <LogEntry>();
         if (LogEntriesList.Any())
         {
             this.SelectedEntry = this.LogEntriesList.First();
         }
         OnPropertyChanged("LogEntriesList");
         OnPropertyChanged("SelectedEntry");
     }
 }
Exemplo n.º 8
0
        public void Test_2Repo_WithCrossedDatedEntries()
        {
            var entry1 = new LogEntry();

            entry1.TimeStamp = DateTime.MinValue + new TimeSpan(0, 0, 0, 1);
            var entry2 = new LogEntry();

            entry2.TimeStamp = DateTime.MinValue + new TimeSpan(0, 0, 0, 10);
            var sourceRepository1 = new LogEntryRepository();

            sourceRepository1.AddLogEntry(entry1);
            sourceRepository1.AddLogEntry(entry2);

            var entry3 = new LogEntry();

            entry3.TimeStamp = DateTime.MinValue + new TimeSpan(0, 0, 0, 5);
            var entry4 = new LogEntry();

            entry4.TimeStamp = DateTime.MinValue + new TimeSpan(0, 0, 0, 15);
            var sourceRepository2 = new LogEntryRepository();

            sourceRepository2.AddLogEntry(entry3);
            sourceRepository2.AddLogEntry(entry4);

            var merger = new RepositoryMerger();

            merger.AddSourceRepository(sourceRepository1);
            merger.AddSourceRepository(sourceRepository2);
            LogEntryRepository targetRepository = merger.Merge();

            Assert.AreEqual(entry1.TimeStamp, targetRepository.LogEntries[0].TimeStamp);
            Assert.AreEqual(entry3.TimeStamp, targetRepository.LogEntries[1].TimeStamp);
            Assert.AreEqual(entry2.TimeStamp, targetRepository.LogEntries[2].TimeStamp);
            Assert.AreEqual(entry4.TimeStamp, targetRepository.LogEntries[3].TimeStamp);
            Assert.AreEqual((uint)1, targetRepository.LogEntries[0].Id);
            Assert.AreEqual((uint)2, targetRepository.LogEntries[1].Id);
            Assert.AreEqual((uint)3, targetRepository.LogEntries[2].Id);
            Assert.AreEqual((uint)4, targetRepository.LogEntries[3].Id);
        }
 private void ExecuteLogMessageAdd()
 {
     if (this.ConnectionString == null && this.ConnectionString.Equals(""))
     {
         MessageBox.Show("Bitte Connectionstring eingeben!");
     }
     else
     {
         if (NewEntry.Pod == null || NewEntry.Hostname == null || NewEntry.Severity < 0 ||
             NewEntry.Message == null)
         {
             MessageBox.Show("Bitte alle Felder abfüllen!");
         }
         else
         {
             var logentryRepository = new LogEntryRepository();
             logentryRepository.ExecuteLogMessageAdd(this.NewEntry);
             this.LogEntriesList = logentryRepository.GetAll().ToList <LogEntry>();
             OnPropertyChanged("LogEntriesList");
         }
     }
 }
        private void RunDuplicatesChecker()
        {
            var dubChecker = new DuplicateChecker();
            var logRepo    = new LogEntryRepository();
            var logList    = logRepo.GetAll().ToList <LogEntry>();
            var dubList    = dubChecker.FindDuplicates(logList);

            if (dubList.Any())
            {
                for (int i = 0; i < dubList.Count(); i++)
                {
                    var log = (LogEntry)dubList.ElementAt(i);
                    for (int j = 0; j < logList.Count(); j++)
                    {
                        if (logList.ElementAt(j).Id == log.Id)
                        {
                            logList.ElementAt(j).IsDuplicate = true;
                        }
                    }
                }
            }
            this.LogEntriesList = logList;
            OnPropertyChanged("LogEntriesList");
        }
Exemplo n.º 11
0
        protected virtual void CreateLogEntryFromException(
            IPluginContext context,
            Exception exception,
            LogEntryType type = LogEntryType.Error)
        {
            var action = (Action)(() =>
            {
                var name = GetType().FullName;
                var trace = context.TracingService.ToString();

                var entry = LogEntry.CreateFromException(
                    exception,
                    name,
                    trace,
                    type: type,
                    prefix: _prefix);

                var repository = new LogEntryRepository(_prefix, context);

                repository.Create(entry);
            });

            action.Catch(ex => context.TracingService.Trace(ex.ToString()));
        }
Exemplo n.º 12
0
 public byte[][] GetLogEntries(Tuple <long, long> dateRange)
 {
     return(LogEntryRepository.GetLogEntries(dateRange, new RedisClient()));
 }
Exemplo n.º 13
0
 public void SaveDatabaseToDiskBackground()
 {
     LogEntryRepository.SaveDatabaseToDiskBackground(new RedisClient());
 }
Exemplo n.º 14
0
 public void SaveRecentLogEntries(List <Tuple <long, string> > logEntries)
 {
     LogEntryRepository.SaveRecentLogEntries(logEntries, new RedisClient());
 }
Exemplo n.º 15
0
 public void SaveLogEntry(long timeStamp, string logEntryText)
 {
     LogEntryRepository.SaveLogEntry(timeStamp, logEntryText, new RedisClient());
 }
Exemplo n.º 16
0
        public void SaveLogEntry(LogEntry entry)
        {
            var logRepository = new LogEntryRepository();

            logRepository.PostLogEntry(entry);
        }