Skip to content

Commit abef4eb

Browse files
authored
Feature: Run Command (#2502)
* Feature: PoC Run Command * Fix: Remove unused commands * Feature: Run Command combobox improved * Feature: Run Command * Feature: Run Command & Fix #2481 * Feature: Run command * Feature: Run command * Fix: App name not translated * Feature: Experimental feature flag * Docs: Experimental features
1 parent e953778 commit abef4eb

File tree

68 files changed

+1715
-743
lines changed

Some content is hidden

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

68 files changed

+1715
-743
lines changed

InnoSetup.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "NETworkManager"
5-
#define MyAppVersion "2023.9.12.0"
5+
#define MyAppVersion "2023.9.21.0"
66
#define MyAppPublisher "BornToBeRoot"
77
#define MyAppURL "https://github.com/BornToBeRoot/NETworkManager/"
88
#define MyAppExeName "NETworkManager.exe"

Source/GlobalAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
[assembly: AssemblyTrademark("")]
77
[assembly: AssemblyCulture("")]
88

9-
[assembly: AssemblyVersion("2023.9.12.0")]
10-
[assembly: AssemblyFileVersion("2023.9.12.0")]
9+
[assembly: AssemblyVersion("2023.9.21.0")]
10+
[assembly: AssemblyFileVersion("2023.9.21.0")]

Source/NETworkManager.Converters/GroupViewNameToTranslatedStringConverter.cs renamed to Source/NETworkManager.Converters/ProfileGroupToTranslatedStringConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace NETworkManager.Converters;
99
/// <summary>
1010
/// Convert <see cref="GroupViewName"/> to translated <see cref="string"/> or wise versa.
1111
/// </summary>
12-
public sealed class GroupViewNameToTranslatedStringConverter : IValueConverter
12+
public sealed class ProfileGroupToTranslatedStringConverter : IValueConverter
1313
{
1414
/// <summary>
1515
/// Convert <see cref="GroupViewName"/> to translated <see cref="string"/>.
@@ -23,7 +23,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
2323
{
2424
return value is not GroupViewName name
2525
? "-/-"
26-
: ResourceTranslator.Translate(ResourceIdentifier.GroupViewName, name);
26+
: ResourceTranslator.Translate(ResourceIdentifier.ProfileGroup, name);
2727
}
2828

2929
/// <summary>

Source/NETworkManager.Converters/ProfileViewNameToTranslatedStringConverter.cs renamed to Source/NETworkManager.Converters/ProfileNameToTranslatedStringConverter.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
namespace NETworkManager.Converters;
88

99
/// <summary>
10-
/// Convert <see cref="ProfileViewName"/> to translated <see cref="string"/> or wise versa.
10+
/// Convert <see cref="ProfileName"/> to translated <see cref="string"/> or wise versa.
1111
/// </summary>
12-
public sealed class ProfileViewNameToTranslatedStringConverter : IValueConverter
12+
public sealed class ProfileNameToTranslatedStringConverter : IValueConverter
1313
{
1414
/// <summary>
15-
/// Convert <see cref="ProfileViewName"/> to translated <see cref="string"/>.
15+
/// Convert <see cref="ProfileName"/> to translated <see cref="string"/>.
1616
/// </summary>
17-
/// <param name="value">Object from type <see cref="ProfileViewName"/>.</param>
17+
/// <param name="value">Object from type <see cref="ProfileName"/>.</param>
1818
/// <param name="targetType"></param>
1919
/// <param name="parameter"></param>
2020
/// <param name="culture"></param>
21-
/// <returns>Translated <see cref="ProfileViewName"/>.</returns>
21+
/// <returns>Translated <see cref="ProfileName"/>.</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
24-
return value is not ProfileViewName name
24+
return value is not ProfileName name
2525
? "-/-"
26-
: ResourceTranslator.Translate(ResourceIdentifier.ProfileViewName, name);
26+
: ResourceTranslator.Translate(new [] {ResourceIdentifier.ProfileName , ResourceIdentifier.ApplicationName}, name);
2727
}
2828

2929
/// <summary>

Source/NETworkManager.Converters/SettingsViewNameToTranslatedStringConverter.cs renamed to Source/NETworkManager.Converters/SettingsGroupToTranslatedStringConverter.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
namespace NETworkManager.Converters;
88

99
/// <summary>
10-
/// Convert <see cref="SettingsViewName"/> to translated <see cref="string"/> or wise versa.
10+
/// Convert <see cref="SettingsGroup"/> to translated <see cref="string"/> or wise versa.
1111
/// </summary>
12-
public sealed class SettingsViewNameToTranslatedStringConverter : IValueConverter
12+
public sealed class SettingsGroupToTranslatedStringConverter : IValueConverter
1313
{
1414
/// <summary>
15-
/// Convert <see cref="SettingsViewName"/> to translated <see cref="string"/>.
15+
/// Convert <see cref="SettingsGroup"/> to translated <see cref="string"/>.
1616
/// </summary>
17-
/// <param name="value">Object from type <see cref="SettingsViewName"/>.</param>
17+
/// <param name="value">Object from type <see cref="SettingsGroup"/>.</param>
1818
/// <param name="targetType"></param>
1919
/// <param name="parameter"></param>
2020
/// <param name="culture"></param>
21-
/// <returns>Translated <see cref="SettingsViewName"/>.</returns>
21+
/// <returns>Translated <see cref="SettingsGroup"/>.</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
24-
return value is not SettingsViewName name ? "-/-" : ResourceTranslator.Translate(ResourceIdentifier.SettingsViewName, name);
24+
return value is not SettingsGroup group ? "-/-" : ResourceTranslator.Translate(ResourceIdentifier.SettingsGroup, group);
2525
}
2626

2727
/// <summary>

Source/NETworkManager.Converters/SettingsViewGroupToTranslatedStringConverter.cs renamed to Source/NETworkManager.Converters/SettingsNameToTranslatedStringConverter.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
namespace NETworkManager.Converters;
88

99
/// <summary>
10-
/// Convert <see cref="SettingsViewGroup"/> to translated <see cref="string"/> or wise versa.
10+
/// Convert <see cref="SettingsName"/> to translated <see cref="string"/> or wise versa.
1111
/// </summary>
12-
public sealed class SettingsViewGroupToTranslatedStringConverter : IValueConverter
12+
public sealed class SettingsNameToTranslatedStringConverter : IValueConverter
1313
{
1414
/// <summary>
15-
/// Convert <see cref="SettingsViewGroup"/> to translated <see cref="string"/>.
15+
/// Convert <see cref="SettingsName"/> to translated <see cref="string"/>.
1616
/// </summary>
17-
/// <param name="value">Object from type <see cref="SettingsViewGroup"/>.</param>
17+
/// <param name="value">Object from type <see cref="SettingsName"/>.</param>
1818
/// <param name="targetType"></param>
1919
/// <param name="parameter"></param>
2020
/// <param name="culture"></param>
21-
/// <returns>Translated <see cref="SettingsViewGroup"/>.</returns>
21+
/// <returns>Translated <see cref="SettingsName"/>.</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
24-
return value is not SettingsViewGroup group ? "-/-" : ResourceTranslator.Translate(ResourceIdentifier.SettingsViewGroup, group);
24+
return value is not SettingsName name ? "-/-" : ResourceTranslator.Translate( new [] {ResourceIdentifier.SettingsName, ResourceIdentifier.ApplicationName}, name);
2525
}
2626

2727
/// <summary>

Source/NETworkManager.Documentation/DocumentationManager.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -143,41 +143,41 @@ public static DocumentationIdentifier GetIdentifierByApplicationName(Application
143143
}
144144

145145
/// <summary>
146-
/// Method to get the <see cref="DocumentationIdentifier"/> from an <see cref="SettingsViewName"/>.
146+
/// Method to get the <see cref="DocumentationIdentifier"/> from an <see cref="SettingsName"/>.
147147
/// </summary>
148-
/// <param name="name"><see cref="SettingsViewName"/> from which you want to get the <see cref="DocumentationIdentifier"/>.</param>
148+
/// <param name="name"><see cref="SettingsName"/> from which you want to get the <see cref="DocumentationIdentifier"/>.</param>
149149
/// <returns><see cref="DocumentationIdentifier"/> of the application or settings page.</returns>
150-
public static DocumentationIdentifier GetIdentifierBySettingsName(SettingsViewName name)
150+
public static DocumentationIdentifier GetIdentifierBySettingsName(SettingsName name)
151151
{
152152
return name switch
153153
{
154-
SettingsViewName.General => DocumentationIdentifier.SettingsGeneral,
155-
SettingsViewName.Window => DocumentationIdentifier.SettingsWindow,
156-
SettingsViewName.Appearance => DocumentationIdentifier.SettingsAppearance,
157-
SettingsViewName.Language => DocumentationIdentifier.SettingsLanguage,
158-
SettingsViewName.Network => DocumentationIdentifier.SettingsNetwork,
159-
SettingsViewName.Status => DocumentationIdentifier.SettingsStatus,
160-
SettingsViewName.HotKeys => DocumentationIdentifier.SettingsHotKeys,
161-
SettingsViewName.Autostart => DocumentationIdentifier.SettingsAutostart,
162-
SettingsViewName.Update => DocumentationIdentifier.SettingsUpdate,
163-
SettingsViewName.Profiles => DocumentationIdentifier.SettingsProfiles,
164-
SettingsViewName.Settings => DocumentationIdentifier.SettingsSettings,
165-
SettingsViewName.Dashboard => GetIdentifierByApplicationName(ApplicationName.Dashboard),
166-
SettingsViewName.IPScanner => GetIdentifierByApplicationName(ApplicationName.IPScanner),
167-
SettingsViewName.PortScanner => GetIdentifierByApplicationName(ApplicationName.PortScanner),
168-
SettingsViewName.PingMonitor => GetIdentifierByApplicationName(ApplicationName.PingMonitor),
169-
SettingsViewName.Traceroute => GetIdentifierByApplicationName(ApplicationName.Traceroute),
170-
SettingsViewName.DNSLookup => GetIdentifierByApplicationName(ApplicationName.DNSLookup),
171-
SettingsViewName.RemoteDesktop => GetIdentifierByApplicationName(ApplicationName.RemoteDesktop),
172-
SettingsViewName.PowerShell => GetIdentifierByApplicationName(ApplicationName.PowerShell),
173-
SettingsViewName.PuTTY => GetIdentifierByApplicationName(ApplicationName.PuTTY),
174-
SettingsViewName.AWSSessionManager => GetIdentifierByApplicationName(ApplicationName.AWSSessionManager),
175-
SettingsViewName.TigerVNC => GetIdentifierByApplicationName(ApplicationName.TigerVNC),
176-
SettingsViewName.SNMP => GetIdentifierByApplicationName(ApplicationName.SNMP),
177-
SettingsViewName.SNTPLookup => GetIdentifierByApplicationName(ApplicationName.SNTPLookup),
178-
SettingsViewName.WakeOnLAN => GetIdentifierByApplicationName(ApplicationName.WakeOnLAN),
179-
//SettingsViewName.Whois => GetIdentifierByApplicationName(ApplicationName.Whois),
180-
SettingsViewName.BitCalculator => GetIdentifierByApplicationName(ApplicationName.BitCalculator),
154+
SettingsName.General => DocumentationIdentifier.SettingsGeneral,
155+
SettingsName.Window => DocumentationIdentifier.SettingsWindow,
156+
SettingsName.Appearance => DocumentationIdentifier.SettingsAppearance,
157+
SettingsName.Language => DocumentationIdentifier.SettingsLanguage,
158+
SettingsName.Network => DocumentationIdentifier.SettingsNetwork,
159+
SettingsName.Status => DocumentationIdentifier.SettingsStatus,
160+
SettingsName.HotKeys => DocumentationIdentifier.SettingsHotKeys,
161+
SettingsName.Autostart => DocumentationIdentifier.SettingsAutostart,
162+
SettingsName.Update => DocumentationIdentifier.SettingsUpdate,
163+
SettingsName.Profiles => DocumentationIdentifier.SettingsProfiles,
164+
SettingsName.Settings => DocumentationIdentifier.SettingsSettings,
165+
SettingsName.Dashboard => GetIdentifierByApplicationName(ApplicationName.Dashboard),
166+
SettingsName.IPScanner => GetIdentifierByApplicationName(ApplicationName.IPScanner),
167+
SettingsName.PortScanner => GetIdentifierByApplicationName(ApplicationName.PortScanner),
168+
SettingsName.PingMonitor => GetIdentifierByApplicationName(ApplicationName.PingMonitor),
169+
SettingsName.Traceroute => GetIdentifierByApplicationName(ApplicationName.Traceroute),
170+
SettingsName.DNSLookup => GetIdentifierByApplicationName(ApplicationName.DNSLookup),
171+
SettingsName.RemoteDesktop => GetIdentifierByApplicationName(ApplicationName.RemoteDesktop),
172+
SettingsName.PowerShell => GetIdentifierByApplicationName(ApplicationName.PowerShell),
173+
SettingsName.PuTTY => GetIdentifierByApplicationName(ApplicationName.PuTTY),
174+
SettingsName.AWSSessionManager => GetIdentifierByApplicationName(ApplicationName.AWSSessionManager),
175+
SettingsName.TigerVNC => GetIdentifierByApplicationName(ApplicationName.TigerVNC),
176+
SettingsName.SNMP => GetIdentifierByApplicationName(ApplicationName.SNMP),
177+
SettingsName.SNTPLookup => GetIdentifierByApplicationName(ApplicationName.SNTPLookup),
178+
SettingsName.WakeOnLAN => GetIdentifierByApplicationName(ApplicationName.WakeOnLAN),
179+
//SettingsName.Whois => GetIdentifierByApplicationName(ApplicationName.Whois),
180+
SettingsName.BitCalculator => GetIdentifierByApplicationName(ApplicationName.BitCalculator),
181181
_ => DocumentationIdentifier.Default,
182182
};
183183
}

Source/NETworkManager.Localization/ResourceIdentifier.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ public enum ResourceIdentifier
77
DiscoveryProtocol,
88
IPStatus,
99
PortState,
10-
ProfileViewName,
11-
GroupViewName,
10+
ProfileName,
11+
ProfileGroup,
1212
PuTTYLogMode,
1313
RemoteDesktopAudioCaptureRedirectionMode,
1414
RemoteDesktopAudioRedirectionMode,
1515
RemoteDesktopGatewayServerLogonMethod,
1616
RemoteDesktopKeyboardHookMode,
1717
RemoteDesktopNetworkConnectionType,
18-
SettingsViewGroup,
19-
SettingsViewName,
18+
SettingsGroup,
19+
SettingsName,
2020
TcpState,
2121
Theme,
2222
TimeUnit,
2323
WiFiConnectionStatus
24-
}
24+
}

Source/NETworkManager.Localization/ResourceTranslator.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace NETworkManager.Localization;
1+
using System.Collections.Generic;
2+
3+
namespace NETworkManager.Localization;
24

35
public static class ResourceTranslator
46
{
@@ -12,4 +14,24 @@ public static string Translate(ResourceIdentifier identifier, object value)
1214
{
1315
return Resources.Strings.ResourceManager.GetString($"{identifier}_{value}", LocalizationManager.GetInstance().Culture) ?? value.ToString();
1416
}
17+
18+
/// <summary>
19+
/// Translate the resource name to the localized value. Returns the value if no translation is found.
20+
/// </summary>
21+
/// <param name="identifiers">List of identifiers of the resource to translate.</param>
22+
/// <param name="value">Value of the resource to translate.</param>
23+
/// <returns>Localized value of the resource. Returns the value if no translation is found.</returns>
24+
public static string Translate(IEnumerable<ResourceIdentifier> identifiers, object value)
25+
{
26+
foreach(var identifier in identifiers)
27+
{
28+
var foundResource = Resources.Strings.ResourceManager.GetString($"{identifier}_{value}",
29+
LocalizationManager.GetInstance().Culture);
30+
31+
if (foundResource != null)
32+
return foundResource;
33+
}
34+
35+
return value.ToString();
36+
}
1537
}

0 commit comments

Comments
 (0)