mirror of
https://github.com/microsoft/PowerToys
synced 2024-11-22 00:03:48 +00:00
[Hosts]Ignore default ACME sample entries (#28163)
This commit is contained in:
parent
83f0625427
commit
298a5eba2a
@ -76,6 +76,8 @@ namespace Hosts.Tests
|
||||
[DataRow("host 10.1.1.1")]
|
||||
[DataRow("# comment 10.1.1.1 host # comment")]
|
||||
[DataRow("10.1.1.1 host01 host02 host03 host04 host05 host06 host07 host08 host09 host10")]
|
||||
[DataRow("102.54.94.97 rhino.acme.com # source server")]
|
||||
[DataRow("38.25.63.10 x.acme.com # x client host")]
|
||||
public void Not_Valid_Entry(string line)
|
||||
{
|
||||
var entry = new Entry(0, line);
|
||||
|
@ -448,7 +448,7 @@
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
Text="{Binding Comment, Mode=TwoWay}" />
|
||||
Text="{Binding Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="Active"
|
||||
IsOn="{Binding Active, Mode=TwoWay}"
|
||||
|
@ -44,6 +44,7 @@ namespace Hosts.Models
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(Valid))]
|
||||
private string _comment;
|
||||
|
||||
[ObservableProperty]
|
||||
@ -153,7 +154,19 @@ namespace Hosts.Models
|
||||
|
||||
public bool Validate(bool validateHostsLength)
|
||||
{
|
||||
if (Equals("102.54.94.97", "rhino.acme.com", "source server") || Equals("38.25.63.10", "x.acme.com", "x client host"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Type != AddressType.Invalid && ValidationHelper.ValidHosts(Hosts, validateHostsLength);
|
||||
}
|
||||
|
||||
private bool Equals(string address, string hosts, string comment)
|
||||
{
|
||||
return string.Equals(Address, address, StringComparison.Ordinal)
|
||||
&& string.Equals(Hosts, hosts, StringComparison.Ordinal)
|
||||
&& string.Equals(Comment, comment, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user