Skip to content

Commit d359037

Browse files
Add Junie/Gemini generated XML doc headers to half of the ViewModels. (#3251)
* Adding Junie/Gemini XML documentation to roughly half of the ViewModels. Signed-off-by: Manuel Ullmann <manuel.ullmann@rediecon.com> * Update changelog. * Adding Junie/Gemini XML documentation to roughly half of the ViewModels. Signed-off-by: Manuel Ullmann <manuel.ullmann@rediecon.com> --------- Signed-off-by: Manuel Ullmann <manuel.ullmann@rediecon.com> Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
1 parent 32f6635 commit d359037

File tree

54 files changed

+4051
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4051
-17
lines changed

Source/NETworkManager.Models/Network/IPScanner.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
namespace NETworkManager.Models.Network;
1414

15+
/// <summary>
16+
/// Class to scan for IP addresses in a network.
17+
/// </summary>
18+
/// <param name="options">The scan options.</param>
1519
public sealed class IPScanner(IPScannerOptions options)
1620
{
1721
#region Variables
@@ -22,27 +26,39 @@ public sealed class IPScanner(IPScannerOptions options)
2226

2327
#region Events
2428

29+
/// <summary>
30+
/// Occurs when a host has been scanned.
31+
/// </summary>
2532
public event EventHandler<IPScannerHostScannedArgs> HostScanned;
2633

2734
private void OnHostScanned(IPScannerHostScannedArgs e)
2835
{
2936
HostScanned?.Invoke(this, e);
3037
}
3138

39+
/// <summary>
40+
/// Occurs when the scan is complete.
41+
/// </summary>
3242
public event EventHandler ScanComplete;
3343

3444
private void OnScanComplete()
3545
{
3646
ScanComplete?.Invoke(this, EventArgs.Empty);
3747
}
3848

49+
/// <summary>
50+
/// Occurs when the scan progress has changed.
51+
/// </summary>
3952
public event EventHandler<ProgressChangedArgs> ProgressChanged;
4053

4154
private void OnProgressChanged()
4255
{
4356
ProgressChanged?.Invoke(this, new ProgressChangedArgs(_progressValue));
4457
}
4558

59+
/// <summary>
60+
/// Occurs when the user has canceled the scan.
61+
/// </summary>
4662
public event EventHandler UserHasCanceled;
4763

4864
private void OnUserHasCanceled()
@@ -54,6 +70,11 @@ private void OnUserHasCanceled()
5470

5571
#region Methods
5672

73+
/// <summary>
74+
/// Starts the IP scan asynchronously.
75+
/// </summary>
76+
/// <param name="hosts">The list of hosts to scan.</param>
77+
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
5778
public void ScanAsync(IEnumerable<(IPAddress ipAddress, string hostname)> hosts,
5879
CancellationToken cancellationToken)
5980
{

Source/NETworkManager.Models/Network/NetworkInterface.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111

1212
namespace NETworkManager.Models.Network;
1313

14+
/// <summary>
15+
/// Provides functionality to manage network interfaces.
16+
/// </summary>
1417
public sealed class NetworkInterface
1518
{
1619
#region Events
1720

21+
/// <summary>
22+
/// Occurs when the user has canceled an operation (e.g. UAC prompt).
23+
/// </summary>
1824
public event EventHandler UserHasCanceled;
1925

2026
private void OnUserHasCanceled()
@@ -26,11 +32,19 @@ private void OnUserHasCanceled()
2632

2733
#region Methods
2834

35+
/// <summary>
36+
/// Gets a list of all available network interfaces asynchronously.
37+
/// </summary>
38+
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="NetworkInterfaceInfo"/>.</returns>
2939
public static Task<List<NetworkInterfaceInfo>> GetNetworkInterfacesAsync()
3040
{
3141
return Task.Run(GetNetworkInterfaces);
3242
}
3343

44+
/// <summary>
45+
/// Gets a list of all available network interfaces.
46+
/// </summary>
47+
/// <returns>A list of <see cref="NetworkInterfaceInfo"/> describing the available network interfaces.</returns>
3448
public static List<NetworkInterfaceInfo> GetNetworkInterfaces()
3549
{
3650
List<NetworkInterfaceInfo> listNetworkInterfaceInfo = new();
@@ -156,11 +170,21 @@ public static List<NetworkInterfaceInfo> GetNetworkInterfaces()
156170
return listNetworkInterfaceInfo;
157171
}
158172

173+
/// <summary>
174+
/// Detects the local IP address based on routing to a remote IP address asynchronously.
175+
/// </summary>
176+
/// <param name="remoteIPAddress">The remote IP address to check routing against.</param>
177+
/// <returns>A task that represents the asynchronous operation. The task result contains the local <see cref="IPAddress"/> used to reach the remote address.</returns>
159178
public static Task<IPAddress> DetectLocalIPAddressBasedOnRoutingAsync(IPAddress remoteIPAddress)
160179
{
161180
return Task.Run(() => DetectLocalIPAddressBasedOnRouting(remoteIPAddress));
162181
}
163182

183+
/// <summary>
184+
/// Detects the local IP address based on routing to a remote IP address.
185+
/// </summary>
186+
/// <param name="remoteIPAddress">The remote IP address to check routing against.</param>
187+
/// <returns>The local <see cref="IPAddress"/> used to reach the remote address.</returns>
164188
private static IPAddress DetectLocalIPAddressBasedOnRouting(IPAddress remoteIPAddress)
165189
{
166190
var isIPv4 = remoteIPAddress.AddressFamily == AddressFamily.InterNetwork;
@@ -184,11 +208,21 @@ private static IPAddress DetectLocalIPAddressBasedOnRouting(IPAddress remoteIPAd
184208
return null;
185209
}
186210

211+
/// <summary>
212+
/// Detects the gateway IP address based on a local IP address asynchronously.
213+
/// </summary>
214+
/// <param name="localIPAddress">The local IP address to find the gateway for.</param>
215+
/// <returns>A task that represents the asynchronous operation. The task result contains the gateway <see cref="IPAddress"/>.</returns>
187216
public static Task<IPAddress> DetectGatewayBasedOnLocalIPAddressAsync(IPAddress localIPAddress)
188217
{
189218
return Task.Run(() => DetectGatewayBasedOnLocalIPAddress(localIPAddress));
190219
}
191220

221+
/// <summary>
222+
/// Detects the gateway IP address based on a local IP address.
223+
/// </summary>
224+
/// <param name="localIPAddress">The local IP address to find the gateway for.</param>
225+
/// <returns>The gateway <see cref="IPAddress"/>.</returns>
192226
private static IPAddress DetectGatewayBasedOnLocalIPAddress(IPAddress localIPAddress)
193227
{
194228
foreach (var networkInterface in GetNetworkInterfaces())
@@ -210,11 +244,20 @@ private static IPAddress DetectGatewayBasedOnLocalIPAddress(IPAddress localIPAdd
210244
return null;
211245
}
212246

247+
/// <summary>
248+
/// Configures a network interface with the specified configuration asynchronously.
249+
/// </summary>
250+
/// <param name="config">The configuration to apply.</param>
251+
/// <returns>A task that represents the asynchronous operation.</returns>
213252
public Task ConfigureNetworkInterfaceAsync(NetworkInterfaceConfig config)
214253
{
215254
return Task.Run(() => ConfigureNetworkInterface(config));
216255
}
217256

257+
/// <summary>
258+
/// Configures a network interface with the specified configuration.
259+
/// </summary>
260+
/// <param name="config">The configuration to apply.</param>
218261
private void ConfigureNetworkInterface(NetworkInterfaceConfig config)
219262
{
220263
// IP

Source/NETworkManager.Models/Network/Ping.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,36 @@
88

99
namespace NETworkManager.Models.Network;
1010

11+
/// <summary>
12+
/// Provides functionality to ping a network host.
13+
/// </summary>
1114
public sealed class Ping
1215
{
1316
#region Variables
1417

18+
/// <summary>
19+
/// The time in milliseconds to wait between ping requests. Default is 1000ms.
20+
/// </summary>
1521
public int WaitTime = 1000;
22+
23+
/// <summary>
24+
/// The time in milliseconds to wait for a reply. Default is 4000ms.
25+
/// </summary>
1626
public int Timeout = 4000;
27+
28+
/// <summary>
29+
/// The buffer to send with the ping request. Default is 32 bytes.
30+
/// </summary>
1731
public byte[] Buffer = new byte[32];
32+
33+
/// <summary>
34+
/// The Time to Live (TTL) value for the ping request. Default is 64.
35+
/// </summary>
1836
public int TTL = 64;
37+
38+
/// <summary>
39+
/// Indicates whether to prevent fragmentation of the data packets. Default is true.
40+
/// </summary>
1941
public bool DontFragment = true;
2042

2143
private const int ExceptionCancelCount = 3;
@@ -24,34 +46,49 @@ public sealed class Ping
2446

2547
#region Events
2648

49+
/// <summary>
50+
/// Occurs when a ping reply is received.
51+
/// </summary>
2752
public event EventHandler<PingReceivedArgs> PingReceived;
2853

2954
private void OnPingReceived(PingReceivedArgs e)
3055
{
3156
PingReceived?.Invoke(this, e);
3257
}
3358

59+
/// <summary>
60+
/// Occurs when the ping operation is completed.
61+
/// </summary>
3462
public event EventHandler PingCompleted;
3563

3664
private void OnPingCompleted()
3765
{
3866
PingCompleted?.Invoke(this, EventArgs.Empty);
3967
}
4068

69+
/// <summary>
70+
/// Occurs when a ping exception is thrown.
71+
/// </summary>
4172
public event EventHandler<PingExceptionArgs> PingException;
4273

4374
private void OnPingException(PingExceptionArgs e)
4475
{
4576
PingException?.Invoke(this, e);
4677
}
4778

79+
/// <summary>
80+
/// Occurs when the hostname is resolved.
81+
/// </summary>
4882
public event EventHandler<HostnameArgs> HostnameResolved;
4983

5084
private void OnHostnameResolved(HostnameArgs e)
5185
{
5286
HostnameResolved?.Invoke(this, e);
5387
}
5488

89+
/// <summary>
90+
/// Occurs when the user has canceled the operation.
91+
/// </summary>
5592
public event EventHandler UserHasCanceled;
5693

5794
private void OnUserHasCanceled()
@@ -63,6 +100,11 @@ private void OnUserHasCanceled()
63100

64101
#region Methods
65102

103+
/// <summary>
104+
/// Sends ping requests to the specified IP address asynchronously.
105+
/// </summary>
106+
/// <param name="ipAddress">The IP address to ping.</param>
107+
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
66108
public void SendAsync(IPAddress ipAddress, CancellationToken cancellationToken)
67109
{
68110
Task.Run(async () =>
@@ -153,6 +195,13 @@ public void SendAsync(IPAddress ipAddress, CancellationToken cancellationToken)
153195
}
154196

155197
// Param: disableSpecialChar --> ExportManager --> "<" this char cannot be displayed in xml
198+
/// <summary>
199+
/// Converts the ping time to a string representation.
200+
/// </summary>
201+
/// <param name="status">The IP status of the ping reply.</param>
202+
/// <param name="time">The round-trip time in milliseconds.</param>
203+
/// <param name="disableSpecialChar">If true, disables special characters like '&lt;' in the output (e.g., for XML export).</param>
204+
/// <returns>The formatted time string.</returns>
156205
public static string TimeToString(IPStatus status, long time, bool disableSpecialChar = false)
157206
{
158207
if (status != IPStatus.Success && status != IPStatus.TtlExpired)

Source/NETworkManager/ViewModels/ARPTableAddEntryViewModel.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,46 @@
44

55
namespace NETworkManager.ViewModels;
66

7+
/// <summary>
8+
/// View model for adding an ARP table entry.
9+
/// </summary>
710
public class ArpTableAddEntryViewModel : ViewModelBase
811
{
12+
/// <summary>
13+
/// Backing field for <see cref="IPAddress"/>.
14+
/// </summary>
915
private string _ipAddress;
1016

17+
/// <summary>
18+
/// Backing field for <see cref="MACAddress"/>.
19+
/// </summary>
1120
private string _macAddress;
1221

22+
/// <summary>
23+
/// Initializes a new instance of the <see cref="ArpTableAddEntryViewModel"/> class.
24+
/// </summary>
25+
/// <param name="addCommand">The action to execute when the add command is invoked.</param>
26+
/// <param name="cancelHandler">The action to execute when the cancel command is invoked.</param>
1327
public ArpTableAddEntryViewModel(Action<ArpTableAddEntryViewModel> addCommand,
1428
Action<ArpTableAddEntryViewModel> cancelHandler)
1529
{
1630
AddCommand = new RelayCommand(_ => addCommand(this));
1731
CancelCommand = new RelayCommand(_ => cancelHandler(this));
1832
}
1933

34+
/// <summary>
35+
/// Gets the command to add the entry.
36+
/// </summary>
2037
public ICommand AddCommand { get; }
2138

39+
/// <summary>
40+
/// Gets the command to cancel the operation.
41+
/// </summary>
2242
public ICommand CancelCommand { get; }
2343

44+
/// <summary>
45+
/// Gets or sets the IP address.
46+
/// </summary>
2447
public string IPAddress
2548
{
2649
get => _ipAddress;
@@ -34,6 +57,9 @@ public string IPAddress
3457
}
3558
}
3659

60+
/// <summary>
61+
/// Gets or sets the MAC address.
62+
/// </summary>
3763
public string MACAddress
3864
{
3965
get => _macAddress;

0 commit comments

Comments
 (0)