diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config
new file mode 100644
index 0000000..67f8ea0
--- /dev/null
+++ b/.nuget/NuGet.Config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe
new file mode 100644
index 0000000..9ca6659
Binary files /dev/null and b/.nuget/NuGet.exe differ
diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets
new file mode 100644
index 0000000..3f8c37b
--- /dev/null
+++ b/.nuget/NuGet.targets
@@ -0,0 +1,144 @@
+
+
+
+ $(MSBuildProjectDirectory)\..\
+
+
+ false
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
+
+
+
+
+ $(SolutionDir).nuget
+
+
+
+ $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config
+ $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config
+
+
+
+ $(MSBuildProjectDirectory)\packages.config
+ $(PackagesProjectConfig)
+
+
+
+
+ $(NuGetToolsPath)\NuGet.exe
+ @(PackageSource)
+
+ "$(NuGetExePath)"
+ mono --runtime=v4.0.30319 "$(NuGetExePath)"
+
+ $(TargetDir.Trim('\\'))
+
+ -RequireConsent
+ -NonInteractive
+
+ "$(SolutionDir) "
+ "$(SolutionDir)"
+
+
+ $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)
+ $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols
+
+
+
+ RestorePackages;
+ $(BuildDependsOn);
+
+
+
+
+ $(BuildDependsOn);
+ BuildPackage;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HostsFileEditor.sln b/HostsFileEditor.sln
index ec318b8..840427b 100644
--- a/HostsFileEditor.sln
+++ b/HostsFileEditor.sln
@@ -25,6 +25,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NGenCustomAction", "setup\N
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "HostsFileEditorSetup", "setup\HostsFileEditorSetup.wixproj", "{A78A7EC4-2707-408C-A19F-AB237F0D85BA}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{237C13F4-73B3-4BB2-A4EC-5D38962F07B9}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/src/HostsFileEditor.csproj b/src/HostsFileEditor.csproj
index efc749d..198fdac 100644
--- a/src/HostsFileEditor.csproj
+++ b/src/HostsFileEditor.csproj
@@ -130,6 +130,7 @@
+
diff --git a/src/MainForm.cs b/src/MainForm.cs
index 7a2f7ab..2404ea1 100644
--- a/src/MainForm.cs
+++ b/src/MainForm.cs
@@ -589,6 +589,7 @@ private void OnSaveClick(object sender, EventArgs e)
DataGridViewDataErrorContexts.Commit);
HostsFile.Instance.Save();
+ DnsEx.FlushMyCache();
}
///
diff --git a/src/Utilities/DnsEx.cs b/src/Utilities/DnsEx.cs
new file mode 100644
index 0000000..c1033a8
--- /dev/null
+++ b/src/Utilities/DnsEx.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace HostsFileEditor.Utilities
+{
+ public class DnsEx
+ {
+ [DllImport("dnsapi.dll", EntryPoint = "DnsFlushResolverCache")]
+ private static extern UInt32 DnsFlushResolverCache();
+
+ public static void FlushMyCache()
+ {
+ UInt32 result = DnsFlushResolverCache();
+ }
+ }
+}