From 04f65ce38321bbfb88e77c2d3fbea726c51a87e4 Mon Sep 17 00:00:00 2001 From: Aptivi Date: Tue, 9 Apr 2024 15:43:06 +0300 Subject: [PATCH] add - brk|doc - Added debugger display to all classes --- We've added debugger view to all the classes. Meanwhile, we've replaced all the List<>'s along the way to make the variables more secure. --- Type: add Breaking: True Doc Required: True Part: 1/1 --- Nettify/EnglishDictionary/DictionaryWord.cs | 8 +++- Nettify/MailAddress/IspInfo/Documentation.cs | 2 + Nettify/MailAddress/IspInfo/EmailProvider.cs | 9 ++-- Nettify/MailAddress/IspInfo/Enable.cs | 4 +- Nettify/MailAddress/IspInfo/IncomingServer.cs | 5 ++- Nettify/MailAddress/IspInfo/LoginButton.cs | 2 + Nettify/MailAddress/IspInfo/LoginPage.cs | 2 + Nettify/MailAddress/IspInfo/LoginPageInfo.cs | 2 + Nettify/MailAddress/IspInfo/OAuth2.cs | 2 + Nettify/MailAddress/IspInfo/OutgoingServer.cs | 5 ++- Nettify/MailAddress/IspInfo/PasswordField.cs | 2 + Nettify/MailAddress/IspInfo/Pop3.cs | 2 + Nettify/MailAddress/IspInfo/UsernameField.cs | 2 + Nettify/MailAddress/IspInfo/WebMail.cs | 2 + Nettify/Radio/ShoutcastServer.cs | 41 ++++++++++++------- Nettify/Radio/StreamInfo.cs | 2 + Nettify/Weather/WeatherForecastInfo.cs | 3 ++ 17 files changed, 71 insertions(+), 24 deletions(-) diff --git a/Nettify/EnglishDictionary/DictionaryWord.cs b/Nettify/EnglishDictionary/DictionaryWord.cs index b0860ae..58d4116 100644 --- a/Nettify/EnglishDictionary/DictionaryWord.cs +++ b/Nettify/EnglishDictionary/DictionaryWord.cs @@ -18,17 +18,20 @@ // using Newtonsoft.Json; +using System.Diagnostics; namespace Nettify.EnglishDictionary { /// /// A dictionary word /// + [DebuggerDisplay("{Word} {PhoneticWord}: {Meanings.Length} meanings")] public partial class DictionaryWord { /// /// The definition class /// + [DebuggerDisplay("{Definition}: {Synonyms.Length} synonyms, {Antonyms.Length} antonyms")] public partial class DefinitionType { /// @@ -59,6 +62,7 @@ public partial class DefinitionType /// /// The license class /// + [DebuggerDisplay("{Name}: {Url}")] public partial class License { /// @@ -77,6 +81,7 @@ public partial class License /// /// Word meaning class /// + [DebuggerDisplay("{PartOfSpeech}: {Definitions.Count} definitions, {Synonyms.Length} synonyms, {Antonyms.Length} antonyms")] public partial class Meaning { /// @@ -107,6 +112,7 @@ public partial class Meaning /// /// Phonetic class /// + [DebuggerDisplay("{Text}: {Audio}")] public partial class Phonetic { /// @@ -116,7 +122,7 @@ public partial class Phonetic public string Text { get; set; } /// - /// Link to the pronounciation, usually in MP3 format. Use NAudio (Windows) to play it. + /// Link to the pronounciation, usually in MP3 format. Use BassBoom to play it after downloading it. /// [JsonProperty("audio")] public string Audio { get; set; } diff --git a/Nettify/MailAddress/IspInfo/Documentation.cs b/Nettify/MailAddress/IspInfo/Documentation.cs index 338d2ff..d9349ee 100644 --- a/Nettify/MailAddress/IspInfo/Documentation.cs +++ b/Nettify/MailAddress/IspInfo/Documentation.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// Documentation information /// [XmlRoot(ElementName = "documentation")] + [DebuggerDisplay("{Description}: {Url}")] public class Documentation { /// diff --git a/Nettify/MailAddress/IspInfo/EmailProvider.cs b/Nettify/MailAddress/IspInfo/EmailProvider.cs index 89bbbf4..343050b 100644 --- a/Nettify/MailAddress/IspInfo/EmailProvider.cs +++ b/Nettify/MailAddress/IspInfo/EmailProvider.cs @@ -17,7 +17,7 @@ // along with this program. If not, see . // -using System.Collections.Generic; +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -27,13 +27,14 @@ namespace Nettify.MailAddress.IspInfo /// The E-mail provider (ISP) information /// [XmlRoot(ElementName = "emailProvider")] + [DebuggerDisplay("{DisplayName}: {Domain.Length} domains with {DominatingDomain} as dominating domain")] public class EmailProvider { /// /// The list of domains /// [XmlElement(ElementName = "domain")] - public List Domain { get; set; } + public string[] Domain { get; set; } /// /// The full name for the ISP mail server @@ -51,7 +52,7 @@ public class EmailProvider /// List of incoming servers /// [XmlElement(ElementName = "incomingServer")] - public List IncomingServer { get; set; } + public IncomingServer[] IncomingServer { get; set; } /// /// Outgoing server @@ -63,7 +64,7 @@ public class EmailProvider /// Documentation information /// [XmlElement(ElementName = "documentation")] - public List Documentation { get; set; } + public Documentation[] Documentation { get; set; } /// /// The dominating domain diff --git a/Nettify/MailAddress/IspInfo/Enable.cs b/Nettify/MailAddress/IspInfo/Enable.cs index 6d1627d..105aeb0 100644 --- a/Nettify/MailAddress/IspInfo/Enable.cs +++ b/Nettify/MailAddress/IspInfo/Enable.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The log-in server enablement instructions /// [XmlRoot(ElementName = "enable")] + [DebuggerDisplay("{Instruction}: {VisitUrl}")] public class Enable { /// @@ -38,7 +40,7 @@ public class Enable /// The URL to visit to enable login /// [XmlAttribute(AttributeName = "visiturl")] - public string Visiturl { get; set; } + public string VisitUrl { get; set; } } } diff --git a/Nettify/MailAddress/IspInfo/IncomingServer.cs b/Nettify/MailAddress/IspInfo/IncomingServer.cs index d1b96b1..12afc6f 100644 --- a/Nettify/MailAddress/IspInfo/IncomingServer.cs +++ b/Nettify/MailAddress/IspInfo/IncomingServer.cs @@ -17,7 +17,7 @@ // along with this program. If not, see . // -using System.Collections.Generic; +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -27,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The incoming server information (POP3 or IMAP) /// [XmlRoot(ElementName = "incomingServer")] + [DebuggerDisplay("{Hostname,nq}:{Port}, {Type}, {Username}")] public class IncomingServer { /// @@ -57,7 +58,7 @@ public class IncomingServer /// The authentication methods /// [XmlElement(ElementName = "authentication")] - public List Authentication { get; set; } + public string[] Authentication { get; set; } /// /// The server type. Usually "imap" or "pop3" diff --git a/Nettify/MailAddress/IspInfo/LoginButton.cs b/Nettify/MailAddress/IspInfo/LoginButton.cs index 0d25f9d..bc5dddd 100644 --- a/Nettify/MailAddress/IspInfo/LoginButton.cs +++ b/Nettify/MailAddress/IspInfo/LoginButton.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The log-in button information /// [XmlRoot(ElementName = "loginButton")] + [DebuggerDisplay("Element ID: {Id}")] public class LoginButton { /// diff --git a/Nettify/MailAddress/IspInfo/LoginPage.cs b/Nettify/MailAddress/IspInfo/LoginPage.cs index 62b217e..85ac27f 100644 --- a/Nettify/MailAddress/IspInfo/LoginPage.cs +++ b/Nettify/MailAddress/IspInfo/LoginPage.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The webmail login page /// [XmlRoot(ElementName = "loginPage")] + [DebuggerDisplay("Webmail: {Url}")] public class LoginPage { /// diff --git a/Nettify/MailAddress/IspInfo/LoginPageInfo.cs b/Nettify/MailAddress/IspInfo/LoginPageInfo.cs index 5b9c85e..b7c17cb 100644 --- a/Nettify/MailAddress/IspInfo/LoginPageInfo.cs +++ b/Nettify/MailAddress/IspInfo/LoginPageInfo.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The login page information for the ISP's webmail /// [XmlRoot(ElementName = "loginPageInfo")] + [DebuggerDisplay("{Username}: {Url}")] public class LoginPageInfo { /// diff --git a/Nettify/MailAddress/IspInfo/OAuth2.cs b/Nettify/MailAddress/IspInfo/OAuth2.cs index f82f1fb..226db8a 100644 --- a/Nettify/MailAddress/IspInfo/OAuth2.cs +++ b/Nettify/MailAddress/IspInfo/OAuth2.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The OAuth2 information for the ISP's mail server /// [XmlRoot(ElementName = "oAuth2")] + [DebuggerDisplay("{Issuer}|{Scope}: {AuthURL}, {TokenURL}")] public class OAuth2 { /// diff --git a/Nettify/MailAddress/IspInfo/OutgoingServer.cs b/Nettify/MailAddress/IspInfo/OutgoingServer.cs index 3e217c8..9e46a9d 100644 --- a/Nettify/MailAddress/IspInfo/OutgoingServer.cs +++ b/Nettify/MailAddress/IspInfo/OutgoingServer.cs @@ -17,7 +17,7 @@ // along with this program. If not, see . // -using System.Collections.Generic; +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -27,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The outgoing server information (SMTP) /// [XmlRoot(ElementName = "outgoingServer")] + [DebuggerDisplay("{Hostname,nq}:{Port}, {SocketType}, {Username}")] public class OutgoingServer { /// @@ -57,7 +58,7 @@ public class OutgoingServer /// The authentication methods /// [XmlElement(ElementName = "authentication")] - public List AuthenticationMethods { get; set; } + public string[] AuthenticationMethods { get; set; } /// /// The server type. Usually "smtp" diff --git a/Nettify/MailAddress/IspInfo/PasswordField.cs b/Nettify/MailAddress/IspInfo/PasswordField.cs index e20e933..b4f7ac8 100644 --- a/Nettify/MailAddress/IspInfo/PasswordField.cs +++ b/Nettify/MailAddress/IspInfo/PasswordField.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The password field information /// [XmlRoot(ElementName = "passwordField")] + [DebuggerDisplay("Password Element: {Id}")] public class PasswordField { /// diff --git a/Nettify/MailAddress/IspInfo/Pop3.cs b/Nettify/MailAddress/IspInfo/Pop3.cs index 8b2daf3..7fe569e 100644 --- a/Nettify/MailAddress/IspInfo/Pop3.cs +++ b/Nettify/MailAddress/IspInfo/Pop3.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// POP3 server properties /// [XmlRoot(ElementName = "pop3")] + [DebuggerDisplay("POP3 settings: LeaveMessagesOnServer = {LeaveMessagesOnServer}")] public class Pop3 { /// diff --git a/Nettify/MailAddress/IspInfo/UsernameField.cs b/Nettify/MailAddress/IspInfo/UsernameField.cs index 6df733d..c41e6dc 100644 --- a/Nettify/MailAddress/IspInfo/UsernameField.cs +++ b/Nettify/MailAddress/IspInfo/UsernameField.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The username field for the webmail /// [XmlRoot(ElementName = "usernameField")] + [DebuggerDisplay("Username Element: {Id}")] public class UsernameField { /// diff --git a/Nettify/MailAddress/IspInfo/WebMail.cs b/Nettify/MailAddress/IspInfo/WebMail.cs index 8b01d3c..b44fd73 100644 --- a/Nettify/MailAddress/IspInfo/WebMail.cs +++ b/Nettify/MailAddress/IspInfo/WebMail.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using System.Diagnostics; using System.Xml.Serialization; namespace Nettify.MailAddress.IspInfo @@ -26,6 +27,7 @@ namespace Nettify.MailAddress.IspInfo /// The webmail configuration /// [XmlRoot(ElementName = "webMail")] + [DebuggerDisplay("Webmail information is{(LoginPageInfo is not null ? \"\" : \" not\"),nq} available")] public class WebMail { /// diff --git a/Nettify/Radio/ShoutcastServer.cs b/Nettify/Radio/ShoutcastServer.cs index a9a1ae5..bb15c47 100644 --- a/Nettify/Radio/ShoutcastServer.cs +++ b/Nettify/Radio/ShoutcastServer.cs @@ -23,12 +23,14 @@ using HtmlAgilityPack; using System.Net.Http; using System.Threading.Tasks; +using System.Diagnostics; namespace Nettify.Radio { /// /// A Shoutcast server /// + [DebuggerDisplay("{ServerHostFull,nq}: S[T:{TotalStreams}|A:{ActiveStreams}] | L[{CurrentListeners}]")] public class ShoutcastServer { private ShoutcastVersion serverVersion; @@ -53,53 +55,64 @@ public class ShoutcastServer /// public int ServerPort { get; } /// - /// Server IP address with port - /// - public string ServerHostFull => ServerHost + ":" + ServerPort; - /// /// Whether the Shoutcast server is using HTTPS or not /// public bool ServerHttps { get; } /// + /// Server IP address with port + /// + public string ServerHostFull => + ServerHost + ":" + ServerPort; + /// /// Server version (1.x, 2.x) /// - public ShoutcastVersion ServerVersion => serverVersion; + public ShoutcastVersion ServerVersion => + serverVersion; /// /// Total number of streams in the server /// - public int TotalStreams => totalStreams; + public int TotalStreams => + totalStreams; /// /// Active streams in the server /// - public int ActiveStreams => activeStreams; + public int ActiveStreams => + activeStreams; /// /// How many people are listening to the server at this time? /// - public int CurrentListeners => currentListeners; + public int CurrentListeners => + currentListeners; /// /// How many listeners did the server ever get at peak times? /// - public int PeakListeners => peakListeners; + public int PeakListeners => + peakListeners; /// /// How many people can listen to the server? /// - public int MaxListeners => maxListeners; + public int MaxListeners => + maxListeners; /// /// How many unique listeners are there? /// - public int UniqueListeners => uniqueListeners; + public int UniqueListeners => + uniqueListeners; /// /// Average time on any active listener connections in seconds /// - public int AverageTime => averageTime; + public int AverageTime => + averageTime; /// /// Average time on any active listener connections in the time span /// - public TimeSpan AverageTimeSpan => TimeSpan.FromSeconds(AverageTime); + public TimeSpan AverageTimeSpan => + TimeSpan.FromSeconds(AverageTime); /// /// Available streams and their statistics /// - public List Streams => streams; + public StreamInfo[] Streams => + [.. streams]; /// /// Connects to the Shoutcast server and gets the information diff --git a/Nettify/Radio/StreamInfo.cs b/Nettify/Radio/StreamInfo.cs index 5d8004b..dde15a5 100644 --- a/Nettify/Radio/StreamInfo.cs +++ b/Nettify/Radio/StreamInfo.cs @@ -18,6 +18,7 @@ // using System; +using System.Diagnostics; using Newtonsoft.Json.Linq; namespace Nettify.Radio @@ -25,6 +26,7 @@ namespace Nettify.Radio /// /// Shoutcast stream information /// + [DebuggerDisplay("{StreamTitle,nq} is now playing {SongTitle} | L[{CurrentListeners}]")] public class StreamInfo { private readonly int currentListeners; diff --git a/Nettify/Weather/WeatherForecastInfo.cs b/Nettify/Weather/WeatherForecastInfo.cs index 22a5e76..be71478 100644 --- a/Nettify/Weather/WeatherForecastInfo.cs +++ b/Nettify/Weather/WeatherForecastInfo.cs @@ -17,11 +17,14 @@ // along with this program. If not, see . // +using System.Diagnostics; + namespace Nettify.Weather { /// /// Forecast information /// + [DebuggerDisplay("{CityName} [{CityID}]: {Weather} @ {Temperature} [{TemperatureMeasurement}]")] public partial class WeatherForecastInfo { ///