public void GetPhotosFromFolder(PhotosRequest photosRequest) { //If there is a new folder path update the current one if (photosRequest.FolderPath != null) { _inputPhotosPath = photosRequest.FolderPath; } if (_inputPhotosPath == null) { return; } //Clear all the previous data and arranging temp folders ClearAllTemproryData(photosRequest.OutputPhotoList); //Get the file list which supported var files = from file in Directory.EnumerateFiles(_inputPhotosPath, "*.*", SearchOption.AllDirectories) where _supportedFileTypes.IsFileSupported(file) select file; //Disable all buttons in gui photosRequest.CallingWindow.DisableAllButtons(); //Iterate over all the files foreach (var filepath in files) { //Insert the photo to the user interface photo list photosRequest.OutputPhotoList.AddPhoto(filepath); } //Enable all buttons in gui photosRequest.CallingWindow.EnableAllButtons(); }
public async Task Start() { WelcomeMessage(); GetAuthToken(); if (String.IsNullOrEmpty(AuthToken)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("no AuthToken provided"); Console.ResetColor(); return; } var ownProfile = new ProfileRequest(ApiDefinition.GetUserProfileUrl(), AuthToken).Create(); var result = Requester.SendRequest(ownProfile); User.Id = result["id"]; User.Username = result["name"]; if (!String.IsNullOrEmpty(User.Username)) { Console.WriteLine("own Account found!"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{User.Username} / {User.Id}"); Console.ResetColor(); } var userName = GetUserName(); var requestProfile = new ProfileRequest(ApiDefinition.GetSpecificUserUrl(userName), AuthToken).Create(); RequestedProfile = Requester.SendRequest(requestProfile); if (RequestedProfile == null) { return; } string photos = Convert.ToString(RequestedProfile["photosCount"]); string videos = Convert.ToString(RequestedProfile["videosCount"]); var totalPosts = RequestedProfile["postsCount"]; var id = RequestedProfile["id"]; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(""); Console.WriteLine($"=== User informations ({userName} / {id})"); Console.WriteLine(""); Console.WriteLine($"total posts: {totalPosts}"); Console.WriteLine($"total videos: {videos}"); Console.WriteLine($"total photos: {photos}"); Console.ResetColor(); Console.WriteLine("[OnlyFansDL] > creating folder structure..."); if (!CreateUserFolderStructure(userName)) { return; } Console.WriteLine("[OnlyFansDL] > folder structure created."); string strId = Convert.ToString(id); var photosRequest = new PhotosRequest(ApiDefinition.GetPhotosUrl(strId), AuthToken).Create(99999); var photoPosts = Requester.SendRequest(photosRequest); var videosRequest = new VideosRequest(ApiDefinition.GetVideosUrl(strId), AuthToken).Create(99999); var videosPosts = Requester.SendRequest(videosRequest); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("=== Photos Download started ==="); await SaveMaterial(photoPosts, photos); Console.WriteLine(); Console.WriteLine("=== Videos Download started ==="); await SaveMaterial(videosPosts, videos); Console.WriteLine(); Console.ResetColor(); }