mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[Hosts]Ignore default ACME sample entries (#28163)
This commit is contained in:
committed by
GitHub
parent
83f0625427
commit
298a5eba2a
@@ -76,6 +76,8 @@ namespace Hosts.Tests
|
|||||||
[DataRow("host 10.1.1.1")]
|
[DataRow("host 10.1.1.1")]
|
||||||
[DataRow("# comment 10.1.1.1 host # comment")]
|
[DataRow("# comment 10.1.1.1 host # comment")]
|
||||||
[DataRow("10.1.1.1 host01 host02 host03 host04 host05 host06 host07 host08 host09 host10")]
|
[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)
|
public void Not_Valid_Entry(string line)
|
||||||
{
|
{
|
||||||
var entry = new Entry(0, line);
|
var entry = new Entry(0, line);
|
||||||
|
|||||||
@@ -448,7 +448,7 @@
|
|||||||
ScrollViewer.IsVerticalRailEnabled="True"
|
ScrollViewer.IsVerticalRailEnabled="True"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||||
ScrollViewer.VerticalScrollMode="Enabled"
|
ScrollViewer.VerticalScrollMode="Enabled"
|
||||||
Text="{Binding Comment, Mode=TwoWay}" />
|
Text="{Binding Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
x:Uid="Active"
|
x:Uid="Active"
|
||||||
IsOn="{Binding Active, Mode=TwoWay}"
|
IsOn="{Binding Active, Mode=TwoWay}"
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace Hosts.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[NotifyPropertyChangedFor(nameof(Valid))]
|
||||||
private string _comment;
|
private string _comment;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
@@ -153,7 +154,19 @@ namespace Hosts.Models
|
|||||||
|
|
||||||
public bool Validate(bool validateHostsLength)
|
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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user