mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
The dropdown box for choosing the proxy type now works with pasted proxy too
This commit is contained in:
@@ -119,8 +119,9 @@ namespace RuriLib.Models
|
||||
/// Parses a CProxy object from an advanced string. Supports Proxy Chains.
|
||||
/// </summary>
|
||||
/// <param name="proxy">The string to parse the proxy from</param>
|
||||
/// <param name="defaultType">The default type to use when not specified</param>
|
||||
/// <returns>The parsed CProxy object</returns>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user