diff --git a/.claude/skills/feature-review/references/integration-map.md b/.claude/skills/feature-review/references/integration-map.md index ec88d6d712..8ec8dfcf02 100644 --- a/.claude/skills/feature-review/references/integration-map.md +++ b/.claude/skills/feature-review/references/integration-map.md @@ -40,7 +40,7 @@ sort the hits into the categories below. Some names differ between places (e.g. Remote Desktop, SNMP, SNTP Lookup, Subnet Calculator, TigerVNC, Traceroute, Web Console, Whois. Compare tab handling, profile context menu ("extra items"), tab title, "open in other tool". - **Single view** (`View` only): Dashboard, Network Interface (with profiles), WiFi, Hosts File Editor, - Firewall, Discovery Protocol, Wake on LAN (with profiles), Bit Calculator, Connections, Listeners, + Firewall, LLDP / CDP Capture, Wake on LAN (with profiles), Bit Calculator, Connections, Listeners, Neighbor Table. Compare refresh logic, context menus, admin handling, export. - **Removed but still referenced**: `AWSSessionManager` (hidden in `ApplicationManager`, kept for settings migration, docs page marked as removed) — not a finding unless something still uses it. @@ -50,7 +50,7 @@ sort the hits into the categories below. Some names differ between places (e.g. Review one unit at a time. Tools: - **Network**: Dashboard (+ widgets: Network Connection, IP API, Speed Test), Network Interface, WiFi, IP Scanner, - Port Scanner, Ping Monitor, Traceroute, DNS Lookup, Discovery Protocol, Wake on LAN, SNMP, SNTP Lookup + Port Scanner, Ping Monitor, Traceroute, DNS Lookup, LLDP / CDP Capture, Wake on LAN, SNMP, SNTP Lookup - **Remote access**: Remote Desktop, PowerShell, PuTTY, TigerVNC, Web Console - **System**: Hosts File Editor, Firewall, Connections, Listeners, Neighbor Table - **Lookup / calculators**: Whois, RDAP, IP Geolocation, Lookup (OUI/port), Subnet Calculator, Bit Calculator diff --git a/Source/GlobalAssemblyInfo.cs b/Source/GlobalAssemblyInfo.cs index 6800b95628..253d93713a 100644 --- a/Source/GlobalAssemblyInfo.cs +++ b/Source/GlobalAssemblyInfo.cs @@ -6,5 +6,5 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("2026.11.20.0")] -[assembly: AssemblyFileVersion("2026.11.20.0")] +[assembly: AssemblyVersion("2026.11.21.0")] +[assembly: AssemblyFileVersion("2026.11.21.0")] diff --git a/Source/NETworkManager.Converters/DiscoveryProtocolToStringConverter.cs b/Source/NETworkManager.Converters/LLDPCDPProtocolToStringConverter.cs similarity index 60% rename from Source/NETworkManager.Converters/DiscoveryProtocolToStringConverter.cs rename to Source/NETworkManager.Converters/LLDPCDPProtocolToStringConverter.cs index 47874862a7..9393b0bb5b 100644 --- a/Source/NETworkManager.Converters/DiscoveryProtocolToStringConverter.cs +++ b/Source/NETworkManager.Converters/LLDPCDPProtocolToStringConverter.cs @@ -7,24 +7,24 @@ namespace NETworkManager.Converters; /// -/// Convert to translated or wise versa. +/// Convert to translated or wise versa. /// -public sealed class DiscoveryProtocolToStringConverter : IValueConverter +public sealed class LLDPCDPProtocolToStringConverter : IValueConverter { /// - /// Convert to translated . + /// Convert to translated . /// - /// Object from type . + /// Object from type . /// /// /// - /// Translated . + /// Translated . public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return value is not DiscoveryProtocol discoveryProtocol + return value is not LLDPCDPProtocol protocol ? "-/-" - : ResourceTranslator.Translate(ResourceIdentifier.DiscoveryProtocol, - discoveryProtocol); + : ResourceTranslator.Translate(ResourceIdentifier.LLDPCDPProtocol, + protocol); } /// diff --git a/Source/NETworkManager.Documentation/DocumentationIdentifier.cs b/Source/NETworkManager.Documentation/DocumentationIdentifier.cs index 09e39a12a8..9dc62a3e20 100644 --- a/Source/NETworkManager.Documentation/DocumentationIdentifier.cs +++ b/Source/NETworkManager.Documentation/DocumentationIdentifier.cs @@ -96,9 +96,9 @@ public enum DocumentationIdentifier ApplicationFirewall, /// - /// Discovery Protocol documentation page. + /// LLDP / CDP Capture documentation page. /// - ApplicationDiscoveryProtocol, + ApplicationLLDPCDPCapture, /// /// mDNS Discovery documentation page. diff --git a/Source/NETworkManager.Documentation/DocumentationManager.cs b/Source/NETworkManager.Documentation/DocumentationManager.cs index e816644b2b..5da42abbc1 100644 --- a/Source/NETworkManager.Documentation/DocumentationManager.cs +++ b/Source/NETworkManager.Documentation/DocumentationManager.cs @@ -72,8 +72,8 @@ public static class DocumentationManager new DocumentationInfo(DocumentationIdentifier.ApplicationFirewall, @"docs/application/firewall"), - new DocumentationInfo(DocumentationIdentifier.ApplicationDiscoveryProtocol, - @"docs/application/discovery-protocol"), + new DocumentationInfo(DocumentationIdentifier.ApplicationLLDPCDPCapture, + @"docs/application/lldp-cdp-capture"), new DocumentationInfo(DocumentationIdentifier.ApplicationMDNSDiscovery, @"docs/application/mdns-discovery"), @@ -224,7 +224,7 @@ public static DocumentationIdentifier GetIdentifierByApplicationName(Application ApplicationName.SNMP => DocumentationIdentifier.ApplicationSnmp, ApplicationName.SNTPLookup => DocumentationIdentifier.ApplicationSntpLookup, ApplicationName.HostsFileEditor => DocumentationIdentifier.ApplicationHostsFileEditor, - ApplicationName.DiscoveryProtocol => DocumentationIdentifier.ApplicationDiscoveryProtocol, + ApplicationName.LLDPCDPCapture => DocumentationIdentifier.ApplicationLLDPCDPCapture, ApplicationName.MDNSDiscovery => DocumentationIdentifier.ApplicationMDNSDiscovery, ApplicationName.Firewall => DocumentationIdentifier.ApplicationFirewall, ApplicationName.WakeOnLAN => DocumentationIdentifier.ApplicationWakeOnLan, diff --git a/Source/NETworkManager.Localization/ResourceIdentifier.cs b/Source/NETworkManager.Localization/ResourceIdentifier.cs index 2c3e2f925e..03f97b2f4f 100644 --- a/Source/NETworkManager.Localization/ResourceIdentifier.cs +++ b/Source/NETworkManager.Localization/ResourceIdentifier.cs @@ -6,7 +6,7 @@ public enum ResourceIdentifier AccentGlowIntensity, AnimationMode, ApplicationName, - DiscoveryProtocol, + LLDPCDPProtocol, IPStatus, PortState, ProfileName, diff --git a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs index 7580801224..3890e3a6d2 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs +++ b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs @@ -1131,15 +1131,6 @@ public static string ApplicationName_Dashboard { } } - /// - /// Looks up a localized string similar to Discovery Protocol. - /// - public static string ApplicationName_DiscoveryProtocol { - get { - return ResourceManager.GetString("ApplicationName_DiscoveryProtocol", resourceCulture); - } - } - /// /// Looks up a localized string similar to DNS Lookup. /// @@ -1203,6 +1194,15 @@ public static string ApplicationName_Listeners { } } + /// + /// Looks up a localized string similar to LLDP / CDP Capture. + /// + public static string ApplicationName_LLDPCDPCapture { + get { + return ResourceManager.GetString("ApplicationName_LLDPCDPCapture", resourceCulture); + } + } + /// /// Looks up a localized string similar to Lookup. /// @@ -3856,42 +3856,6 @@ public static string Disconnected { } } - /// - /// Looks up a localized string similar to Discovery Protocol. - /// - public static string DiscoveryProtocol { - get { - return ResourceManager.GetString("DiscoveryProtocol", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to CDP. - /// - public static string DiscoveryProtocol_Cdp { - get { - return ResourceManager.GetString("DiscoveryProtocol_Cdp", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to LLDP. - /// - public static string DiscoveryProtocol_Lldp { - get { - return ResourceManager.GetString("DiscoveryProtocol_Lldp", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to LLDP / CDP. - /// - public static string DiscoveryProtocol_LldpCdp { - get { - return ResourceManager.GetString("DiscoveryProtocol_LldpCdp", resourceCulture); - } - } - /// /// Looks up a localized string similar to Display. /// @@ -7878,6 +7842,42 @@ public static string LldpCdp { } } + /// + /// Looks up a localized string similar to LLDP / CDP Capture. + /// + public static string LLDPCDPCapture { + get { + return ResourceManager.GetString("LLDPCDPCapture", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CDP. + /// + public static string LLDPCDPProtocol_Cdp { + get { + return ResourceManager.GetString("LLDPCDPProtocol_Cdp", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LLDP. + /// + public static string LLDPCDPProtocol_Lldp { + get { + return ResourceManager.GetString("LLDPCDPProtocol_Lldp", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LLDP / CDP. + /// + public static string LLDPCDPProtocol_LldpCdp { + get { + return ResourceManager.GetString("LLDPCDPProtocol_LldpCdp", resourceCulture); + } + } + /// /// Looks up a localized string similar to Loading firewall rules.... /// @@ -9165,15 +9165,6 @@ public static string NoAnswer { } } - /// - /// Looks up a localized string similar to No discovery protocol packages received!. - /// - public static string NoDiscoveryProtocolPackagesReceived { - get { - return ResourceManager.GetString("NoDiscoveryProtocolPackagesReceived", resourceCulture); - } - } - /// /// Looks up a localized string similar to No DNS record found for "{0}"! Check your input and the settings.. /// @@ -9201,6 +9192,15 @@ public static string NoFirewallRulesFoundMessage { } } + /// + /// Looks up a localized string similar to No LLDP or CDP packets received!. + /// + public static string NoLLDPOrCDPPacketsReceived { + get { + return ResourceManager.GetString("NoLLDPOrCDPPacketsReceived", resourceCulture); + } + } + /// /// Looks up a localized string similar to No matching commands!. /// diff --git a/Source/NETworkManager.Localization/Resources/Strings.resx b/Source/NETworkManager.Localization/Resources/Strings.resx index 5d0258b122..fb17fd0761 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.resx +++ b/Source/NETworkManager.Localization/Resources/Strings.resx @@ -2617,22 +2617,22 @@ is disabled! Capture network packets to view LLDP or CDP information! - - No discovery protocol packages received! + + No LLDP or CDP packets received! Capturing network packages... - - Discovery Protocol + + LLDP / CDP Capture - + CDP - + LLDP - + LLDP / CDP @@ -2674,8 +2674,8 @@ is disabled! Dashboard - - Discovery Protocol + + LLDP / CDP Capture DNS Lookup diff --git a/Source/NETworkManager.Models/ApplicationManager.cs b/Source/NETworkManager.Models/ApplicationManager.cs index 7cf57f4b17..d8ba395ae2 100644 --- a/Source/NETworkManager.Models/ApplicationManager.cs +++ b/Source/NETworkManager.Models/ApplicationManager.cs @@ -29,7 +29,7 @@ public static IEnumerable GetNames() public static IEnumerable GetDefaultList() { #pragma warning disable CS0618 - return [.. GetNames().Where(x => x != ApplicationName.None && x != ApplicationName.AWSSessionManager && x != ApplicationName.ARPTable).Select(name => new ApplicationInfo(name, true, name == ApplicationName.Dashboard))]; + return [.. GetNames().Where(x => x != ApplicationName.None && x != ApplicationName.AWSSessionManager && x != ApplicationName.ARPTable && x != ApplicationName.DiscoveryProtocol).Select(name => new ApplicationInfo(name, true, name == ApplicationName.Dashboard))]; #pragma warning restore CS0618 } @@ -113,7 +113,7 @@ public static Canvas GetIcon(ApplicationName name) case ApplicationName.HostsFileEditor: canvas.Children.Add(new LucideIcon { Kind = LucideIconKind.FilePenLine }); break; - case ApplicationName.DiscoveryProtocol: + case ApplicationName.LLDPCDPCapture: canvas.Children.Add(new LucideIcon { Kind = LucideIconKind.ArrowLeftRight }); break; case ApplicationName.MDNSDiscovery: diff --git a/Source/NETworkManager.Models/ApplicationName.cs b/Source/NETworkManager.Models/ApplicationName.cs index 0df312ec59..b8d49f845a 100644 --- a/Source/NETworkManager.Models/ApplicationName.cs +++ b/Source/NETworkManager.Models/ApplicationName.cs @@ -103,9 +103,9 @@ public enum ApplicationName Firewall, /// - /// Discovery protocol application. + /// LLDP / CDP capture application. /// - DiscoveryProtocol, + LLDPCDPCapture, /// /// mDNS Discovery (multicast DNS service discovery) application. @@ -167,5 +167,12 @@ public enum ApplicationName /// with "ARPTable" can still be deserialized; migrated in SettingsManager.Upgrade(). /// [System.Obsolete("Use NeighborTable instead.")] - ARPTable + ARPTable, + + /// + /// Obsolete: renamed to . Kept so that old settings files + /// with "DiscoveryProtocol" can still be deserialized; migrated in SettingsManager.Upgrade(). + /// + [System.Obsolete("Use LLDPCDPCapture instead.")] + DiscoveryProtocol } diff --git a/Source/NETworkManager.Models/Export/ExportManager.DiscoveryProtocolPackageInfo.cs b/Source/NETworkManager.Models/Export/ExportManager.DiscoveryProtocolPackageInfo.cs deleted file mode 100644 index 3946074658..0000000000 --- a/Source/NETworkManager.Models/Export/ExportManager.DiscoveryProtocolPackageInfo.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using NETworkManager.Models.Network; - -namespace NETworkManager.Models.Export; - -public static partial class ExportManager -{ - /// - /// Exported fields of a in the order shown. - /// - private static readonly ExportField[] DiscoveryProtocolPackageInfoExportFields = - [ - new(nameof(DiscoveryProtocolPackageInfo.Device), x => x.Device, true), - new(nameof(DiscoveryProtocolPackageInfo.DeviceDescription), x => x.DeviceDescription, true), - new(nameof(DiscoveryProtocolPackageInfo.Port), x => x.Port, true), - new(nameof(DiscoveryProtocolPackageInfo.PortDescription), x => x.PortDescription, true), - new(nameof(DiscoveryProtocolPackageInfo.Model), x => x.Model, true), - new(nameof(DiscoveryProtocolPackageInfo.VLAN), x => x.VLAN), - new(nameof(DiscoveryProtocolPackageInfo.IPAddress), x => x.IPAddress, true), - new(nameof(DiscoveryProtocolPackageInfo.Management), x => x.Management, true), - new(nameof(DiscoveryProtocolPackageInfo.ChassisId), x => x.ChassisId, true), - new(nameof(DiscoveryProtocolPackageInfo.Protocol), x => x.Protocol), - new(nameof(DiscoveryProtocolPackageInfo.TimeToLive), x => x.TimeToLive), - new(nameof(DiscoveryProtocolPackageInfo.LocalConnection), x => x.LocalConnection, true), - new(nameof(DiscoveryProtocolPackageInfo.LocalInterface), x => x.LocalInterface, true) - ]; - - /// - /// Method to export objects from type to a file. - /// - /// Path to the export file. - /// Allowed are CSV, XML or JSON. - /// Objects as to export. - public static void Export(string filePath, ExportFileType fileType, - IReadOnlyList collection) - { - Export(filePath, fileType, collection, DiscoveryProtocolPackageInfoExportFields, - ApplicationName.DiscoveryProtocol); - } -} diff --git a/Source/NETworkManager.Models/Export/ExportManager.LLDPCDPPackageInfo.cs b/Source/NETworkManager.Models/Export/ExportManager.LLDPCDPPackageInfo.cs new file mode 100644 index 0000000000..83b267c46c --- /dev/null +++ b/Source/NETworkManager.Models/Export/ExportManager.LLDPCDPPackageInfo.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using NETworkManager.Models.Network; + +namespace NETworkManager.Models.Export; + +public static partial class ExportManager +{ + /// + /// Exported fields of a in the order shown. + /// + private static readonly ExportField[] LLDPCDPPackageInfoExportFields = + [ + new(nameof(LLDPCDPPackageInfo.Device), x => x.Device, true), + new(nameof(LLDPCDPPackageInfo.DeviceDescription), x => x.DeviceDescription, true), + new(nameof(LLDPCDPPackageInfo.Port), x => x.Port, true), + new(nameof(LLDPCDPPackageInfo.PortDescription), x => x.PortDescription, true), + new(nameof(LLDPCDPPackageInfo.Model), x => x.Model, true), + new(nameof(LLDPCDPPackageInfo.VLAN), x => x.VLAN), + new(nameof(LLDPCDPPackageInfo.IPAddress), x => x.IPAddress, true), + new(nameof(LLDPCDPPackageInfo.Management), x => x.Management, true), + new(nameof(LLDPCDPPackageInfo.ChassisId), x => x.ChassisId, true), + new(nameof(LLDPCDPPackageInfo.Protocol), x => x.Protocol), + new(nameof(LLDPCDPPackageInfo.TimeToLive), x => x.TimeToLive), + new(nameof(LLDPCDPPackageInfo.LocalConnection), x => x.LocalConnection, true), + new(nameof(LLDPCDPPackageInfo.LocalInterface), x => x.LocalInterface, true) + ]; + + /// + /// Method to export objects from type to a file. + /// + /// Path to the export file. + /// Allowed are CSV, XML or JSON. + /// Objects as to export. + public static void Export(string filePath, ExportFileType fileType, + IReadOnlyList collection) + { + Export(filePath, fileType, collection, LLDPCDPPackageInfoExportFields, + ApplicationName.LLDPCDPCapture); + } +} diff --git a/Source/NETworkManager.Models/Network/DiscoveryProtocolErrorArgs.cs b/Source/NETworkManager.Models/Network/DiscoveryProtocolErrorArgs.cs deleted file mode 100644 index ddc1fb2667..0000000000 --- a/Source/NETworkManager.Models/Network/DiscoveryProtocolErrorArgs.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace NETworkManager.Models.Network; - -/// -/// Contains the error message of a error. -/// -public class DiscoveryProtocolErrorArgs : EventArgs -{ - /// - /// Creates a new instance of with the given error message. - /// - /// Error message of the error. - public DiscoveryProtocolErrorArgs(string errorMessage) - { - Message = errorMessage; - } - - /// - /// Error message of the error. - /// - public string Message { get; private set; } -} \ No newline at end of file diff --git a/Source/NETworkManager.Models/Network/DiscoveryProtocolWarningArgs.cs b/Source/NETworkManager.Models/Network/DiscoveryProtocolWarningArgs.cs deleted file mode 100644 index 45b55fb229..0000000000 --- a/Source/NETworkManager.Models/Network/DiscoveryProtocolWarningArgs.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace NETworkManager.Models.Network; - -/// -/// Contains the warning message of a warning. -/// -public class DiscoveryProtocolWarningArgs : EventArgs -{ - /// - /// Creates a new instance of with the given warning message. - /// - /// Warning message of the warning. - public DiscoveryProtocolWarningArgs(string message) - { - Message = message; - } - - /// - /// Warning message of the warning. - /// - public string Message { get; private set; } -} \ No newline at end of file diff --git a/Source/NETworkManager.Models/Network/DiscoveryProtocol.cs b/Source/NETworkManager.Models/Network/LLDPCDPCapture.cs similarity index 77% rename from Source/NETworkManager.Models/Network/DiscoveryProtocol.cs rename to Source/NETworkManager.Models/Network/LLDPCDPCapture.cs index 81badd3f5c..a4c325a54f 100644 --- a/Source/NETworkManager.Models/Network/DiscoveryProtocol.cs +++ b/Source/NETworkManager.Models/Network/LLDPCDPCapture.cs @@ -10,7 +10,7 @@ namespace NETworkManager.Models.Network; /// /// Class to capture network discovery protocol packages. /// -public class DiscoveryProtocolCapture +public class LLDPCDPCapture { /// /// Holds the PowerShell script which is loaded when the class is initialized. @@ -18,9 +18,9 @@ public class DiscoveryProtocolCapture private readonly string _psDiscoveryProtocolModule; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public DiscoveryProtocolCapture() + public LLDPCDPCapture() { using var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("NETworkManager.Models.Resources.PSDiscoveryProtocol.psm1"); @@ -34,13 +34,13 @@ public DiscoveryProtocolCapture() /// /// Is triggered when a network package with a discovery protocol is received. /// - public event EventHandler PackageReceived; + public event EventHandler PackageReceived; /// /// Triggers the event. /// - /// Passes to the event. - protected virtual void OnPackageReceived(DiscoveryProtocolPackageArgs e) + /// Passes to the event. + protected virtual void OnPackageReceived(LLDPCDPPackageArgs e) { PackageReceived?.Invoke(this, e); } @@ -48,14 +48,14 @@ protected virtual void OnPackageReceived(DiscoveryProtocolPackageArgs e) /// /// Is triggered when an error occurs during the capturing. /// - public event EventHandler ErrorReceived; + public event EventHandler ErrorReceived; /// /// Triggers the event. /// - /// Passes to the event. - protected virtual void OnErrorReceived(DiscoveryProtocolErrorArgs e) + /// Passes to the event. + protected virtual void OnErrorReceived(LLDPCDPErrorArgs e) { ErrorReceived?.Invoke(this, e); } @@ -63,13 +63,13 @@ protected virtual void OnErrorReceived(DiscoveryProtocolErrorArgs e) /// /// Is triggered when a warning occurs during the capturing. /// - public event EventHandler WarningReceived; + public event EventHandler WarningReceived; /// /// Triggers the event. /// - /// Passes to the event. - protected virtual void OnWarningReceived(DiscoveryProtocolWarningArgs e) + /// Passes to the event. + protected virtual void OnWarningReceived(LLDPCDPWarningArgs e) { WarningReceived?.Invoke(this, e); } @@ -94,14 +94,14 @@ protected virtual void OnComplete() /// packets according to the protocol. /// /// Duration in seconds. - /// to filter on. - public void CaptureAsync(int duration, DiscoveryProtocol protocol) + /// to filter on. + public void CaptureAsync(int duration, LLDPCDPProtocol protocol) { Task.Run(() => { using var ps = System.Management.Automation.PowerShell.Create(); - var typeParam = protocol != DiscoveryProtocol.LldpCdp ? $" -Type {protocol.ToString().ToUpper()}" : ""; + var typeParam = protocol != LLDPCDPProtocol.LldpCdp ? $" -Type {protocol.ToString().ToUpper()}" : ""; ps.AddScript($@" Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process @@ -123,7 +123,7 @@ public void CaptureAsync(int duration, DiscoveryProtocol protocol) stringBuilder.Append(error.Exception.Message); } - OnErrorReceived(new DiscoveryProtocolErrorArgs(stringBuilder.ToString())); + OnErrorReceived(new LLDPCDPErrorArgs(stringBuilder.ToString())); } if (ps.Streams.Warning.Count > 0) @@ -138,7 +138,7 @@ public void CaptureAsync(int duration, DiscoveryProtocol protocol) stringBuilder.Append(warning.Message); } - OnWarningReceived(new DiscoveryProtocolWarningArgs(stringBuilder.ToString())); + OnWarningReceived(new LLDPCDPWarningArgs(stringBuilder.ToString())); } foreach (var result in results) @@ -156,7 +156,7 @@ public void CaptureAsync(int duration, DiscoveryProtocol protocol) if (result.Properties["Management"] != null) managements.AddRange(result.Properties["Management"].Value as List); - var packageInfo = new DiscoveryProtocolPackageInfo + var packageInfo = new LLDPCDPPackageInfo { Device = result.Properties["Device"]?.Value.ToString(), DeviceDescription = result.Properties["SystemDescription"]?.Value.ToString(), @@ -173,7 +173,7 @@ public void CaptureAsync(int duration, DiscoveryProtocol protocol) LocalInterface = result.Properties["Interface"]?.Value.ToString() }; - OnPackageReceived(new DiscoveryProtocolPackageArgs(packageInfo)); + OnPackageReceived(new LLDPCDPPackageArgs(packageInfo)); } OnComplete(); diff --git a/Source/NETworkManager.Models/Network/LLDPCDPErrorArgs.cs b/Source/NETworkManager.Models/Network/LLDPCDPErrorArgs.cs new file mode 100644 index 0000000000..6a3ce94708 --- /dev/null +++ b/Source/NETworkManager.Models/Network/LLDPCDPErrorArgs.cs @@ -0,0 +1,23 @@ +using System; + +namespace NETworkManager.Models.Network; + +/// +/// Contains the error message of a error. +/// +public class LLDPCDPErrorArgs : EventArgs +{ + /// + /// Creates a new instance of with the given error message. + /// + /// Error message of the error. + public LLDPCDPErrorArgs(string errorMessage) + { + Message = errorMessage; + } + + /// + /// Error message of the error. + /// + public string Message { get; private set; } +} \ No newline at end of file diff --git a/Source/NETworkManager.Models/Network/DiscoveryProtocolPackageArgs.cs b/Source/NETworkManager.Models/Network/LLDPCDPPackageArgs.cs similarity index 52% rename from Source/NETworkManager.Models/Network/DiscoveryProtocolPackageArgs.cs rename to Source/NETworkManager.Models/Network/LLDPCDPPackageArgs.cs index 8fb09f70e1..e43088c49f 100644 --- a/Source/NETworkManager.Models/Network/DiscoveryProtocolPackageArgs.cs +++ b/Source/NETworkManager.Models/Network/LLDPCDPPackageArgs.cs @@ -5,14 +5,14 @@ namespace NETworkManager.Models.Network; /// /// Event arguments when a discovery protocol package is returned. /// -public class DiscoveryProtocolPackageArgs : EventArgs +public class LLDPCDPPackageArgs : EventArgs { /// - /// Creates a new instance of with the given - /// . + /// Creates a new instance of with the given + /// . /// /// Discovery protocol package. - public DiscoveryProtocolPackageArgs(DiscoveryProtocolPackageInfo packageInfo) + public LLDPCDPPackageArgs(LLDPCDPPackageInfo packageInfo) { PackageInfo = packageInfo; } @@ -20,5 +20,5 @@ public DiscoveryProtocolPackageArgs(DiscoveryProtocolPackageInfo packageInfo) /// /// Discovery protocol package. /// - public DiscoveryProtocolPackageInfo PackageInfo { get; set; } + public LLDPCDPPackageInfo PackageInfo { get; set; } } \ No newline at end of file diff --git a/Source/NETworkManager.Models/Network/DiscoveryProtocolPackageInfo.cs b/Source/NETworkManager.Models/Network/LLDPCDPPackageInfo.cs similarity index 91% rename from Source/NETworkManager.Models/Network/DiscoveryProtocolPackageInfo.cs rename to Source/NETworkManager.Models/Network/LLDPCDPPackageInfo.cs index a8aac777ff..efc756e002 100644 --- a/Source/NETworkManager.Models/Network/DiscoveryProtocolPackageInfo.cs +++ b/Source/NETworkManager.Models/Network/LLDPCDPPackageInfo.cs @@ -3,12 +3,12 @@ /// /// Class contains discovery protocol package information's. /// -public class DiscoveryProtocolPackageInfo +public class LLDPCDPPackageInfo { /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public DiscoveryProtocolPackageInfo() + public LLDPCDPPackageInfo() { } diff --git a/Source/NETworkManager.Models/Network/DiscoveryProtocol.Protocol.cs b/Source/NETworkManager.Models/Network/LLDPCDPProtocol.cs similarity index 93% rename from Source/NETworkManager.Models/Network/DiscoveryProtocol.Protocol.cs rename to Source/NETworkManager.Models/Network/LLDPCDPProtocol.cs index 2a325bbab5..5d1c2197f4 100644 --- a/Source/NETworkManager.Models/Network/DiscoveryProtocol.Protocol.cs +++ b/Source/NETworkManager.Models/Network/LLDPCDPProtocol.cs @@ -3,7 +3,7 @@ /// /// Represents all discovery protocols. /// -public enum DiscoveryProtocol +public enum LLDPCDPProtocol { /// /// Link layer and Cisco discovery protocol. diff --git a/Source/NETworkManager.Models/Network/LLDPCDPWarningArgs.cs b/Source/NETworkManager.Models/Network/LLDPCDPWarningArgs.cs new file mode 100644 index 0000000000..8e1abd38d4 --- /dev/null +++ b/Source/NETworkManager.Models/Network/LLDPCDPWarningArgs.cs @@ -0,0 +1,23 @@ +using System; + +namespace NETworkManager.Models.Network; + +/// +/// Contains the warning message of a warning. +/// +public class LLDPCDPWarningArgs : EventArgs +{ + /// + /// Creates a new instance of with the given warning message. + /// + /// Warning message of the warning. + public LLDPCDPWarningArgs(string message) + { + Message = message; + } + + /// + /// Warning message of the warning. + /// + public string Message { get; private set; } +} \ No newline at end of file diff --git a/Source/NETworkManager.Settings/AppearanceManager.cs b/Source/NETworkManager.Settings/AppearanceManager.cs index 4565cca5ce..7a6bc13006 100644 --- a/Source/NETworkManager.Settings/AppearanceManager.cs +++ b/Source/NETworkManager.Settings/AppearanceManager.cs @@ -232,6 +232,15 @@ static AppearanceManager() /// public static void Load() { + // Screenshot mode: the default theme and accent (Dark / Mint) for consistent screenshots, without changing the + // settings + if (CommandLineManager.Current.Screenshot) + { + ChangeTheme(GlobalStaticConfiguration.Appearance_Theme, GlobalStaticConfiguration.Appearance_Accent); + + return; + } + if (SettingsManager.Current.Appearance_UseCustomTheme && CustomThemes.Count > 0) { ChangeTheme( @@ -300,7 +309,9 @@ private static void LoadCustomThemes() /// /// Amount of the accent in the glow (0 = off). /// - private static double GetAccentGlowAmount() => SettingsManager.Current?.Appearance_AccentGlowIntensity switch + private static double GetAccentGlowAmount() => (CommandLineManager.Current.Screenshot + ? GlobalStaticConfiguration.Appearance_AccentGlowIntensity // Screenshot mode: default, like the theme + : SettingsManager.Current?.Appearance_AccentGlowIntensity) switch { AccentGlowIntensity.Subtle => 0.06, AccentGlowIntensity.Medium => 0.10, diff --git a/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs b/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs index 7b0120fe84..869ca70bd8 100644 --- a/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs +++ b/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs @@ -347,10 +347,10 @@ public static class GlobalStaticConfiguration public static ExportFileType Firewall_ExportFileType => ExportFileType.Csv; public static bool Firewall_ShowAllRules => false; - // Application: Discovery Protocol - public static DiscoveryProtocol DiscoveryProtocol_Protocol => DiscoveryProtocol.LldpCdp; - public static int DiscoveryProtocol_Duration => 60; - public static ExportFileType DiscoveryProtocol_ExportFileType => ExportFileType.Csv; + // Application: LLDP / CDP Capture + public static LLDPCDPProtocol LLDPCDPCapture_Protocol => LLDPCDPProtocol.LldpCdp; + public static int LLDPCDPCapture_Duration => 60; + public static ExportFileType LLDPCDPCapture_ExportFileType => ExportFileType.Csv; // Application: mDNS Discovery public static string MDNSDiscovery_ServiceType => "*"; diff --git a/Source/NETworkManager.Settings/SettingsInfo.cs b/Source/NETworkManager.Settings/SettingsInfo.cs index 807838e473..9e8eca8dc2 100644 --- a/Source/NETworkManager.Settings/SettingsInfo.cs +++ b/Source/NETworkManager.Settings/SettingsInfo.cs @@ -3963,9 +3963,9 @@ public bool Firewall_ShowAllRules #endregion - #region Discovery Protocol + #region LLDP / CDP Capture - public DiscoveryProtocol DiscoveryProtocol_Protocol + public LLDPCDPProtocol LLDPCDPCapture_Protocol { get; set @@ -3976,9 +3976,9 @@ public DiscoveryProtocol DiscoveryProtocol_Protocol field = value; OnPropertyChanged(); } - } = GlobalStaticConfiguration.DiscoveryProtocol_Protocol; + } = GlobalStaticConfiguration.LLDPCDPCapture_Protocol; - public int DiscoveryProtocol_Duration + public int LLDPCDPCapture_Duration { get; set @@ -3989,9 +3989,9 @@ public int DiscoveryProtocol_Duration field = value; OnPropertyChanged(); } - } = GlobalStaticConfiguration.DiscoveryProtocol_Duration; + } = GlobalStaticConfiguration.LLDPCDPCapture_Duration; - public string DiscoveryProtocol_ExportFilePath + public string LLDPCDPCapture_ExportFilePath { get; set @@ -4004,7 +4004,7 @@ public string DiscoveryProtocol_ExportFilePath } } - public ExportFileType DiscoveryProtocol_ExportFileType + public ExportFileType LLDPCDPCapture_ExportFileType { get; set @@ -4015,7 +4015,7 @@ public ExportFileType DiscoveryProtocol_ExportFileType field = value; OnPropertyChanged(); } - } = GlobalStaticConfiguration.DiscoveryProtocol_ExportFileType; + } = GlobalStaticConfiguration.LLDPCDPCapture_ExportFileType; #endregion diff --git a/Source/NETworkManager.Settings/SettingsManager.cs b/Source/NETworkManager.Settings/SettingsManager.cs index ecd461ab0a..03114efb00 100644 --- a/Source/NETworkManager.Settings/SettingsManager.cs +++ b/Source/NETworkManager.Settings/SettingsManager.cs @@ -941,6 +941,26 @@ private static void UpgradeToLatest(Version version) defaultList.First(x => x.Name == ApplicationName.MDNSDiscovery)); } + // Replace DiscoveryProtocol with LLDPCDPCapture +#pragma warning disable CS0618 + var discoveryProtocolEntry = + Current.General_ApplicationList.FirstOrDefault(x => x.Name == ApplicationName.DiscoveryProtocol); +#pragma warning restore CS0618 + + if (discoveryProtocolEntry != null) + { + Log.Info("Replacing obsolete \"DiscoveryProtocol\" app entry with \"LLDPCDPCapture\"..."); + + var index = Current.General_ApplicationList.IndexOf(discoveryProtocolEntry); + var lldpCdpCaptureEntry = + ApplicationManager.GetDefaultList().First(x => x.Name == ApplicationName.LLDPCDPCapture); + + lldpCdpCaptureEntry.IsVisible = discoveryProtocolEntry.IsVisible; + lldpCdpCaptureEntry.IsDefault = discoveryProtocolEntry.IsDefault; + + Current.General_ApplicationList[index] = lldpCdpCaptureEntry; + } + // mDNS Discovery - Add the missing default service type profiles (like the port profiles of the Port Scanner) foreach (var profile in MDNSServiceTypeProfile.GetDefaultList().Where(profile => MDNSServiceTypeProfile.FindByName(Current.MDNSDiscovery_ServiceTypeProfiles, profile.Name) == null)) diff --git a/Source/NETworkManager.Tests/Export/ExportManagerToolTests.cs b/Source/NETworkManager.Tests/Export/ExportManagerToolTests.cs index 8b949a27a3..a36c755ba8 100644 --- a/Source/NETworkManager.Tests/Export/ExportManagerToolTests.cs +++ b/Source/NETworkManager.Tests/Export/ExportManagerToolTests.cs @@ -288,14 +288,14 @@ public void NeighborTable_Consistent() #endregion - #region Discovery Protocol + #region LLDP / CDP Capture [Fact] - public void DiscoveryProtocol_Consistent() + public void LLDPCDPCapture_Consistent() { var files = ExportAll((f, t) => ExportManager.Export(f, t, [ - new DiscoveryProtocolPackageInfo + new LLDPCDPPackageInfo { Device = "sw1", DeviceDescription = "Cisco IOS, Version 15", Port = "Gi0/1", PortDescription = "Uplink", Model = "C2960", VLAN = "10", IPAddress = "10.0.0.2", Protocol = "CDP", TimeToLive = "180", diff --git a/Source/NETworkManager/MainWindow.xaml.cs b/Source/NETworkManager/MainWindow.xaml.cs index ee65691ff6..da3f478990 100644 --- a/Source/NETworkManager/MainWindow.xaml.cs +++ b/Source/NETworkManager/MainWindow.xaml.cs @@ -693,7 +693,7 @@ private void LoadApplicationList() private SNTPLookupHostView _sntpLookupHostView; private HostsFileEditorView _hostsFileEditorView; private FirewallView _firewallView; - private DiscoveryProtocolView _discoveryProtocolView; + private LLDPCDPCaptureView _lldpCdpCaptureView; private MDNSDiscoveryView _mdnsDiscoveryView; private WakeOnLANView _wakeOnLanView; private SubnetCalculatorHostView _subnetCalculatorHostView; @@ -851,13 +851,13 @@ private void OnApplicationViewVisible(ApplicationName name) ContentControlApplication.Content = _firewallView; break; - case ApplicationName.DiscoveryProtocol: - if (_discoveryProtocolView == null) - _discoveryProtocolView = new DiscoveryProtocolView(); + case ApplicationName.LLDPCDPCapture: + if (_lldpCdpCaptureView == null) + _lldpCdpCaptureView = new LLDPCDPCaptureView(); else - _discoveryProtocolView.OnViewVisible(); + _lldpCdpCaptureView.OnViewVisible(); - ContentControlApplication.Content = _discoveryProtocolView; + ContentControlApplication.Content = _lldpCdpCaptureView; break; case ApplicationName.MDNSDiscovery: if (_mdnsDiscoveryView == null) @@ -1008,8 +1008,8 @@ private void OnApplicationViewHide(ApplicationName name) case ApplicationName.Firewall: _firewallView?.OnViewHide(); break; - case ApplicationName.DiscoveryProtocol: - _discoveryProtocolView?.OnViewHide(); + case ApplicationName.LLDPCDPCapture: + _lldpCdpCaptureView?.OnViewHide(); break; case ApplicationName.MDNSDiscovery: _mdnsDiscoveryView?.OnViewHide(); diff --git a/Source/NETworkManager/RunCommandManager.cs b/Source/NETworkManager/RunCommandManager.cs index f8ad26d44b..6c67912b8b 100644 --- a/Source/NETworkManager/RunCommandManager.cs +++ b/Source/NETworkManager/RunCommandManager.cs @@ -513,6 +513,7 @@ [.. DNSLookup.QueryTypes.Select(x => x.ToString().ToLowerInvariant()).Order()]), ApplicationName.RDAP => Create(name, [], [Target(Strings.Query), type], types: [.. RDAPTypes.Keys]), ApplicationName.Whois => Create(name, [], [Target(Strings.Domain)]), ApplicationName.IPGeolocation => Create(name, ["geo"], [Target(Strings.Host)]), + ApplicationName.LLDPCDPCapture => Create(name, ["lldp", "cdp"], null), ApplicationName.MDNSDiscovery => Create(name, ["mdns", "dnssd"], [Target(Strings.MDNSDiscovery_ServiceType), Argument(Strings.DurationS)], RunCommandArgument.Duration, supportsProfile: false), diff --git a/Source/NETworkManager/ScreenshotData.cs b/Source/NETworkManager/ScreenshotData.cs index f14be1ef43..5558271cb0 100644 --- a/Source/NETworkManager/ScreenshotData.cs +++ b/Source/NETworkManager/ScreenshotData.cs @@ -105,6 +105,35 @@ public static IPGeolocationResult CreateIPGeolocationResult() #endregion + #region LLDP / CDP Capture + + /// + /// Creates the LLDP packet of the switch the computer is connected to (instead of a capture). + /// + public static LLDPCDPPackageInfo CreateLLDPCDPPackage() + { + const string switchIPv4 = "192.168.1.2"; + + return new LLDPCDPPackageInfo + { + Device = "switch-01.home.arpa", + DeviceDescription = "Example Switch OS 4.2.1, Example GS-24P 24-Port Gigabit PoE Switch", + Port = "gi1/0/12", + PortDescription = "Office - PC-01", + Model = "Example GS-24P", + VLAN = "10", + IPAddress = switchIPv4, + Management = switchIPv4, + ChassisId = "02005E1000AB", + Protocol = "LLDP", + TimeToLive = "120", + LocalConnection = "Ethernet", + LocalInterface = "Example Gigabit Network Connection" + }; + } + + #endregion + #region mDNS Discovery /// diff --git a/Source/NETworkManager/ViewModels/CommandLineViewModel.cs b/Source/NETworkManager/ViewModels/CommandLineViewModel.cs index 9dd0f17305..f7bdd6cfd6 100644 --- a/Source/NETworkManager/ViewModels/CommandLineViewModel.cs +++ b/Source/NETworkManager/ViewModels/CommandLineViewModel.cs @@ -31,7 +31,7 @@ public CommandLineViewModel() ParameterApplication = CommandLineManager.GetParameterWithSplitIdentifier(CommandLineManager.ParameterApplication); ParameterApplicationValues = string.Join(", ", - Enum.GetValues(typeof(ApplicationName)).Cast().ToList()); + ApplicationManager.GetDefaultList().Select(x => x.Name)); } #endregion diff --git a/Source/NETworkManager/ViewModels/DiscoveryProtocolViewModel.cs b/Source/NETworkManager/ViewModels/LLDPCDPCaptureViewModel.cs similarity index 77% rename from Source/NETworkManager/ViewModels/DiscoveryProtocolViewModel.cs rename to Source/NETworkManager/ViewModels/LLDPCDPCaptureViewModel.cs index 2406d8b4fe..6aca0c497f 100644 --- a/Source/NETworkManager/ViewModels/DiscoveryProtocolViewModel.cs +++ b/Source/NETworkManager/ViewModels/LLDPCDPCaptureViewModel.cs @@ -19,17 +19,17 @@ namespace NETworkManager.ViewModels; /// -/// View model for the discovery protocol view. +/// View model for the LLDP / CDP Capture view. /// -public class DiscoveryProtocolViewModel : ViewModelBase +public class LLDPCDPCaptureViewModel : ViewModelBase { #region Variables - private static readonly ILog Log = LogManager.GetLogger(typeof(DiscoveryProtocolViewModel)); + private static readonly ILog Log = LogManager.GetLogger(typeof(LLDPCDPCaptureViewModel)); /// - /// The discovery protocol capture instance. + /// The LLDP / CDP capture instance. /// - private readonly DiscoveryProtocolCapture _discoveryProtocolCapture = new(); + private readonly LLDPCDPCapture _lldpCdpCapture = new(); /// /// Indicates whether the view model is loading. @@ -62,10 +62,16 @@ public bool FirstRun } } = true; + /// + /// Indicates if packets can be captured: requires administrator rights, except in the screenshot mode + /// (), which shows sample data instead of a capture. + /// + public bool CanCapture => ConfigurationManager.Current.IsAdmin || ScreenshotData.IsEnabled; + /// /// Gets the list of available discovery protocols. /// - public List Protocols + public List Protocols { get; private set @@ -81,7 +87,7 @@ private set /// /// Gets or sets the selected discovery protocol. /// - public DiscoveryProtocol SelectedProtocol + public LLDPCDPProtocol SelectedProtocol { get; set @@ -90,7 +96,7 @@ public DiscoveryProtocol SelectedProtocol return; if (!_isLoading) - SettingsManager.Current.DiscoveryProtocol_Protocol = value; + SettingsManager.Current.LLDPCDPCapture_Protocol = value; field = value; OnPropertyChanged(); @@ -125,7 +131,7 @@ public int SelectedDuration return; if (!_isLoading) - SettingsManager.Current.DiscoveryProtocol_Duration = value; + SettingsManager.Current.LLDPCDPCapture_Duration = value; field = value; OnPropertyChanged(); @@ -231,7 +237,7 @@ public bool DiscoveryPackageReceived /// /// Gets the received discovery package. /// - public DiscoveryProtocolPackageInfo DiscoveryPackage + public LLDPCDPPackageInfo DiscoveryPackage { get; private set @@ -249,17 +255,17 @@ private set #region Constructor, LoadSettings /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The dialog coordinator instance. - public DiscoveryProtocolViewModel() + public LLDPCDPCaptureViewModel() { _isLoading = true; - _discoveryProtocolCapture.PackageReceived += DiscoveryProtocol_PackageReceived; - _discoveryProtocolCapture.ErrorReceived += DiscoveryProtocol_ErrorReceived; - _discoveryProtocolCapture.WarningReceived += DiscoveryProtocol_WarningReceived; - _discoveryProtocolCapture.Complete += DiscoveryProtocol_Complete; + _lldpCdpCapture.PackageReceived += LLDPCDPCapture_PackageReceived; + _lldpCdpCapture.ErrorReceived += LLDPCDPCapture_ErrorReceived; + _lldpCdpCapture.WarningReceived += LLDPCDPCapture_WarningReceived; + _lldpCdpCapture.Complete += LLDPCDPCapture_Complete; _remainingTimer = new Timer { @@ -271,6 +277,10 @@ public DiscoveryProtocolViewModel() LoadSettings(); _isLoading = false; + + // Screenshot mode: result right away (like the dashboard) + if (ScreenshotData.IsEnabled) + ShowScreenshotData(); } /// @@ -278,11 +288,11 @@ public DiscoveryProtocolViewModel() /// private void LoadSettings() { - Protocols = Enum.GetValues(typeof(DiscoveryProtocol)).Cast().OrderBy(x => x.ToString()) + Protocols = Enum.GetValues(typeof(LLDPCDPProtocol)).Cast().OrderBy(x => x.ToString()) .ToList(); - SelectedProtocol = Protocols.FirstOrDefault(x => x == SettingsManager.Current.DiscoveryProtocol_Protocol); + SelectedProtocol = Protocols.FirstOrDefault(x => x == SettingsManager.Current.LLDPCDPCapture_Protocol); Durations = new List { 15, 30, 60, 90, 120 }; - SelectedDuration = Durations.FirstOrDefault(x => x == SettingsManager.Current.DiscoveryProtocol_Duration); + SelectedDuration = Durations.FirstOrDefault(x => x == SettingsManager.Current.LLDPCDPCapture_Duration); } #endregion @@ -314,13 +324,20 @@ private async Task RestartAsAdminAction() /// public ICommand CaptureCommand => new RelayCommand(parameter => { _ = CaptureAction(); }, Capture_CanExecute); - private bool Capture_CanExecute(object _) => ConfigurationManager.Current.IsAdmin && !IsCapturing; + private bool Capture_CanExecute(object _) => CanCapture && !IsCapturing; /// /// Action to start the capture. /// private async Task CaptureAction() { + if (ScreenshotData.IsEnabled) + { + ShowScreenshotData(); + + return; + } + if (FirstRun) FirstRun = false; @@ -342,7 +359,7 @@ private async Task CaptureAction() try { - _discoveryProtocolCapture.CaptureAsync(duration, SelectedProtocol); + _lldpCdpCapture.CaptureAsync(duration, SelectedProtocol); } catch (Exception ex) { @@ -383,8 +400,8 @@ await DialogHelper.ShowMessageAsync(Application.Current.MainWindow, Strings.Erro Environment.NewLine + ex.Message, ChildWindowIcon.Error); } - SettingsManager.Current.DiscoveryProtocol_ExportFileType = instance.FileType; - SettingsManager.Current.DiscoveryProtocol_ExportFilePath = instance.FilePath; + SettingsManager.Current.LLDPCDPCapture_ExportFileType = instance.FileType; + SettingsManager.Current.LLDPCDPCapture_ExportFilePath = instance.FilePath; }, _ => { childWindow.IsOpen = false; @@ -392,8 +409,8 @@ await DialogHelper.ShowMessageAsync(Application.Current.MainWindow, Strings.Erro }, [ ExportFileType.Csv, ExportFileType.Xml, ExportFileType.Json - ], false, SettingsManager.Current.DiscoveryProtocol_ExportFileType, - SettingsManager.Current.DiscoveryProtocol_ExportFilePath); + ], false, SettingsManager.Current.LLDPCDPCapture_ExportFileType, + SettingsManager.Current.LLDPCDPCapture_ExportFilePath); childWindow.Title = Strings.Export; @@ -423,6 +440,19 @@ private void Timer_Elapsed(object sender, ElapsedEventArgs e) })); } + /// + /// Screenshot mode (--screenshot): shows a sample packet instead of a capture (no PowerShell, no + /// progress). + /// + private void ShowScreenshotData() + { + FirstRun = false; + IsStatusMessageDisplayed = false; + + DiscoveryPackage = ScreenshotData.CreateLLDPCDPPackage(); + DiscoveryPackageReceived = true; + } + /// /// Called when the view becomes visible. /// @@ -442,9 +472,9 @@ public void OnViewHide() #region Events /// - /// Handles the PackageReceived event of the discovery protocol capture. + /// Handles the PackageReceived event of the LLDP / CDP capture. /// - private void DiscoveryProtocol_PackageReceived(object sender, DiscoveryProtocolPackageArgs e) + private void LLDPCDPCapture_PackageReceived(object sender, LLDPCDPPackageArgs e) { DiscoveryPackage = e.PackageInfo; @@ -452,9 +482,9 @@ private void DiscoveryProtocol_PackageReceived(object sender, DiscoveryProtocolP } /// - /// Handles the WarningReceived event of the discovery protocol capture. + /// Handles the WarningReceived event of the LLDP / CDP capture. /// - private void DiscoveryProtocol_WarningReceived(object sender, DiscoveryProtocolWarningArgs e) + private void LLDPCDPCapture_WarningReceived(object sender, LLDPCDPWarningArgs e) { if (!string.IsNullOrEmpty(StatusMessage)) StatusMessage += Environment.NewLine; @@ -467,9 +497,9 @@ private void DiscoveryProtocol_WarningReceived(object sender, DiscoveryProtocolW } /// - /// Handles the ErrorReceived event of the discovery protocol capture. + /// Handles the ErrorReceived event of the LLDP / CDP capture. /// - private void DiscoveryProtocol_ErrorReceived(object sender, DiscoveryProtocolErrorArgs e) + private void LLDPCDPCapture_ErrorReceived(object sender, LLDPCDPErrorArgs e) { if (!string.IsNullOrEmpty(StatusMessage)) StatusMessage += Environment.NewLine; @@ -481,9 +511,9 @@ private void DiscoveryProtocol_ErrorReceived(object sender, DiscoveryProtocolErr } /// - /// Handles the Complete event of the discovery protocol capture. + /// Handles the Complete event of the LLDP / CDP capture. /// - private void DiscoveryProtocol_Complete(object sender, EventArgs e) + private void LLDPCDPCapture_Complete(object sender, EventArgs e) { _remainingTimer.Stop(); IsCapturing = false; diff --git a/Source/NETworkManager/Views/DiscoveryProtocolView.xaml b/Source/NETworkManager/Views/LLDPCDPCaptureView.xaml similarity index 96% rename from Source/NETworkManager/Views/DiscoveryProtocolView.xaml rename to Source/NETworkManager/Views/LLDPCDPCaptureView.xaml index 2532e4f3e5..226f0d1ba2 100644 --- a/Source/NETworkManager/Views/DiscoveryProtocolView.xaml +++ b/Source/NETworkManager/Views/LLDPCDPCaptureView.xaml @@ -1,4 +1,4 @@ - + mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:LLDPCDPCaptureViewModel}"> - + @@ -23,7 +22,7 @@ - + @@ -57,7 +56,7 @@ @@ -68,7 +67,7 @@ SelectedItem="{Binding SelectedDuration}" />