Skip to content

Commit 6a35805

Browse files
authored
Feature: IP Scanner detect common ports (BornToBeRoot#2026)
* Feature: Add icon to indicate host status * Feature: Details view for IP scanner row * Feature: Configure ThreadPool global * Chore: Code cleanup * Chore: Refactoring some code * Feature: IP Scanner improve detection with port scan * Chore: Code refactoring * Feature: IP Scanner detect common ports * Docs: Add BornToBeRoot#2026 * Feature: Export ports & fix csv export with comma & refactoring * Docs: Typo
1 parent 192ab18 commit 6a35805

63 files changed

Lines changed: 1789 additions & 688 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows;
4+
using System.Windows.Data;
5+
6+
namespace NETworkManager.Converters;
7+
8+
public sealed class HostUpStyleConverter : IValueConverter
9+
{
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
if (value is not bool isReachable)
13+
return null;
14+
15+
return isReachable ? Application.Current.FindResource("HostUpRectangle") : Application.Current.FindResource("HostDownRectangle");
16+
}
17+
18+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
19+
{
20+
throw new NotImplementedException();
21+
}
22+
}

Source/NETworkManager.Converters/IPStatusToStringConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public sealed class IPStatusToStringConverter : IValueConverter
2121
/// <returns>Translated <see cref="IPStatus"/>.</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
24-
if (!(value is IPStatus ipStatus))
24+
if (value is not IPStatus ipStatus)
2525
return "-/-";
2626

2727
return IPStatusTranslator.GetInstance().Translate(ipStatus);

Source/NETworkManager.Converters/PingTimeToStringConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public sealed class PingTimeToStringConverter : IMultiValueConverter
99
{
1010
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1111
{
12-
return Models.Network.Ping.TimeToString((IPStatus)values[0], (long)values[1]);
12+
return Models.Network.Ping.TimeToString((IPStatus)values[0], (long)values[1]);
1313
}
1414

1515
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using NETworkManager.Models.Network;
2+
using System;
3+
using System.Globalization;
4+
using System.Windows;
5+
using System.Windows.Data;
6+
7+
namespace NETworkManager.Converters;
8+
9+
public sealed class PortOpenStyleConverter : IValueConverter
10+
{
11+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
12+
{
13+
if (value is not PortState portState)
14+
return null;
15+
16+
return portState == PortState.Open ? Application.Current.FindResource("PortOpenRectangle") : Application.Current.FindResource("PortClosedRectangle");
17+
}
18+
19+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20+
{
21+
throw new NotImplementedException();
22+
}
23+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
using NETworkManager.Localization.Translators;
5+
using NETworkManager.Models.Network;
6+
7+
namespace NETworkManager.Converters;
8+
9+
/// <summary>
10+
/// Convert a <see cref="bool"/> that indicates if a port is open to a translated <see cref="string"/> or wise versa.
11+
/// </summary>
12+
public sealed class PortOpenToStringConverter : IValueConverter
13+
{
14+
/// <summary>
15+
/// Convert a <see cref="bool"/> that indicates if a port is open to a translated <see cref="string"/>.
16+
/// </summary>
17+
/// <param name="value">Port up as <see cref="bool"/>.</param>
18+
/// <param name="targetType"></param>
19+
/// <param name="parameter"></param>
20+
/// <param name="culture"></param>
21+
/// <returns>Translated <see cref="PortState"/>.</returns>
22+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
23+
{
24+
if (value is not bool portState)
25+
return "-/-";
26+
27+
return portState ? PortStateTranslator.GetInstance().Translate(PortState.Open) : PortStateTranslator.GetInstance().Translate(PortState.Closed);
28+
}
29+
30+
/// <summary>
31+
/// !!! Method not implemented !!!
32+
/// </summary>
33+
/// <param name="value"></param>
34+
/// <param name="targetType"></param>
35+
/// <param name="parameter"></param>
36+
/// <param name="culture"></param>
37+
/// <returns></returns>
38+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
39+
{
40+
throw new NotImplementedException();
41+
}
42+
}

Source/NETworkManager.Localization/NETworkManager.Localization.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,4 @@
8989
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
9090
</EmbeddedResource>
9191
</ItemGroup>
92-
9392
</Project>

Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Lines changed: 121 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)