public void Execute(object parameter) { var w = parameter as Window; if (w == null) return; // remove quotes var fileLocation = _vm.FileLocation.Trim('"'); var newLog = new LogInfo(fileLocation, _vm.Alias); LogSource.Instance.Logs.Groups .First(group => group.Id.Equals(_vm.SelectedGroup.Id)) .AddLog(newLog); w.Hide(); w.Close(); }
private void OnLogRemoved(LogInfo log) { Debug.WriteLine("OnLogRemoved fired (LogSource)"); LogRemoved?.Invoke(this, new LogEventArgs(log)); }
private void OnLogAdded(LogInfo log, Guid logId) { Debug.WriteLine("OnLogAdded fired (LogSource)"); LogAdded?.Invoke(this, new LogEventArgs(log, logId)); }
public void RemoveLog(LogInfo log) { // brute force foreach (var group in Logs.Groups) { group.Logs.RemoveAll(l => l.Id.Equals(log.Id)); } SaveState(); OnLogRemoved(log); }
public void AddLog(Guid groupId, LogInfo log) { var addTo = Logs.Groups .First(group => group.Id.Equals(groupId)); if (addTo.Logs.Any(l => l.Alias.Equals(log.Alias, StringComparison.OrdinalIgnoreCase))) { Trace.WriteLine($"A log with the alias {log.Alias} already exists in the group {addTo.Name}! Aborting"); return; } if (addTo.Logs.Any()) { var highestOrder = addTo.Logs.Max(l => l.Order); log.Order = highestOrder + 1; } addTo.Logs.Add(log); SaveState(); OnLogAdded(log, groupId); }
public void SetTail(string path) { var logInfo = new LogInfo(path); TailFile = new TailFile(logInfo); }
public LogEventArgs(LogInfo log) { Log = log; }
public LogEventArgs(LogInfo log, Guid groupId) : this(log) { GroupId = groupId; }
/// <summary> /// Initializes a new instance of the <see cref="TailFile" /> class. /// </summary> /// <param name="logInfo">The log information.</param> public TailFile(LogInfo logInfo) { LogInfo = logInfo; SearchOptions = new SearchOptions(this); _displayBuffer = Settings.SeekBuffer * 0x400; _cts = new CancellationTokenSource(); OpenMenuItemInExplorerCommand = new OpenMenuItemInExplorerCommand(); BindingOperations.EnableCollectionSynchronization(LogLines, _lockObject); }
/// <summary> /// Adds the log through the LogSource singleton. /// </summary> /// <param name="log">The log.</param> public void AddLog(LogInfo log) { LogSource.Instance.AddLog(Id, log); }