ToString overrides

This commit is contained in:
2025-07-03 20:38:18 +02:00
parent d6f0630a99
commit f05f2cc8e0
10 changed files with 21 additions and 8 deletions

View File

@ -10,8 +10,5 @@ public class MangaTag(string tag)
[Required]
public string Tag { get; init; } = tag;
public override string ToString()
{
return $"{Tag}";
}
public override string ToString() => Tag;
}

View File

@ -45,7 +45,7 @@ public class Notification : Identifiable
this.IsSent = isSent;
}
public override string ToString() => $"{base.ToString()} {Urgency} {Title}";
public override string ToString() => $"{base.ToString()} {Urgency} {Title} {Message}";
}
public enum NotificationUrgency : byte

View File

@ -79,4 +79,6 @@ public class NotificationConnector(string name, string url, Dictionary<string, s
return sb.ToString();
}
}
public override string ToString() => $"{GetType().Name} {Name}";
}

View File

@ -35,4 +35,6 @@ public abstract class TrangaBaseContext<T> : DbContext where T : DbContext
return (false, e.Message);
}
}
public override string ToString() => $"{GetType().Name} {typeof(T).Name}";
}

View File

@ -161,21 +161,23 @@ public class DownloadChapterFromMangaconnectorWorker(MangaConnectorId<Chapter> c
File.SetUnixFileMode(newFilePath, GroupRead | GroupWrite | UserRead | UserWrite | OtherRead | OtherWrite);
Log.Debug($"Copied cover from {fileInCache} to {newFilePath}");
}
private bool DownloadImage(string imageUrl, string savePath)
{
HttpDownloadClient downloadClient = new();
RequestResult requestResult = downloadClient.MakeRequest(imageUrl, RequestType.MangaImage);
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
return false;
if (requestResult.result == Stream.Null)
return false;
FileStream fs = new (savePath, FileMode.Create, FileAccess.Write, FileShare.None);
FileStream fs = new(savePath, FileMode.Create, FileAccess.Write, FileShare.None);
requestResult.result.CopyTo(fs);
fs.Close();
ProcessImage(savePath);
return true;
}
public override string ToString() => $"{base.ToString()} {MangaConnectorId}";
}

View File

@ -17,4 +17,6 @@ public class DownloadCoverFromMangaconnectorWorker(MangaConnectorId<Manga> mcId,
DbContext.Sync();
return [];
}
public override string ToString() => $"{base.ToString()} {MangaConnectorId}";
}

View File

@ -28,4 +28,6 @@ public class RetrieveMangaChaptersFromMangaconnectorWorker(MangaConnectorId<Mang
return [];
}
public override string ToString() => $"{base.ToString()} {MangaConnectorId}";
}

View File

@ -44,4 +44,6 @@ public class MoveFileOrFolderWorker(string toLocation, string fromLocation, IEnu
{
File.Move(from.FullName, toLocation);
}
public override string ToString() => $"{base.ToString()} {FromLocation} {ToLocation}";
}

View File

@ -15,4 +15,6 @@ public class MoveMangaLibraryWorker(Manga manga, FileLibrary toLibrary, IService
return manga.Chapters.Select(c => new MoveFileOrFolderWorker(c.FullArchiveFilePath, oldPath[c])).ToArray<BaseWorker>();
}
public override string ToString() => $"{base.ToString()} {manga} {toLibrary}";
}

View File

@ -16,4 +16,6 @@ public class UpdateChaptersDownloadedWorker(Manga manga, TimeSpan? interval = nu
DbContext.Sync();
return [];
}
public override string ToString() => $"{base.ToString()} {manga}";
}