Skip to content

Commit b69a5b3

Browse files
authored
Feature: Remove WoL port from profile (BornToBeRoot#2220)
* Feature: Remove WoL Port from profile * Chore: Use default config * Docs: BornToBeRoot#2220
1 parent cb6fdff commit b69a5b3

6 files changed

Lines changed: 16 additions & 73 deletions

File tree

Source/NETworkManager.Profiles/Application/WakeOnLan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static WakeOnLANInfo CreateInfo(ProfileInfo profileInfo)
1212
{
1313
MagicPacket = Models.Network.WakeOnLAN.CreateMagicPacket(profileInfo.WakeOnLAN_MACAddress),
1414
Broadcast = IPAddress.Parse(profileInfo.WakeOnLAN_Broadcast),
15-
Port = profileInfo.WakeOnLAN_OverridePort ? profileInfo.WakeOnLAN_Port : SettingsManager.Current.WakeOnLAN_Port
15+
Port = SettingsManager.Current.WakeOnLAN_Port
1616
};
1717

1818
return info;

Source/NETworkManager.Profiles/ProfileInfo.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public class ProfileInfo
153153
public bool PowerShell_OverrideAdditionalCommandLine { get; set; }
154154
public string PowerShell_AdditionalCommandLine { get; set; }
155155
public bool PowerShell_OverrideExecutionPolicy { get; set; }
156-
public PowerShell.ExecutionPolicy PowerShell_ExecutionPolicy { get; set; }
156+
public PowerShell.ExecutionPolicy PowerShell_ExecutionPolicy { get; set; } = GlobalStaticConfiguration.PowerShell_ExecutionPolicy;
157157

158158
public bool PuTTY_Enabled { get; set; }
159159
public ConnectionMode PuTTY_ConnectionMode { get; set; }
@@ -191,7 +191,7 @@ public class ProfileInfo
191191
public bool TigerVNC_InheritHost { get; set; } = true;
192192
public string TigerVNC_Host { get; set; }
193193
public bool TigerVNC_OverridePort { get; set; }
194-
public int TigerVNC_Port { get; set; }
194+
public int TigerVNC_Port { get; set; } = GlobalStaticConfiguration.TigerVNC_DefaultVNCPort;
195195

196196
public bool WebConsole_Enabled { get; set; }
197197
public string WebConsole_Url { get; set; }
@@ -218,8 +218,6 @@ public class ProfileInfo
218218
public bool WakeOnLAN_Enabled { get; set; }
219219
public string WakeOnLAN_MACAddress { get; set; }
220220
public string WakeOnLAN_Broadcast { get; set; }
221-
public bool WakeOnLAN_OverridePort { get; set; }
222-
public int WakeOnLAN_Port { get; set; }
223221

224222
public bool Whois_Enabled { get; set; }
225223
public bool Whois_InheritHost { get; set; } = true;
@@ -431,8 +429,6 @@ public ProfileInfo(ProfileInfo profile)
431429
WakeOnLAN_Enabled = profile.WakeOnLAN_Enabled;
432430
WakeOnLAN_MACAddress = profile.WakeOnLAN_MACAddress;
433431
WakeOnLAN_Broadcast = profile.WakeOnLAN_Broadcast;
434-
WakeOnLAN_OverridePort = profile.WakeOnLAN_OverridePort;
435-
WakeOnLAN_Port = profile.WakeOnLAN_Port;
436432

437433
// Whois
438434
Whois_Enabled = profile.Whois_Enabled;

Source/NETworkManager/ProfileDialogManager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,6 @@ public static ProfileInfo ParseProfileInfo(ProfileViewModel instance)
414414
WakeOnLAN_Enabled = instance.WakeOnLAN_Enabled,
415415
WakeOnLAN_MACAddress = instance.WakeOnLAN_MACAddress?.Trim(),
416416
WakeOnLAN_Broadcast = instance.WakeOnLAN_Broadcast?.Trim(),
417-
WakeOnLAN_OverridePort = instance.WakeOnLAN_OverridePort,
418-
WakeOnLAN_Port = instance.WakeOnLAN_Port,
419417

420418
// Whois
421419
Whois_Enabled = instance.Whois_Enabled,

Source/NETworkManager/ViewModels/ProfileViewModel.cs

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.Security;
1414
using NETworkManager.Models;
1515
using NETworkManager.Models.Network;
16-
using Microsoft.PowerShell.Commands;
1716

1817
namespace NETworkManager.ViewModels;
1918

@@ -2574,34 +2573,6 @@ public string WakeOnLAN_Broadcast
25742573
OnPropertyChanged();
25752574
}
25762575
}
2577-
2578-
private bool _wakeOnLAN_OverridePort;
2579-
public bool WakeOnLAN_OverridePort
2580-
{
2581-
get => _wakeOnLAN_OverridePort;
2582-
set
2583-
{
2584-
if (value == _wakeOnLAN_OverridePort)
2585-
return;
2586-
2587-
_wakeOnLAN_OverridePort = value;
2588-
OnPropertyChanged();
2589-
}
2590-
}
2591-
2592-
private int _wakeOnLAN_Port;
2593-
public int WakeOnLAN_Port
2594-
{
2595-
get => _wakeOnLAN_Port;
2596-
set
2597-
{
2598-
if (value == _wakeOnLAN_Port)
2599-
return;
2600-
2601-
_wakeOnLAN_Port = value;
2602-
OnPropertyChanged();
2603-
}
2604-
}
26052576
#endregion
26062577

26072578
#region Whois
@@ -2789,7 +2760,7 @@ public ProfileViewModel(Action<ProfileViewModel> saveCommand, Action<ProfileView
27892760
PowerShell_AdditionalCommandLine = profileInfo.PowerShell_AdditionalCommandLine;
27902761
PowerShell_ExecutionPolicies = Enum.GetValues(typeof(PowerShell.ExecutionPolicy)).Cast<PowerShell.ExecutionPolicy>().ToList();
27912762
PowerShell_OverrideExecutionPolicy = profileInfo.PowerShell_OverrideExecutionPolicy;
2792-
PowerShell_ExecutionPolicy = editMode != ProfileEditMode.Add ? profileInfo.PowerShell_ExecutionPolicy : PowerShell_ExecutionPolicies.FirstOrDefault(x => x == SettingsManager.Current.PowerShell_ExecutionPolicy); ;
2763+
PowerShell_ExecutionPolicy = profileInfo.PowerShell_ExecutionPolicy;
27932764

27942765
// PuTTY
27952766
PuTTY_Enabled = editMode == ProfileEditMode.Add ? applicationName == ApplicationName.PuTTY : profileInfo.PuTTY_Enabled;
@@ -2850,7 +2821,7 @@ public ProfileViewModel(Action<ProfileViewModel> saveCommand, Action<ProfileView
28502821
TigerVNC_InheritHost = profileInfo.TigerVNC_InheritHost;
28512822
TigerVNC_Host = profileInfo.TigerVNC_Host;
28522823
TigerVNC_OverridePort = profileInfo.TigerVNC_OverridePort;
2853-
TigerVNC_Port = profileInfo.TigerVNC_OverridePort ? profileInfo.TigerVNC_Port : SettingsManager.Current.TigerVNC_Port;
2824+
TigerVNC_Port = profileInfo.TigerVNC_Port;
28542825

28552826
// Web Console
28562827
WebConsole_Enabled = editMode == ProfileEditMode.Add ? applicationName == ApplicationName.WebConsole : profileInfo.WebConsole_Enabled;
@@ -2881,9 +2852,7 @@ public ProfileViewModel(Action<ProfileViewModel> saveCommand, Action<ProfileView
28812852
// Wake on LAN
28822853
WakeOnLAN_Enabled = editMode == ProfileEditMode.Add ? applicationName == ApplicationName.WakeOnLAN : profileInfo.WakeOnLAN_Enabled;
28832854
WakeOnLAN_MACAddress = profileInfo.WakeOnLAN_MACAddress;
2884-
WakeOnLAN_Broadcast = profileInfo.WakeOnLAN_Broadcast;
2885-
WakeOnLAN_OverridePort = profileInfo.WakeOnLAN_OverridePort;
2886-
WakeOnLAN_Port = profileInfo.WakeOnLAN_OverridePort ? profileInfo.WakeOnLAN_Port : SettingsManager.Current.WakeOnLAN_Port;
2855+
WakeOnLAN_Broadcast = profileInfo.WakeOnLAN_Broadcast;
28872856

28882857
// Whois
28892858
Whois_Enabled = editMode == ProfileEditMode.Add ? applicationName == ApplicationName.Whois : profileInfo.Whois_Enabled;

Source/NETworkManager/Views/ProfileDialog.xaml

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,13 +2067,7 @@
20672067
<Grid.RowDefinitions>
20682068
<RowDefinition Height="Auto" />
20692069
<RowDefinition Height="10" />
2070-
<RowDefinition Height="Auto" />
2071-
<RowDefinition Height="10" />
2072-
<RowDefinition Height="Auto" />
2073-
<RowDefinition Height="10" />
2074-
<RowDefinition Height="Auto" />
2075-
<RowDefinition Height="10" />
2076-
<RowDefinition Height="Auto" />
2070+
<RowDefinition Height="Auto" />
20772071
</Grid.RowDefinitions>
20782072
<Grid.ColumnDefinitions>
20792073
<ColumnDefinition Width="1*" />
@@ -2103,19 +2097,6 @@
21032097
</Binding>
21042098
</TextBox.Text>
21052099
</TextBox>
2106-
<TextBlock Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="4" Text="{x:Static localization:Strings.OverrideDefaultSettings}" Style="{StaticResource HeaderTextBlock}" Margin="0,10,0,0"/>
2107-
<Separator Grid.Column="0" Grid.Row="6" Grid.ColumnSpan="4" Background="{DynamicResource MahApps.Brushes.Gray8}" Margin="0,0,0,10" />
2108-
<CheckBox Grid.Column="0" Grid.Row="8" Content="{x:Static localization:Strings.Port}" IsChecked="{Binding WakeOnLAN_OverridePort}" Style="{StaticResource DefaultCheckBox}" />
2109-
<TextBox x:Name="TextBoxWakeOnLANPort" Grid.Column="2" Grid.Row="8" mah:TextBoxHelper.Watermark="{x:Static localization:StaticStrings.ExamplePort7}" IsEnabled="{Binding WakeOnLAN_OverridePort}">
2110-
<TextBox.Text>
2111-
<Binding Path="WakeOnLAN_Port" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
2112-
<Binding.ValidationRules>
2113-
<validators:EmptyValidator ValidatesOnTargetUpdated="True" />
2114-
<validators:PortValidator ValidatesOnTargetUpdated="True" />
2115-
</Binding.ValidationRules>
2116-
</Binding>
2117-
</TextBox.Text>
2118-
</TextBox>
21192100
</Grid>
21202101
</StackPanel>
21212102
</ScrollViewer>
@@ -2591,16 +2572,7 @@
25912572
<MultiDataTrigger.Setters>
25922573
<Setter Property="IsEnabled" Value="False" />
25932574
</MultiDataTrigger.Setters>
2594-
</MultiDataTrigger>
2595-
<MultiDataTrigger>
2596-
<MultiDataTrigger.Conditions>
2597-
<Condition Binding="{Binding WakeOnLAN_Enabled}" Value="True"/>
2598-
<Condition Binding="{Binding ElementName=TextBoxWakeOnLANPort, Path=(Validation.HasError)}" Value="True" />
2599-
</MultiDataTrigger.Conditions>
2600-
<MultiDataTrigger.Setters>
2601-
<Setter Property="IsEnabled" Value="False" />
2602-
</MultiDataTrigger.Setters>
2603-
</MultiDataTrigger>
2575+
</MultiDataTrigger>
26042576
<!-- Whois -->
26052577
<MultiDataTrigger>
26062578
<MultiDataTrigger.Conditions>

docs/Changelog/next-release.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ Release date: **xx.xx.2023**
2121

2222
## Bugfixes
2323

24+
## Deprecated
25+
26+
Deprecated
27+
{: .label .label-red }
28+
29+
- Profiles
30+
- Wake on LAN port, because it was inconsistent (If you select the profile, the port from the settings was used. If you right-click on the profile, the port from the profile was used) [#2220](https://github.com/BornToBeRoot/NETworkManager/pull/2220){:target="\_blank"}
31+
2432
## Other
2533
- Code cleanup [#2100](https://github.com/BornToBeRoot/NETworkManager/pull/2100){:target="\_blank"} [#2172](https://github.com/BornToBeRoot/NETworkManager/pull/2172){:target="\_blank"}
2634
- Language files updated [#transifex](https://github.com/BornToBeRoot/NETworkManager/pulls?q=author%3Aapp%2Ftransifex-integration){:target="\_blank"}

0 commit comments

Comments
 (0)