From fee9ca1e9726fd287250b63b3e427e384b6bc1c4 Mon Sep 17 00:00:00 2001 From: whimsical-c4lic0 Date: Mon, 9 Feb 2026 00:55:54 -0600 Subject: [PATCH] Update XML comments --- OF DL/Program.cs | 24 ++++++++++---------- OF DL/Services/DownloadService.cs | 37 +++++++++++++++++-------------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/OF DL/Program.cs b/OF DL/Program.cs index 1e2e770..44b1bd7 100644 --- a/OF DL/Program.cs +++ b/OF DL/Program.cs @@ -876,7 +876,7 @@ public class Program(IServiceProvider serviceProvider) long message_id = Convert.ToInt64(messageUrl.Split("?firstId=")[1]); long user_id = Convert.ToInt64(messageUrl.Split("/")[6]); JObject user = await apiService.GetUserInfoById($"/users/list?x[]={user_id.ToString()}"); - string username = string.Empty; + string username = ""; Log.Debug($"Message ID: {message_id}"); Log.Debug($"User ID: {user_id}"); @@ -1544,7 +1544,7 @@ public class Program(IServiceProvider serviceProvider) "Posts", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidPostFileNameFormat ?? string.Empty, + .PaidPostFileNameFormat ?? "", postInfo, mediaInfo, postInfo?.FromUser, @@ -1574,7 +1574,7 @@ public class Program(IServiceProvider serviceProvider) "Posts", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidPostFileNameFormat ?? string.Empty, + .PaidPostFileNameFormat ?? "", postInfo, mediaInfo, postInfo?.FromUser, @@ -1694,7 +1694,7 @@ public class Program(IServiceProvider serviceProvider) "Messages", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidMessageFileNameFormat ?? string.Empty, + .PaidMessageFileNameFormat ?? "", messageInfo, mediaInfo, messageInfo?.FromUser, @@ -1725,7 +1725,7 @@ public class Program(IServiceProvider serviceProvider) "Messages", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidMessageFileNameFormat ?? string.Empty, + .PaidMessageFileNameFormat ?? "", messageInfo, mediaInfo, messageInfo?.FromUser, @@ -1921,7 +1921,7 @@ public class Program(IServiceProvider serviceProvider) "Messages", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidMessageFileNameFormat ?? string.Empty, + .PaidMessageFileNameFormat ?? "", messageInfo, mediaInfo, messageInfo?.FromUser, @@ -1953,7 +1953,7 @@ public class Program(IServiceProvider serviceProvider) "Messages", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidMessageFileNameFormat ?? string.Empty, + .PaidMessageFileNameFormat ?? "", messageInfo, mediaInfo, messageInfo?.FromUser, @@ -2061,7 +2061,7 @@ public class Program(IServiceProvider serviceProvider) "Messages", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidMessageFileNameFormat ?? string.Empty, + .PaidMessageFileNameFormat ?? "", messageInfo, mediaInfo, messageInfo?.FromUser, @@ -2093,7 +2093,7 @@ public class Program(IServiceProvider serviceProvider) "Messages", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PaidMessageFileNameFormat ?? string.Empty, + .PaidMessageFileNameFormat ?? "", messageInfo, mediaInfo, messageInfo?.FromUser, @@ -2212,7 +2212,7 @@ public class Program(IServiceProvider serviceProvider) "Posts", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username).PostFileNameFormat ?? - string.Empty, + "", postInfo, mediaInfo, postInfo?.Author, @@ -2234,7 +2234,7 @@ public class Program(IServiceProvider serviceProvider) "Posts", new SpectreProgressReporter(task), configService.CurrentConfig.GetCreatorFileNameFormatConfig(username) - .PostFileNameFormat ?? string.Empty, + .PostFileNameFormat ?? "", postInfo, mediaInfo, postInfo?.Author, @@ -2622,7 +2622,7 @@ public class Program(IServiceProvider serviceProvider) return Path.GetFullPath(filename); } - string pathEnv = Environment.GetEnvironmentVariable("PATH") ?? string.Empty; + string pathEnv = Environment.GetEnvironmentVariable("PATH") ?? ""; foreach (string path in pathEnv.Split(Path.PathSeparator)) { string fullPath = Path.Combine(path, filename); diff --git a/OF DL/Services/DownloadService.cs b/OF DL/Services/DownloadService.cs index aa9d4c9..254169d 100644 --- a/OF DL/Services/DownloadService.cs +++ b/OF DL/Services/DownloadService.cs @@ -412,12 +412,10 @@ public class DownloadService( /// /// /// - /// - /// - /// - /// - /// - /// + /// + /// + /// + /// /// protected async Task CreateDirectoriesAndDownloadMedia(string path, string url, @@ -466,7 +464,7 @@ public class DownloadService( /// The initial relative path. /// The file extension. /// A string that represents the updated path based on the file extension. - private string UpdatePathBasedOnExtension(string folder, string path, string extension) + private static string UpdatePathBasedOnExtension(string folder, string path, string extension) { string subdirectory = ""; @@ -509,14 +507,17 @@ public class DownloadService( /// /// Generates a custom filename based on the given format and properties. /// + /// /// The format string for the filename. /// General information about the post. /// Media associated with the post. /// Author of the post. + /// /// Dictionary containing user-related data. - /// Helper class for filename operations. + /// + /// /// A Task resulting in a string that represents the custom filename. - private async Task GenerateCustomFileName(string filename, + private static async Task GenerateCustomFileName(string filename, string? filenameFormat, object? postInfo, object? postMedia, @@ -641,12 +642,13 @@ public class DownloadService( /// /// The folder where the media is stored. /// The ID of the media. - /// The full path to the media. + /// /// The URL from where to download the media. /// The relative path to the media. + /// /// The filename after any required manipulations. /// The file extension. - /// The task object for tracking progress. + /// /// A Task resulting in a boolean indicating whether the media is newly downloaded or not. public async Task ProcessMediaDownload(string folder, long media_id, @@ -730,12 +732,13 @@ public class DownloadService( /// /// /// + /// /// /// + /// /// /// - /// - /// + /// /// A Task resulting in a boolean indicating whether the media is newly downloaded or not. private async Task HandleNewMedia(string folder, long media_id, @@ -838,8 +841,8 @@ public class DownloadService( /// /// /// - /// - /// + /// + /// /// A boolean indicating whether the media is newly downloaded or not. private async Task HandlePreviouslyDownloadedMediaAsync(string folder, long media_id, string api_type, IProgressReporter progressReporter) @@ -863,7 +866,7 @@ public class DownloadService( /// /// The path to the file. /// The file size in bytes. - private long GetLocalFileSize(string filePath) => new FileInfo(filePath).Length; + private static long GetLocalFileSize(string filePath) => new FileInfo(filePath).Length; /// @@ -871,7 +874,7 @@ public class DownloadService( /// /// The URL to download the file from. /// The path where the downloaded file will be saved. - /// Progress tracking object. + /// /// A Task resulting in a DateTime indicating the last modified date of the downloaded file. private async Task DownloadFile(string url, string destinationPath, IProgressReporter progressReporter) {