コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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);
        }