public void Handle(AppLogEntryAdded eventData) { if (eventData.ComicId == null) { return; } lock (fileLock) { comicPath.EnsureDownloadFolderExistsFor(eventData.ComicId); var comicFolder = comicPath.DownloadFolderFor(eventData.ComicId); var log = Path.Combine(comicFolder, eventData.ComicId + ".txt"); file.AppendAllText(log, "[{0}][{1} {2}] {3}\n".FormatTo(DateTime.Now, eventData.ComicId, eventData.ExpressionName, eventData.Message)); } }
public override IEnumerable <object> Invoke(object argument, Context context) { var metadataBuilder = new StringBuilder(); metadataBuilder.AppendLine("====================="); foreach (var entry in context.Metadata) { metadataBuilder.AppendFormat("{0}:{1}\n", entry.Key, entry.Value); } var path = comicPath.DownloadPathFor(context.ComicId, context.ComicId + ".txt"); file.AppendAllText(path, metadataBuilder.ToString()); return(null); }