From 8762cf2cbd2863eb1c3565a5e0bc40a1a8d704bc Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 19 May 2019 15:25:49 +0100 Subject: [PATCH] Override ToString() in resolution. --- Cicm.Database/Models/Resolution.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Cicm.Database/Models/Resolution.cs b/Cicm.Database/Models/Resolution.cs index 9fb32b0e..40dddce9 100644 --- a/Cicm.Database/Models/Resolution.cs +++ b/Cicm.Database/Models/Resolution.cs @@ -51,5 +51,25 @@ namespace Cicm.Database.Models public virtual ICollection ResolutionsByGpu { get; set; } public long? PaletteView => Palette ?? Colors; + + public override string ToString() + { + if(Chars) + { + if(Colors == null) return $"{Width}x{Height} characters"; + + if(Palette != null && Colors != Palette) + return $"{Width}x{Height} characters at {Colors} colors from a palette of {Palette}"; + + return $"{Width}x{Height} characters at {Colors} colors"; + } + + if(Colors == null) return $"{Width}x{Height} pixels"; + + if(Palette != null && Colors != Palette) + return $"{Width}x{Height} pixels at {Colors} colors from a palette of {Palette}"; + + return $"{Width}x{Height} pixels at {Colors} colors"; + } } } \ No newline at end of file