MndpDiscovery (UDP 5678, Broadcast-Anfrage + Antworten 4 s sammeln, TLV-Parser wie Mac v1.6.0) findet Router ueber die MAC-Adresse, auch ohne passende IP. Treffer zeigen Name/Modell/IP/MAC; 'IP uebernehmen' fuellt die Adresse, 'MAC kopieren' mit Hinweis auf WinBox bei Routern ohne IP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
36ad3629cf
commit
c40f2bdaf9
5 files changed
+259
-4
No files matched your search
@@ -41,6 +41,54 @@ public partial class ConnectionStepViewModel : WizardStepViewModelBase
|
||||
|
||||
public bool ShowTestEnvironment => UserSettings.Current.TestEnvironment;
|
||||
|
||||
/// <summary>Per MNDP gefundene Router (wie „Neighbors" in WinBox), Mac v1.6.0.</summary>
|
||||
public ObservableCollection<MndpNeighbor> Neighbors { get; } = [];
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isSearchingNeighbors;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _neighborSearchMessage;
|
||||
|
||||
[RelayCommand]
|
||||
private async Task SearchNeighborsAsync()
|
||||
{
|
||||
IsSearchingNeighbors = true;
|
||||
NeighborSearchMessage = null;
|
||||
Neighbors.Clear();
|
||||
try
|
||||
{
|
||||
foreach (var neighbor in await MndpDiscovery.DiscoverAsync(TimeSpan.FromSeconds(4)))
|
||||
{
|
||||
Neighbors.Add(neighbor);
|
||||
}
|
||||
|
||||
NeighborSearchMessage = Neighbors.Count == 0
|
||||
? "Kein MikroTik-Router gefunden. Ist der PC per Kabel oder WLAN mit dem Router verbunden?"
|
||||
: null;
|
||||
}
|
||||
catch (System.Net.Sockets.SocketException)
|
||||
{
|
||||
NeighborSearchMessage = "Die Router-Suche ist gerade nicht möglich. Läuft auf diesem PC ein anderes Programm, das Port 5678 belegt?";
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsSearchingNeighbors = false;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void UseNeighbor(MndpNeighbor neighbor)
|
||||
{
|
||||
if (neighbor.IPv4Address is { } address)
|
||||
{
|
||||
Host = address;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void CopyMac(MndpNeighbor neighbor) => System.Windows.Clipboard.SetText(neighbor.MacAddress);
|
||||
|
||||
[RelayCommand]
|
||||
private async Task ConnectToTestDeviceAsync(DemoDeviceProfile profile)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user