diff --git a/OpenBullet/Pages/Main/ProxyManager.xaml.cs b/OpenBullet/Pages/Main/ProxyManager.xaml.cs index 7214eab..8428652 100644 --- a/OpenBullet/Pages/Main/ProxyManager.xaml.cs +++ b/OpenBullet/Pages/Main/ProxyManager.xaml.cs @@ -210,7 +210,7 @@ namespace OpenBullet try { CProxy proxy = new CProxy(); - proxy.Parse(p); + proxy.Parse(p, type); if (!proxy.IsNumeric || proxy.IsValidNumeric) { vm.ProxyList.Add(proxy); diff --git a/RuriLib/Models/CProxy.cs b/RuriLib/Models/CProxy.cs index 7385a67..24eb61e 100644 --- a/RuriLib/Models/CProxy.cs +++ b/RuriLib/Models/CProxy.cs @@ -119,8 +119,9 @@ namespace RuriLib.Models /// Parses a CProxy object from an advanced string. Supports Proxy Chains. /// /// The string to parse the proxy from + /// The default type to use when not specified /// The parsed CProxy object - public CProxy Parse(string proxy) + public CProxy Parse(string proxy, ProxyType defaultType = ProxyType.Http) { // Take the first proxy of the chain var chain = proxy.Split(new string[] { "->" }, 2, StringSplitOptions.None); @@ -134,6 +135,10 @@ namespace RuriLib.Models Type = type; current = current.Replace($"({groups[1].Value})", ""); } + else // Otherwise set the default type passed + { + Type = defaultType; + } // Split the host:port:user:pass portion and set the first two var fields = current.Split(':'); @@ -149,7 +154,7 @@ namespace RuriLib.Models // If the chain is not finished, set the next proxy by parsing recursively if (chain.Count() > 1) { - Next = (new CProxy()).Parse(chain[1]); + Next = (new CProxy()).Parse(chain[1], defaultType); } // Finally return this proxy