Skip to content

Commit b8c7825

Browse files
authored
Feature: IP Scanner > Pass MAC address as argument to a new profile (#1998)
* Feature: Pass MAC address as argument to a new profile * Docs: Add #1998
1 parent 65b5427 commit b8c7825

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Source/NETworkManager.Models/Network/HostInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class HostInfo
99
public PhysicalAddress MACAddress { get; set; }
1010
public string Vendor { get; set; }
1111

12-
public string MACAddressString => MACAddress.ToString();
12+
public string MACAddressString => MACAddress?.ToString();
1313

1414
public HostInfo()
1515
{

Source/NETworkManager/ViewModels/IPScannerViewModel.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,10 @@ private async Task AddProfileSelectedHostAction()
326326
ProfileInfo profileInfo = new()
327327
{
328328
Name = string.IsNullOrEmpty(SelectedResult.Hostname) ? SelectedResult.PingInfo.IPAddress.ToString() : SelectedResult.Hostname.TrimEnd('.'),
329-
Host = SelectedResult.PingInfo.IPAddress.ToString()
329+
Host = SelectedResult.PingInfo.IPAddress.ToString(),
330+
331+
// Additional data
332+
WakeOnLAN_MACAddress = SelectedResult.MACAddressString
330333
};
331334

332335
var customDialog = new CustomDialog
@@ -511,7 +514,7 @@ private void StopScan()
511514
CancelScan = true;
512515
_cancellationTokenSource.Cancel();
513516
}
514-
517+
515518
private async Task DetectIPRange()
516519
{
517520
IsSubnetDetectionRunning = true;
@@ -667,15 +670,15 @@ private void DnsResolveFailed(AggregateException e)
667670
{
668671
StatusMessage = $"{Localization.Resources.Strings.TheFollowingHostnamesCouldNotBeResolved} {string.Join(", ", e.Flatten().InnerExceptions.Select(x => x.Message))}";
669672
IsStatusMessageDisplayed = true;
670-
673+
671674
CancelScan = false;
672675
IsScanRunning = false;
673676
}
674677

675678
private void UserHasCanceled(object sender, EventArgs e)
676679
{
677680
StatusMessage = Localization.Resources.Strings.CanceledByUserMessage;
678-
IsStatusMessageDisplayed = true;
681+
IsStatusMessageDisplayed = true;
679682
}
680683

681684
private void SettingsManager_PropertyChanged(object sender, PropertyChangedEventArgs e)

docs/Changelog/next-release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The profiles and settings are automatically migrated to the new location when th
5252
- Max threads changed to to 1024 [#1927](https://github.com/BornToBeRoot/NETworkManager/pull/1927){:target="\_blank"}
5353
- Event handling when a host is found, user has canceled, etc. [#1969](https://github.com/BornToBeRoot/NETworkManager/pull/1969){:target="\_blank"}
5454
- Remove option to set the preferred IP protocol for DNS resolution (can now be set globally) [#1950](https://github.com/BornToBeRoot/NETworkManager/pull/1950){:target="\_blank"}
55+
- Create profile from IP scanner now passes the MAC address, if available [#1998](https://github.com/BornToBeRoot/NETworkManager/pull/1998){:target="\_blank"}
5556
- **Port Scanner**
5657
- Add new port profiles / improve existing ones [#1909](https://github.com/BornToBeRoot/NETworkManager/pull/1909){:target="\_blank"}
5758
- New Port state "Timed out" if the timelimit is reached. [#1969](https://github.com/BornToBeRoot/NETworkManager/pull/1969){:target="\_blank"}

0 commit comments

Comments
 (0)