Пример #1
0
 public static async Task SaveHumanReadableText(this Poll poll, int i, FilesystemTools filesystemTools, DirectoryInfo dir, CancellationToken token, ILog log)
 {
     var textFile = filesystemTools.CreateFile(dir, $"{i} {poll.GetName()}.txt", CreateMode.OverwriteExisting);
     await File.WriteAllTextAsync(textFile.FullName, poll.Serialize(), token);
 }
Пример #2
0
 public static IEnumerable <IDownload> ToDownloads(this Document document, int i, FilesystemTools filesystemTools, DirectoryInfo dir, ILog log)
 {
     // TODO: looks like Title already has Extension
     yield return(new Download(new Uri(document.Uri), dir, $"{i} {document.Title}"));
 }
Пример #3
0
 public static IEnumerable <IDownload> ToDownloads(this Link link, int i, FilesystemTools filesystemTools, DirectoryInfo dir, ILog log)
 {
     yield return(new Download(link.Uri, dir, link.Title));
 }
Пример #4
0
 public Logic(TokenMagic tokenMagic, VkApi vkApi, VkApiUtils vkApiUtils, BackgroundDownloader downloader, FilesystemTools filesystemTools, DownloadQueueProvider queueProvider, WallHandler wallHandler, AudioHandler audioHandler, PhotoHandler photoHandler, IOptionsSnapshot <Settings> settings)
 {
     this.settings        = settings.Value;
     this.tokenMagic      = tokenMagic;
     this.vkApi           = vkApi;
     this.vkApiUtils      = vkApiUtils;
     this.downloader      = downloader;
     this.filesystemTools = filesystemTools;
     this.queueProvider   = queueProvider;
     this.wallHandler     = wallHandler;
     this.audioHandler    = audioHandler;
     this.photoHandler    = photoHandler;
 }
Пример #5
0
 public WallHandler(VkApiUtils vkApiUtils, FilesystemTools filesystemTools, IHandler <Post> postHandler) : base(filesystemTools)
 {
     this.vkApiUtils  = vkApiUtils;
     this.postHandler = postHandler;
 }
Пример #6
0
 protected HandlerBase(FilesystemTools filesystemTools)
 {
     this.filesystemTools = filesystemTools;
 }
Пример #7
0
 public static async Task SaveHumanReadableText(this IReadOnlyList <Comment> comments, FilesystemTools filesystemTools, DirectoryInfo dir, CancellationToken token, ILog log)
 {
     var data     = string.Join("\n\n", comments.Select(c => c.Serialize()));
     var textFile = filesystemTools.CreateFile(dir, $"comments.txt", CreateMode.OverwriteExisting);
     await File.WriteAllTextAsync(textFile.FullName, data, token);
 }
 public CommentHandler(FilesystemTools filesystemTools, AttachmentProcessor attachmentProcessor) : base(filesystemTools)
 {
     this.attachmentProcessor = attachmentProcessor;
 }
Пример #9
0
 public PhotoHandler(VkApiUtils vkApiUtils, FilesystemTools filesystemTools, IHandler <AlbumWithPhoto> albumHandler) : base(filesystemTools)
 {
     this.vkApiUtils   = vkApiUtils;
     this.albumHandler = albumHandler;
 }
 public CommentsHandler(VkApiUtils vkApiUtils, FilesystemTools filesystemTools, IHandler <Comment> commentHandler) : base(filesystemTools)
 {
     this.vkApiUtils     = vkApiUtils;
     this.commentHandler = commentHandler;
 }
Пример #11
0
 public PostHandler(FilesystemTools filesystemTools, AttachmentProcessor attachmentProcessor, CommentsHandler commentsHandler) : base(filesystemTools)
 {
     this.attachmentProcessor = attachmentProcessor;
     this.commentsHandler     = commentsHandler;
 }
Пример #12
0
 public void IsDirectory_should_Throw_when_entry_missing()
 {
     Executing.This(() => FilesystemTools.IsDirectory(Path.Combine(TestRoot, "nothing")))
     .Should().Throw <FileNotFoundException>();
 }
Пример #13
0
        public void Exists_should_check_missing_items()
        {
            var missing = FilesystemTools.Exists(Path.Combine(TestRoot, "nothing"));

            missing.Should().Be.False();
        }
Пример #14
0
 public AudioHandler(VkApiUtils vkApiUtils, FilesystemTools filesystemTools, IHandler <PlaylistWithAudio> playlistHandler) : base(filesystemTools)
 {
     this.vkApiUtils      = vkApiUtils;
     this.playlistHandler = playlistHandler;
 }