Fix Bug when strings where shorter than 25 characters on logger.writeline

Fixed CLI output
This commit is contained in:
2023-06-01 22:27:37 +02:00
parent e977bed5a5
commit 0d3799e00d
3 changed files with 4 additions and 4 deletions

View File

@ -171,7 +171,7 @@ public abstract class Connector
{
string[] split = imageUrl.Split('.');
string extension = split[^1];
logger?.WriteLine("Connector", $"Downloading Image {chapter + 1:000}/{imageUrls.Length:000} {(parentTask.publication?.sortName)![..25],-25} {(parentTask.publication?.internalId)![..25],-25} Total Task Progress: {parentTask.progress:00.0}%");
logger?.WriteLine("Connector", $"Downloading Image {chapter + 1:000}/{imageUrls.Length:000} {(parentTask.publication?.sortName)![..(int)(parentTask.publication?.sortName.Length > 25 ? 25 : parentTask.publication?.sortName.Length)!],-25} {(parentTask.publication?.internalId)![..(int)(parentTask.publication?.internalId.Length > 25 ? 25 : parentTask.publication?.internalId.Length)!],-25} Total Task Progress: {parentTask.progress:00.0}%");
DownloadImage(imageUrl, Path.Join(tempFolder, $"{chapter++}.{extension}"), requestType, referrer);
parentTask.tasksFinished++;
}

View File

@ -79,7 +79,7 @@ public abstract class TrangaTask
public override string ToString()
{
return $"{task}, {lastExecuted}, {reoccurrence}, {state} {(connectorName is not null ? $", {connectorName}" : "" )} {(publication is not null ? $", {publication?.sortName}": "")}";
return $"{task}, {lastExecuted}, {reoccurrence}, {state} {(connectorName is not null ? $", {connectorName}" : "" )} {(publication is not null ? $", {progress:00.00}%" : "")} {(publication is not null ? $", {publication?.sortName}" : "")}";
}
public class TrangaTaskJsonConverter : JsonConverter