Skip to content

Commit fe54f20

Browse files
committed
ARP Table - muticast indicator added
1 parent bb9b0b1 commit fe54f20

9 files changed

Lines changed: 34 additions & 9 deletions

File tree

Source/NETworkManager/Converters/TrueFalseToStringConverter.cs renamed to Source/NETworkManager/Converters/BooleanToStringConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace NETworkManager.Converters
77
{
8-
public sealed class TrueFalseToStringConverter : IValueConverter
8+
public sealed class BooleanToStringConverter : IValueConverter
99
{
1010
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1111
{

‎Source/NETworkManager/Models/Network/ARPTable.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ public static List<ARPTableInfo> GetTable()
139139
PhysicalAddress macAddress = new PhysicalAddress(new byte[] { row.mac0, row.mac1, row.mac2, row.mac3, row.mac4, row.mac5 });
140140

141141
// Filter 0.0.0.0.0.0, 255.255.255.255.255.255
142-
if (!macAddress.Equals(virtualMAC) && !macAddress.Equals(broadcastMAC)) //&& !(ipAddress.IsIPv6Multicast || IPv4AddressHelper.IsMulticast(ipAddress)))
143-
list.Add(new ARPTableInfo(ipAddress, macAddress));
142+
if (!macAddress.Equals(virtualMAC) && !macAddress.Equals(broadcastMAC))
143+
list.Add(new ARPTableInfo(ipAddress, macAddress, (ipAddress.IsIPv6Multicast || IPv4AddressHelper.IsMulticast(ipAddress))));
144144
}
145145

146146
return list;

‎Source/NETworkManager/Models/Network/ARPTableInfo.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class ARPTableInfo
88
{
99
public IPAddress IPAddress { get; set; }
1010
public PhysicalAddress MACAddress { get; set; }
11+
public bool IsMulticast { get; set; }
1112

1213
public int IPAddressInt32
1314
{
@@ -19,10 +20,11 @@ public ARPTableInfo()
1920

2021
}
2122

22-
public ARPTableInfo(IPAddress ipAddress, PhysicalAddress macAddress)
23+
public ARPTableInfo(IPAddress ipAddress, PhysicalAddress macAddress, bool isMulticast)
2324
{
2425
IPAddress = ipAddress;
2526
MACAddress = macAddress;
27+
IsMulticast = isMulticast;
2628
}
2729
}
28-
}
30+
}

‎Source/NETworkManager/NETworkManager.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@
772772
<Compile Include="Views\Applications\NetworkInterfaceView.xaml.cs">
773773
<DependentUpon>NetworkInterfaceView.xaml</DependentUpon>
774774
</Compile>
775-
<Compile Include="Converters\TrueFalseToStringConverter.cs" />
775+
<Compile Include="Converters\BooleanToStringConverter.cs" />
776776
<Compile Include="Converters\AccentToStringConverter.cs" />
777777
<Compile Include="Converters\AppThemeToStringConverter.cs" />
778778
<Compile Include="Views\Applications\IPScannerView.xaml.cs">

‎Source/NETworkManager/Resources/Localization/Resources.de-DE.xaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@
315315
<system:String x:Key="String_Scan">Scannen</system:String>
316316
<system:String x:Key="String_Apply">Anwenden</system:String>
317317
<system:String x:Key="String_DeleteEntry">Eintrag löschen</system:String>
318+
<system:String x:Key="String_Multicast">Multicast</system:String>
318319

319320
<!-- Help message -->
320321
<system:String x:Key="String_HelpMessage_ParameterHelp">Zeigt diesen Dialog an.</system:String>

‎Source/NETworkManager/Resources/Localization/Resources.en-US.xaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@
315315
<system:String x:Key="String_Scan">Scan</system:String>
316316
<system:String x:Key="String_Apply">Apply</system:String>
317317
<system:String x:Key="String_DeleteEntry">Delete entry</system:String>
318+
<system:String x:Key="String_Multicast">Multicast</system:String>
318319

319320
<!-- Help message -->
320321
<system:String x:Key="String_HelpMessage_ParameterHelp">Displays this dialog.</system:String>

‎Source/NETworkManager/ViewModels/Applications/ARPTableViewModel.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,16 @@ private void CopySelectedMACAddressAction()
251251
{
252252
Clipboard.SetText(MACAddressHelper.GetDefaultFormat(SelectedARPTableInfo.MACAddress.ToString()));
253253
}
254+
255+
public ICommand CopySelectedMulticastCommand
256+
{
257+
get { return new RelayCommand(p => CopySelectedMulticastAction()); }
258+
}
259+
260+
private void CopySelectedMulticastAction()
261+
{
262+
Clipboard.SetText(SelectedARPTableInfo.IsMulticast ? Application.Current.Resources["String_Yes"] as string : Application.Current.Resources["String_No"] as string);
263+
}
254264
#endregion
255265

256266
#region Methods

‎Source/NETworkManager/Views/Applications/ARPTableView.xaml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
mc:Ignorable="d">
1212
<UserControl.Resources>
1313
<Converter:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
14+
<Converter:BooleanToStringConverter x:Key="BooleanToStringConverter" />
1415
<Converter:PhysicalAddressToStringConverter x:Key="PhysicalAddressToStringConverter" />
1516
</UserControl.Resources>
1617
<Grid Margin="10">
@@ -57,6 +58,15 @@
5758
</Rectangle>
5859
</MenuItem.Icon>
5960
</MenuItem>
61+
<MenuItem Header="{DynamicResource String_Multicast}" Command="{Binding CopySelectedMulticastCommand}">
62+
<MenuItem.Icon>
63+
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
64+
<Rectangle.OpacityMask>
65+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=ContentCopy}" />
66+
</Rectangle.OpacityMask>
67+
</Rectangle>
68+
</MenuItem.Icon>
69+
</MenuItem>
6070
</MenuItem>
6171
<MenuItem Header="{DynamicResource String_DeleteEntry}" Command="{Binding DeleteEntryCommand}">
6272
<MenuItem.Icon>
@@ -81,6 +91,7 @@
8191
<DataGrid.Columns>
8292
<DataGridTextColumn Header="{DynamicResource String_IPAddress}" Binding="{Binding IPAddress}" SortMemberPath="IPAddressInt32" MinWidth="150" />
8393
<DataGridTextColumn Header="{DynamicResource String_MACAddress}" Binding="{Binding MACAddress, Converter={StaticResource PhysicalAddressToStringConverter}}" MinWidth="200" />
94+
<DataGridTextColumn Header="{DynamicResource String_Multicast}" Binding="{Binding IsMulticast, Converter={StaticResource BooleanToStringConverter}}" MinWidth="100" />
8495
</DataGrid.Columns>
8596
</DataGrid>
8697
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">

‎Source/NETworkManager/Views/Applications/NetworkInterfaceView.xaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<Converter:NullToFalseConverter x:Key="NullToFalseConverter" />
2525
<Converter:PhysicalAddressToStringConverter x:Key="PhysicalAddressToStringConverter" />
2626
<Converter:ValidateNetworkInterfaceConfigConverter x:Key="ValidateNetworkInterfaceConfigConverter" />
27-
<Converter:TrueFalseToStringConverter x:Key="TrueFalseToStringConverter" />
27+
<Converter:BooleanToStringConverter x:Key="BooleanToStringConverter" />
2828
<Converter:SelectedItemsToBoolConverter x:Key="SelectedItemsToBoolConverter" />
2929
<Style x:Key="ReloadAnimation" TargetType="Rectangle">
3030
<Setter Property="Height" Value="24" />
@@ -220,7 +220,7 @@
220220
<TextBlock Grid.Column="0" Grid.Row="8" Text="{DynamicResource String_IPv4DefaultGateway}" />
221221
<TextBox Grid.Column="2" Grid.Row="8" Text="{Binding DetailsIPv4Gateway, Converter={StaticResource IPAddressArrayToStringConverter}}" />
222222
<TextBlock Grid.Column="0" Grid.Row="9" Text="{DynamicResource String_DHCPEnabled}" />
223-
<TextBox Grid.Column="2" Grid.Row="9" Text="{Binding DetailsIPv4DhcpEnabled, Converter={StaticResource TrueFalseToStringConverter}}" />
223+
<TextBox Grid.Column="2" Grid.Row="9" Text="{Binding DetailsIPv4DhcpEnabled, Converter={StaticResource BooleanToStringConverter}}" />
224224
<TextBlock Grid.Column="0" Grid.Row="10" Text="{DynamicResource String_DHCPServer}" />
225225
<TextBox Grid.Column="2" Grid.Row="10" Text="{Binding DetailsIPv4DhcpServer, Converter={StaticResource IPAddressArrayToStringConverter}}" />
226226
<TextBlock Grid.Column="0" Grid.Row="11" Text="{DynamicResource String_DHCPLeaseObtained}" />
@@ -234,7 +234,7 @@
234234
<TextBlock Grid.Column="0" Grid.Row="15" Text="{DynamicResource String_IPv6DefaultGateway}" />
235235
<TextBox Grid.Column="2" Grid.Row="15" Text="{Binding DetailsIPv6Gateway , Converter={StaticResource IPAddressArrayToStringConverter}}" />
236236
<TextBlock Grid.Column="0" Grid.Row="16" Text="{DynamicResource String_DNSAutoconfiguration}" />
237-
<TextBox Grid.Column="2" Grid.Row="16" Text="{Binding DetailsDNSAutoconfigurationEnabled, Converter={StaticResource TrueFalseToStringConverter}}" />
237+
<TextBox Grid.Column="2" Grid.Row="16" Text="{Binding DetailsDNSAutoconfigurationEnabled, Converter={StaticResource BooleanToStringConverter}}" />
238238
<TextBlock Grid.Column="0" Grid.Row="17" Text="{DynamicResource String_DNSSuffix}" />
239239
<TextBox Grid.Column="2" Grid.Row="17" Text="{Binding DetailsDNSSuffix}" />
240240
<TextBlock Grid.Column="0" Grid.Row="18" Text="{DynamicResource String_DNSServers}" />

0 commit comments

Comments
 (0)