diff --git a/Pixeval/Data/Web/Delegation/PixivApiDnsResolver.cs b/Pixeval/Data/Web/Delegation/PixivApiDnsResolver.cs index 61acfd73..a3d499b2 100644 --- a/Pixeval/Data/Web/Delegation/PixivApiDnsResolver.cs +++ b/Pixeval/Data/Web/Delegation/PixivApiDnsResolver.cs @@ -19,6 +19,7 @@ #endregion using System.Collections.Generic; +using System.IO; using System.Net; namespace Pixeval.Data.Web.Delegation @@ -29,21 +30,41 @@ namespace Pixeval.Data.Web.Delegation protected override IEnumerable UseDefaultDns() { - yield return IPAddress.Parse("210.140.131.219"); - yield return IPAddress.Parse("210.140.131.223"); - yield return IPAddress.Parse("210.140.131.226"); + if (File.Exists("./ApiIP.cfg")) + { + foreach (var ip in File.ReadAllLines("./ApiIP.cfg")) + { + yield return IPAddress.Parse(ip); + } + } + else + { + yield return IPAddress.Parse("210.140.131.219"); + yield return IPAddress.Parse("210.140.131.223"); + yield return IPAddress.Parse("210.140.131.226"); + } } } - + public class PixivImageDnsResolver : DnsResolver { public static readonly DnsResolver Instance = new PixivImageDnsResolver(); protected override IEnumerable UseDefaultDns() { - yield return IPAddress.Parse("210.140.92.138"); - yield return IPAddress.Parse("210.140.92.139"); - yield return IPAddress.Parse("210.140.92.140"); + if (File.Exists("./ImageIP.cfg")) + { + foreach (var ip in File.ReadAllLines("./ImageIP.cfg")) + { + yield return IPAddress.Parse(ip); + } + } + else + { + yield return IPAddress.Parse("210.140.92.141"); + yield return IPAddress.Parse("210.140.92.142"); + yield return IPAddress.Parse("210.140.92.143"); + } } } -} \ No newline at end of file +} diff --git a/Pixeval/Pixeval.csproj b/Pixeval/Pixeval.csproj index 1275c6e6..e60ffd9c 100644 --- a/Pixeval/Pixeval.csproj +++ b/Pixeval/Pixeval.csproj @@ -13,6 +13,7 @@ x86;AnyCPU $(NoWarn);NU1701 Debug;Release + false