Esempio n. 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);
 }
Esempio n. 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}"));
 }
Esempio n. 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));
 }
Esempio n. 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;
 }
 public WallHandler(VkApiUtils vkApiUtils, FilesystemTools filesystemTools, IHandler <Post> postHandler) : base(filesystemTools)
 {
     this.vkApiUtils  = vkApiUtils;
     this.postHandler = postHandler;
 }
Esempio n. 6
0
 protected HandlerBase(FilesystemTools filesystemTools)
 {
     this.filesystemTools = filesystemTools;
 }
Esempio n. 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;
 }
 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;
 }
Esempio n. 11
0
 public PostHandler(FilesystemTools filesystemTools, AttachmentProcessor attachmentProcessor, CommentsHandler commentsHandler) : base(filesystemTools)
 {
     this.attachmentProcessor = attachmentProcessor;
     this.commentsHandler     = commentsHandler;
 }
Esempio n. 12
0
 public void IsDirectory_should_Throw_when_entry_missing()
 {
     Executing.This(() => FilesystemTools.IsDirectory(Path.Combine(TestRoot, "nothing")))
     .Should().Throw <FileNotFoundException>();
 }
Esempio n. 13
0
        public void Exists_should_check_missing_items()
        {
            var missing = FilesystemTools.Exists(Path.Combine(TestRoot, "nothing"));

            missing.Should().Be.False();
        }
Esempio n. 14
0
 public AudioHandler(VkApiUtils vkApiUtils, FilesystemTools filesystemTools, IHandler <PlaylistWithAudio> playlistHandler) : base(filesystemTools)
 {
     this.vkApiUtils      = vkApiUtils;
     this.playlistHandler = playlistHandler;
 }