-
Notifications
You must be signed in to change notification settings - Fork 807
Feature: Firewall app #3383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BornToBeRoot
wants to merge
22
commits into
main
Choose a base branch
from
feature/firewall-app-base
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature: Firewall app #3383
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ff7024e
Feature: Firewall app
BornToBeRoot c3bccb0
Update Source/NETworkManager.Models/Firewall/FirewallRule.cs
BornToBeRoot 7cf2ffd
Fix XML doc comments for Id/Name properties in FirewallRule.cs
Copilot 0ea864c
Feature: Add translation
BornToBeRoot ff78d29
Feature: Add translation and export
BornToBeRoot 271346e
Merge branch 'main' into feature/firewall-app-base
BornToBeRoot 7058281
Feature: Add network profile to networkinterfaceview
BornToBeRoot 2252908
Docs: #3383
BornToBeRoot e5d3ae4
Merge branch 'main' into feature/firewall-app-base
BornToBeRoot e04039e
Merge branch 'main' into feature/firewall-app-base
BornToBeRoot 77d086b
Chore: Hide firewall settings/profile
BornToBeRoot 0761db4
Chore: Refactor the UI
BornToBeRoot ad07dc6
Feature: UI & Copy data
BornToBeRoot 57a2863
Chore: UI redesign
BornToBeRoot d90969f
Docs: Discovery Protocol
BornToBeRoot 00ed305
Update package.json
BornToBeRoot aacad1a
Update yarn.lock
BornToBeRoot 70b404e
Feature: Enable/Disable/Delete Firewall rule
BornToBeRoot a144800
Feature: Open Hosts File Editor
BornToBeRoot b92a304
Feature: Firewall add / edit firewall rule
BornToBeRoot fa13f29
Chore: Adjust strings
BornToBeRoot 6761e73
Feature: Firewall edit/del + docs
BornToBeRoot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Source/NETworkManager.Converters/FirewallInterfaceTypeToStringConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| using System; | ||
| using System.Globalization; | ||
| using System.Windows.Data; | ||
| using NETworkManager.Localization; | ||
| using NETworkManager.Models.Firewall; | ||
|
|
||
| namespace NETworkManager.Converters; | ||
|
|
||
| /// <summary> | ||
| /// Convert <see cref="FirewallInterfaceType" /> to translated <see cref="string" /> or vice versa. | ||
| /// </summary> | ||
| public sealed class FirewallInterfaceTypeToStringConverter : IValueConverter | ||
| { | ||
| /// <summary> | ||
| /// Convert <see cref="FirewallInterfaceType" /> to translated <see cref="string" />. | ||
| /// </summary> | ||
| /// <param name="value">Object from type <see cref="FirewallInterfaceType" />.</param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns>Translated <see cref="FirewallInterfaceType" />.</returns> | ||
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| return value is not FirewallInterfaceType interfaceType | ||
| ? "-/-" | ||
| : ResourceTranslator.Translate(ResourceIdentifier.FirewallInterfaceType, interfaceType); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// !!! Method not implemented !!! | ||
| /// </summary> | ||
| /// <param name="value"></param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns></returns> | ||
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
Source/NETworkManager.Converters/FirewallNetworkProfilesToStringConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Globalization; | ||
| using System.Windows.Data; | ||
| using NETworkManager.Localization.Resources; | ||
|
|
||
| namespace NETworkManager.Converters; | ||
|
|
||
| /// <summary> | ||
| /// Convert a <see cref="bool" /> array (Domain, Private, Public) representing firewall network | ||
| /// profiles to a localized <see cref="string" />, or vice versa. | ||
| /// </summary> | ||
| public sealed class FirewallNetworkProfilesToStringConverter : IValueConverter | ||
| { | ||
| /// <summary> | ||
| /// Convert a <see cref="bool" /> array (Domain, Private, Public) to a localized <see cref="string" />. | ||
| /// Returns <c>null</c> when all three profiles are active so that a <c>TargetNullValue</c> binding | ||
| /// can supply the translated "Any" label. | ||
| /// </summary> | ||
| /// <param name="value">A <see cref="bool" /> array with exactly three elements.</param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns>Localized, comma-separated profile list (e.g. "Domain, Private, Public").</returns> | ||
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| if (value is not bool[] { Length: 3 } profiles) | ||
| return "-/-"; | ||
|
|
||
| var names = new List<string>(3); | ||
| if (profiles[0]) names.Add(Strings.Domain); | ||
| if (profiles[1]) names.Add(Strings.Private); | ||
| if (profiles[2]) names.Add(Strings.Public); | ||
|
|
||
| return names.Count == 0 ? "-" : string.Join(", ", names); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// !!! Method not implemented !!! | ||
| /// </summary> | ||
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } | ||
| } | ||
41 changes: 41 additions & 0 deletions
41
Source/NETworkManager.Converters/FirewallProtocolToStringConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| using System; | ||
| using System.Globalization; | ||
| using System.Windows.Data; | ||
| using NETworkManager.Localization; | ||
| using NETworkManager.Models.Firewall; | ||
|
|
||
| namespace NETworkManager.Converters; | ||
|
|
||
| /// <summary> | ||
| /// Convert <see cref="FirewallProtocol" /> to translated <see cref="string" /> or vice versa. | ||
| /// </summary> | ||
| public sealed class FirewallProtocolToStringConverter : IValueConverter | ||
| { | ||
| /// <summary> | ||
| /// Convert <see cref="FirewallProtocol" /> to translated <see cref="string" />. | ||
| /// </summary> | ||
| /// <param name="value">Object from type <see cref="FirewallProtocol" />.</param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns>Translated <see cref="FirewallProtocol" />.</returns> | ||
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| return value is not FirewallProtocol protocol | ||
| ? "-/-" | ||
| : ResourceTranslator.Translate(ResourceIdentifier.FirewallProtocol, protocol); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// !!! Method not implemented !!! | ||
| /// </summary> | ||
| /// <param name="value"></param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns></returns> | ||
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
Source/NETworkManager.Converters/FirewallRuleActionToStringConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| using System; | ||
| using System.Globalization; | ||
| using System.Windows.Data; | ||
| using NETworkManager.Localization; | ||
| using NETworkManager.Models.Firewall; | ||
|
|
||
| namespace NETworkManager.Converters; | ||
|
|
||
| /// <summary> | ||
| /// Convert <see cref="FirewallRuleAction" /> to translated <see cref="string" /> or vice versa. | ||
| /// </summary> | ||
| public sealed class FirewallRuleActionToStringConverter : IValueConverter | ||
| { | ||
| /// <summary> | ||
| /// Convert <see cref="FirewallRuleAction" /> to translated <see cref="string" />. | ||
| /// </summary> | ||
| /// <param name="value">Object from type <see cref="FirewallRuleAction" />.</param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns>Translated <see cref="FirewallRuleAction" />.</returns> | ||
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| return value is not FirewallRuleAction action | ||
| ? "-/-" | ||
| : ResourceTranslator.Translate(ResourceIdentifier.FirewallRuleAction, action); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// !!! Method not implemented !!! | ||
| /// </summary> | ||
| /// <param name="value"></param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns></returns> | ||
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
Source/NETworkManager.Converters/FirewallRuleDirectionToStringConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| using System; | ||
| using System.Globalization; | ||
| using System.Windows.Data; | ||
| using NETworkManager.Localization; | ||
| using NETworkManager.Models.Firewall; | ||
|
|
||
| namespace NETworkManager.Converters; | ||
|
|
||
| /// <summary> | ||
| /// Convert <see cref="FirewallRuleDirection" /> to translated <see cref="string" /> or vice versa. | ||
| /// </summary> | ||
| public sealed class FirewallRuleDirectionToStringConverter : IValueConverter | ||
| { | ||
| /// <summary> | ||
| /// Convert <see cref="FirewallRuleDirection" /> to translated <see cref="string" />. | ||
| /// </summary> | ||
| /// <param name="value">Object from type <see cref="FirewallRuleDirection" />.</param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns>Translated <see cref="FirewallRuleDirection" />.</returns> | ||
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| return value is not FirewallRuleDirection direction | ||
| ? "-/-" | ||
| : ResourceTranslator.Translate(ResourceIdentifier.FirewallRuleDirection, direction); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// !!! Method not implemented !!! | ||
| /// </summary> | ||
| /// <param name="value"></param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns></returns> | ||
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
Source/NETworkManager.Converters/NetworkProfileToStringConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| using System; | ||
| using System.Globalization; | ||
| using System.Windows.Data; | ||
| using NETworkManager.Localization.Resources; | ||
| using NETworkManager.Models.Network; | ||
|
|
||
| namespace NETworkManager.Converters; | ||
|
|
||
| /// <summary> | ||
| /// Convert <see cref="NetworkProfile" /> to a localized <see cref="string" /> or vice versa. | ||
| /// </summary> | ||
| public sealed class NetworkProfileToStringConverter : IValueConverter | ||
| { | ||
| /// <summary> | ||
| /// Convert <see cref="NetworkProfile" /> to a localized <see cref="string" />. | ||
| /// </summary> | ||
| /// <param name="value">Object from type <see cref="NetworkProfile" />.</param> | ||
| /// <param name="targetType"></param> | ||
| /// <param name="parameter"></param> | ||
| /// <param name="culture"></param> | ||
| /// <returns>Localized <see cref="string" /> representing the network profile.</returns> | ||
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| return value is not NetworkProfile profile | ||
| ? "-/-" | ||
| : profile switch | ||
| { | ||
| NetworkProfile.Domain => Strings.Domain, | ||
| NetworkProfile.Private => Strings.Private, | ||
| NetworkProfile.Public => Strings.Public, | ||
| _ => "-/-" | ||
| }; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// !!! Method not implemented !!! | ||
| /// </summary> | ||
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Source/NETworkManager.Localization/Resources/StaticStrings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML docs say this converter “Returns
nullwhen all three profiles are active … so that aTargetNullValuebinding can supply the translated ‘Any’ label”, but the implementation never returnsnulland also returns "-" when no profiles are selected. Given the firewall PowerShell layer treats both all-true and all-false asAny, the converter should likely return a localized “Any” (ornullto useTargetNullValue) for those cases to avoid misleading UI/exports.