2 Commits

Author SHA1 Message Date
71b48883b3 Update version 2019-06-05 12:22:53 +02:00
e3ae12d33d Add reset option 2019-06-05 12:21:01 +02:00
3 changed files with 33 additions and 3 deletions

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:KurtzPelRegionPicker"
mc:Ignorable="d"
Title="KPRP" Height="190" Width="220"
Title="KPRP" Height="225" Width="220"
ResizeMode="CanMinimize">
<StackPanel Orientation="Vertical"
Margin="10">
@@ -19,5 +19,9 @@
Height="25"
Content="Apply"
Click="Button_Apply_Click" />
<Button Height="25"
Background="#FFD2D2"
Content="Reset"
Click="Button_Reset_Click" />
</StackPanel>
</Window>

View File

@@ -55,6 +55,13 @@ namespace KurtzPelRegionPicker
}
}
private void Button_Reset_Click(object sender, RoutedEventArgs e)
{
ResetRegion();
MessageBox.Show("Region reset", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
}
private void ApplyRegion(Region source, Region destination)
{
string[] content = File.ReadAllLines(HOSTS_PATH);
@@ -85,6 +92,25 @@ namespace KurtzPelRegionPicker
File.WriteAllLines(HOSTS_PATH, newContent);
}
private void ResetRegion()
{
string[] content = File.ReadAllLines(HOSTS_PATH);
if (content.Contains(COMMENT))
{
// Purge
int index = content.IndexOf(COMMENT);
var list = content.ToList();
list.RemoveAt(index);
list.RemoveAt(index);
content = list.ToArray();
File.WriteAllLines(HOSTS_PATH, content);
}
}
private string GetRealIP(string dns)
{
var process = new Process()

View File

@@ -51,5 +51,5 @@ using System.Windows;
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]