From cf924f7b2aa883fd2fdcd7cdfc197b951c4bd230 Mon Sep 17 00:00:00 2001 From: holger Date: Fri, 17 Nov 2023 21:21:54 +0100 Subject: [PATCH] implemented evaluation of ip addresses --- .idea/.idea.SddpViewer/.idea/.gitignore | 13 +++ .idea/.idea.SddpViewer/.idea/avalonia.xml | 10 +++ .idea/.idea.SddpViewer/.idea/encodings.xml | 4 + .idea/.idea.SddpViewer/.idea/indexLayout.xml | 8 ++ .idea/.idea.SddpViewer/.idea/vcs.xml | 6 ++ App.axaml.cs | 2 +- DiscoveredDeviceViewModel.cs | 92 ++++++++++---------- MainWindow.axaml | 33 ++++--- MainWindow.axaml.cs | 2 +- MainWindowViewModel.cs | 80 +++++++++++------ NetworkAdapter.cs | 31 +++++++ Program.cs | 11 +-- 12 files changed, 192 insertions(+), 100 deletions(-) create mode 100644 .idea/.idea.SddpViewer/.idea/.gitignore create mode 100644 .idea/.idea.SddpViewer/.idea/avalonia.xml create mode 100644 .idea/.idea.SddpViewer/.idea/encodings.xml create mode 100644 .idea/.idea.SddpViewer/.idea/indexLayout.xml create mode 100644 .idea/.idea.SddpViewer/.idea/vcs.xml create mode 100644 NetworkAdapter.cs diff --git a/.idea/.idea.SddpViewer/.idea/.gitignore b/.idea/.idea.SddpViewer/.idea/.gitignore new file mode 100644 index 0000000..85bf2d1 --- /dev/null +++ b/.idea/.idea.SddpViewer/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/projectSettingsUpdater.xml +/.idea.SddpViewer.iml +/contentModel.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.SddpViewer/.idea/avalonia.xml b/.idea/.idea.SddpViewer/.idea/avalonia.xml new file mode 100644 index 0000000..cad2c12 --- /dev/null +++ b/.idea/.idea.SddpViewer/.idea/avalonia.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SddpViewer/.idea/encodings.xml b/.idea/.idea.SddpViewer/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.SddpViewer/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.SddpViewer/.idea/indexLayout.xml b/.idea/.idea.SddpViewer/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.SddpViewer/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SddpViewer/.idea/vcs.xml b/.idea/.idea.SddpViewer/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.SddpViewer/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App.axaml.cs b/App.axaml.cs index 8b7ca73..ec292cc 100644 --- a/App.axaml.cs +++ b/App.axaml.cs @@ -20,4 +20,4 @@ public partial class App : Application base.OnFrameworkInitializationCompleted(); } -} \ No newline at end of file +} diff --git a/DiscoveredDeviceViewModel.cs b/DiscoveredDeviceViewModel.cs index 897ebc8..68ac14a 100644 --- a/DiscoveredDeviceViewModel.cs +++ b/DiscoveredDeviceViewModel.cs @@ -1,53 +1,53 @@ namespace SddpViewer { - using System; - using System.Threading.Tasks; + using System; + using System.Threading.Tasks; - using CommunityToolkit.Mvvm.ComponentModel; + using CommunityToolkit.Mvvm.ComponentModel; - using Rssdp; + using Rssdp; - public partial class DiscoveredDeviceViewModel : ObservableObject - { - private readonly DiscoveredSsdpDevice device; - - public DiscoveredDeviceViewModel(DiscoveredSsdpDevice device) + public partial class DiscoveredDeviceViewModel : ObservableObject { - this.device = device; + private readonly DiscoveredSsdpDevice device; + + public DiscoveredDeviceViewModel(DiscoveredSsdpDevice device) + { + this.device = device; + } + + /// + /// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice. + /// + public string NotificationType => this.device.NotificationType; + + /// + /// Sets or returns the universal service name (USN) of the device. + /// + public string Usn => this.device.Usn; + + /// + /// Sets or returns a URL pointing to the device description document for this device. + /// + public Uri DescriptionLocation => this.device.DescriptionLocation; + + /// + /// Sets or returns the length of time this information is valid for (from the time). + /// + public TimeSpan CacheLifetime => this.device.CacheLifetime; + + /// + /// Sets or returns the date and time this information was received. + /// + public DateTimeOffset AsAt => this.device.AsAt; + + [ObservableProperty] + private string _friendlyName = ""; + + public async Task GetFurtherInformationAsync() + { + var ssdpDevice = await this.device.GetDeviceInfo().ConfigureAwait(false); + FriendlyName = ssdpDevice.FriendlyName; + } } - - /// - /// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice. - /// - public string NotificationType => this.device.NotificationType; - - /// - /// Sets or returns the universal service name (USN) of the device. - /// - public string Usn => this.device.Usn; - - /// - /// Sets or returns a URL pointing to the device description document for this device. - /// - public Uri DescriptionLocation => this.device.DescriptionLocation; - - /// - /// Sets or returns the length of time this information is valid for (from the time). - /// - public TimeSpan CacheLifetime => this.device.CacheLifetime; - - /// - /// Sets or returns the date and time this information was received. - /// - public DateTimeOffset AsAt => this.device.AsAt; - - [ObservableProperty] - private string _friendlyName = ""; - - public async Task GetFurtherInformationAsync() - { - var ssdpDevice = await this.device.GetDeviceInfo().ConfigureAwait(false); - FriendlyName = ssdpDevice.FriendlyName; - } - } -} \ No newline at end of file +} diff --git a/MainWindow.axaml b/MainWindow.axaml index 76c9f27..ccc749d 100644 --- a/MainWindow.axaml +++ b/MainWindow.axaml @@ -1,35 +1,34 @@ + xmlns="https://github.com/avaloniaui" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:sddpViewer="clr-namespace:SddpViewer" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - - - + + + +