Update XML comments
This commit is contained in:
parent
407419a819
commit
fee9ca1e97
@ -876,7 +876,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
long message_id = Convert.ToInt64(messageUrl.Split("?firstId=")[1]);
|
long message_id = Convert.ToInt64(messageUrl.Split("?firstId=")[1]);
|
||||||
long user_id = Convert.ToInt64(messageUrl.Split("/")[6]);
|
long user_id = Convert.ToInt64(messageUrl.Split("/")[6]);
|
||||||
JObject user = await apiService.GetUserInfoById($"/users/list?x[]={user_id.ToString()}");
|
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($"Message ID: {message_id}");
|
||||||
Log.Debug($"User ID: {user_id}");
|
Log.Debug($"User ID: {user_id}");
|
||||||
@ -1544,7 +1544,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Posts",
|
"Posts",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidPostFileNameFormat ?? string.Empty,
|
.PaidPostFileNameFormat ?? "",
|
||||||
postInfo,
|
postInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
postInfo?.FromUser,
|
postInfo?.FromUser,
|
||||||
@ -1574,7 +1574,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Posts",
|
"Posts",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidPostFileNameFormat ?? string.Empty,
|
.PaidPostFileNameFormat ?? "",
|
||||||
postInfo,
|
postInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
postInfo?.FromUser,
|
postInfo?.FromUser,
|
||||||
@ -1694,7 +1694,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Messages",
|
"Messages",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidMessageFileNameFormat ?? string.Empty,
|
.PaidMessageFileNameFormat ?? "",
|
||||||
messageInfo,
|
messageInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
messageInfo?.FromUser,
|
messageInfo?.FromUser,
|
||||||
@ -1725,7 +1725,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Messages",
|
"Messages",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidMessageFileNameFormat ?? string.Empty,
|
.PaidMessageFileNameFormat ?? "",
|
||||||
messageInfo,
|
messageInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
messageInfo?.FromUser,
|
messageInfo?.FromUser,
|
||||||
@ -1921,7 +1921,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Messages",
|
"Messages",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidMessageFileNameFormat ?? string.Empty,
|
.PaidMessageFileNameFormat ?? "",
|
||||||
messageInfo,
|
messageInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
messageInfo?.FromUser,
|
messageInfo?.FromUser,
|
||||||
@ -1953,7 +1953,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Messages",
|
"Messages",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidMessageFileNameFormat ?? string.Empty,
|
.PaidMessageFileNameFormat ?? "",
|
||||||
messageInfo,
|
messageInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
messageInfo?.FromUser,
|
messageInfo?.FromUser,
|
||||||
@ -2061,7 +2061,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Messages",
|
"Messages",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidMessageFileNameFormat ?? string.Empty,
|
.PaidMessageFileNameFormat ?? "",
|
||||||
messageInfo,
|
messageInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
messageInfo?.FromUser,
|
messageInfo?.FromUser,
|
||||||
@ -2093,7 +2093,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Messages",
|
"Messages",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PaidMessageFileNameFormat ?? string.Empty,
|
.PaidMessageFileNameFormat ?? "",
|
||||||
messageInfo,
|
messageInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
messageInfo?.FromUser,
|
messageInfo?.FromUser,
|
||||||
@ -2212,7 +2212,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Posts",
|
"Posts",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username).PostFileNameFormat ??
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username).PostFileNameFormat ??
|
||||||
string.Empty,
|
"",
|
||||||
postInfo,
|
postInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
postInfo?.Author,
|
postInfo?.Author,
|
||||||
@ -2234,7 +2234,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
"Posts",
|
"Posts",
|
||||||
new SpectreProgressReporter(task),
|
new SpectreProgressReporter(task),
|
||||||
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
configService.CurrentConfig.GetCreatorFileNameFormatConfig(username)
|
||||||
.PostFileNameFormat ?? string.Empty,
|
.PostFileNameFormat ?? "",
|
||||||
postInfo,
|
postInfo,
|
||||||
mediaInfo,
|
mediaInfo,
|
||||||
postInfo?.Author,
|
postInfo?.Author,
|
||||||
@ -2622,7 +2622,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
return Path.GetFullPath(filename);
|
return Path.GetFullPath(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
string pathEnv = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
|
string pathEnv = Environment.GetEnvironmentVariable("PATH") ?? "";
|
||||||
foreach (string path in pathEnv.Split(Path.PathSeparator))
|
foreach (string path in pathEnv.Split(Path.PathSeparator))
|
||||||
{
|
{
|
||||||
string fullPath = Path.Combine(path, filename);
|
string fullPath = Path.Combine(path, filename);
|
||||||
|
|||||||
@ -412,12 +412,10 @@ public class DownloadService(
|
|||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
/// <param name="media_id"></param>
|
/// <param name="media_id"></param>
|
||||||
/// <param name="task"></param>
|
/// <param name="api_type"></param>
|
||||||
/// <param name="filenameFormat"></param>
|
/// <param name="progressReporter"></param>
|
||||||
/// <param name="generalInfo"></param>
|
/// <param name="serverFileName"></param>
|
||||||
/// <param name="generalMedia"></param>
|
/// <param name="resolvedFileName"></param>
|
||||||
/// <param name="generalAuthor"></param>
|
|
||||||
/// <param name="users"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected async Task<bool> CreateDirectoriesAndDownloadMedia(string path,
|
protected async Task<bool> CreateDirectoriesAndDownloadMedia(string path,
|
||||||
string url,
|
string url,
|
||||||
@ -466,7 +464,7 @@ public class DownloadService(
|
|||||||
/// <param name="path">The initial relative path.</param>
|
/// <param name="path">The initial relative path.</param>
|
||||||
/// <param name="extension">The file extension.</param>
|
/// <param name="extension">The file extension.</param>
|
||||||
/// <returns>A string that represents the updated path based on the file extension.</returns>
|
/// <returns>A string that represents the updated path based on the file extension.</returns>
|
||||||
private string UpdatePathBasedOnExtension(string folder, string path, string extension)
|
private static string UpdatePathBasedOnExtension(string folder, string path, string extension)
|
||||||
{
|
{
|
||||||
string subdirectory = "";
|
string subdirectory = "";
|
||||||
|
|
||||||
@ -509,14 +507,17 @@ public class DownloadService(
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a custom filename based on the given format and properties.
|
/// Generates a custom filename based on the given format and properties.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="filename"></param>
|
||||||
/// <param name="filenameFormat">The format string for the filename.</param>
|
/// <param name="filenameFormat">The format string for the filename.</param>
|
||||||
/// <param name="postInfo">General information about the post.</param>
|
/// <param name="postInfo">General information about the post.</param>
|
||||||
/// <param name="postMedia">Media associated with the post.</param>
|
/// <param name="postMedia">Media associated with the post.</param>
|
||||||
/// <param name="author">Author of the post.</param>
|
/// <param name="author">Author of the post.</param>
|
||||||
|
/// <param name="username"></param>
|
||||||
/// <param name="users">Dictionary containing user-related data.</param>
|
/// <param name="users">Dictionary containing user-related data.</param>
|
||||||
/// <param name="fileNameHelper">Helper class for filename operations.</param>
|
/// <param name="fileNameService"></param>
|
||||||
|
/// <param name="option"></param>
|
||||||
/// <returns>A Task resulting in a string that represents the custom filename.</returns>
|
/// <returns>A Task resulting in a string that represents the custom filename.</returns>
|
||||||
private async Task<string> GenerateCustomFileName(string filename,
|
private static async Task<string> GenerateCustomFileName(string filename,
|
||||||
string? filenameFormat,
|
string? filenameFormat,
|
||||||
object? postInfo,
|
object? postInfo,
|
||||||
object? postMedia,
|
object? postMedia,
|
||||||
@ -641,12 +642,13 @@ public class DownloadService(
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folder">The folder where the media is stored.</param>
|
/// <param name="folder">The folder where the media is stored.</param>
|
||||||
/// <param name="media_id">The ID of the media.</param>
|
/// <param name="media_id">The ID of the media.</param>
|
||||||
/// <param name="fullPath">The full path to the media.</param>
|
/// <param name="api_type"></param>
|
||||||
/// <param name="url">The URL from where to download the media.</param>
|
/// <param name="url">The URL from where to download the media.</param>
|
||||||
/// <param name="path">The relative path to the media.</param>
|
/// <param name="path">The relative path to the media.</param>
|
||||||
|
/// <param name="serverFilename"></param>
|
||||||
/// <param name="resolvedFilename">The filename after any required manipulations.</param>
|
/// <param name="resolvedFilename">The filename after any required manipulations.</param>
|
||||||
/// <param name="extension">The file extension.</param>
|
/// <param name="extension">The file extension.</param>
|
||||||
/// <param name="task">The task object for tracking progress.</param>
|
/// <param name="progressReporter"></param>
|
||||||
/// <returns>A Task resulting in a boolean indicating whether the media is newly downloaded or not.</returns>
|
/// <returns>A Task resulting in a boolean indicating whether the media is newly downloaded or not.</returns>
|
||||||
public async Task<bool> ProcessMediaDownload(string folder,
|
public async Task<bool> ProcessMediaDownload(string folder,
|
||||||
long media_id,
|
long media_id,
|
||||||
@ -730,12 +732,13 @@ public class DownloadService(
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
/// <param name="media_id"></param>
|
/// <param name="media_id"></param>
|
||||||
|
/// <param name="api_type"></param>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
|
/// <param name="serverFilename"></param>
|
||||||
/// <param name="resolvedFilename"></param>
|
/// <param name="resolvedFilename"></param>
|
||||||
/// <param name="extension"></param>
|
/// <param name="extension"></param>
|
||||||
/// <param name="task"></param>
|
/// <param name="progressReporter"></param>
|
||||||
/// <param name="dBHelper"></param>
|
|
||||||
/// <returns>A Task resulting in a boolean indicating whether the media is newly downloaded or not.</returns>
|
/// <returns>A Task resulting in a boolean indicating whether the media is newly downloaded or not.</returns>
|
||||||
private async Task<bool> HandleNewMedia(string folder,
|
private async Task<bool> HandleNewMedia(string folder,
|
||||||
long media_id,
|
long media_id,
|
||||||
@ -838,8 +841,8 @@ public class DownloadService(
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
/// <param name="media_id"></param>
|
/// <param name="media_id"></param>
|
||||||
/// <param name="task"></param>
|
/// <param name="api_type"></param>
|
||||||
/// <param name="dBHelper"></param>
|
/// <param name="progressReporter"></param>
|
||||||
/// <returns>A boolean indicating whether the media is newly downloaded or not.</returns>
|
/// <returns>A boolean indicating whether the media is newly downloaded or not.</returns>
|
||||||
private async Task<bool> HandlePreviouslyDownloadedMediaAsync(string folder, long media_id, string api_type,
|
private async Task<bool> HandlePreviouslyDownloadedMediaAsync(string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter)
|
IProgressReporter progressReporter)
|
||||||
@ -863,7 +866,7 @@ public class DownloadService(
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath">The path to the file.</param>
|
/// <param name="filePath">The path to the file.</param>
|
||||||
/// <returns>The file size in bytes.</returns>
|
/// <returns>The file size in bytes.</returns>
|
||||||
private long GetLocalFileSize(string filePath) => new FileInfo(filePath).Length;
|
private static long GetLocalFileSize(string filePath) => new FileInfo(filePath).Length;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -871,7 +874,7 @@ public class DownloadService(
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">The URL to download the file from.</param>
|
/// <param name="url">The URL to download the file from.</param>
|
||||||
/// <param name="destinationPath">The path where the downloaded file will be saved.</param>
|
/// <param name="destinationPath">The path where the downloaded file will be saved.</param>
|
||||||
/// <param name="task">Progress tracking object.</param>
|
/// <param name="progressReporter"></param>
|
||||||
/// <returns>A Task resulting in a DateTime indicating the last modified date of the downloaded file.</returns>
|
/// <returns>A Task resulting in a DateTime indicating the last modified date of the downloaded file.</returns>
|
||||||
private async Task<DateTime> DownloadFile(string url, string destinationPath, IProgressReporter progressReporter)
|
private async Task<DateTime> DownloadFile(string url, string destinationPath, IProgressReporter progressReporter)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user