diff --git a/SimpleDnsCrypt/Helper/PatchHelper.cs b/SimpleDnsCrypt/Helper/PatchHelper.cs new file mode 100644 index 00000000..a5eefd00 --- /dev/null +++ b/SimpleDnsCrypt/Helper/PatchHelper.cs @@ -0,0 +1,23 @@ +namespace SimpleDnsCrypt.Helper +{ + /// + /// Class to update the configuration file. + /// + public static class PatchHelper + { + public static bool Patch() + { + var version = VersionHelper.PublishVersion; + if (!DnscryptProxyConfigurationManager.LoadConfiguration()) return false; + if (version.Equals("0.6.5")) + { + //added: netprobe_address = '255.255.255.0:53' + //changed: netprobe_timeout = 0 + DnscryptProxyConfigurationManager.DnscryptProxyConfiguration.netprobe_address = "255.255.255.0:53"; + DnscryptProxyConfigurationManager.DnscryptProxyConfiguration.netprobe_timeout = 0; + return DnscryptProxyConfigurationManager.SaveConfiguration(); + } + return false; + } + } +} diff --git a/SimpleDnsCrypt/SimpleDnsCrypt.csproj b/SimpleDnsCrypt/SimpleDnsCrypt.csproj index 27d4ee2e..807a6559 100644 --- a/SimpleDnsCrypt/SimpleDnsCrypt.csproj +++ b/SimpleDnsCrypt/SimpleDnsCrypt.csproj @@ -182,6 +182,7 @@ + diff --git a/SimpleDnsCrypt/ViewModels/LoaderViewModel.cs b/SimpleDnsCrypt/ViewModels/LoaderViewModel.cs index 21d6c41c..44513715 100644 --- a/SimpleDnsCrypt/ViewModels/LoaderViewModel.cs +++ b/SimpleDnsCrypt/ViewModels/LoaderViewModel.cs @@ -168,6 +168,11 @@ private async void InitializeApplication() File.Move(configFile, configFile + ".bak"); } File.Move(tmpConfigPath, configFile); + // update the configuration file + if (PatchHelper.Patch()) + { + await Task.Delay(500).ConfigureAwait(false); + } } }