mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
MoreThanTv now working on mono with libcurl
This commit is contained in:
@@ -8,15 +8,26 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett
|
||||
{
|
||||
public static class CookieContainerExtensions
|
||||
{
|
||||
public static void FillFromJson(this CookieContainer cookies, Uri uri, JArray json)
|
||||
{
|
||||
foreach (var cookie in json)
|
||||
{
|
||||
var w = ((string)cookie).Split(':');
|
||||
cookies.Add(uri, new Cookie(w[0], w[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class CookieContainerExtensions
|
||||
{
|
||||
public static void FillFromJson (this CookieContainer cookies, Uri uri, JArray json)
|
||||
{
|
||||
foreach (string cookie in json) {
|
||||
|
||||
var w = cookie.Split ('=');
|
||||
if (w.Length == 1)
|
||||
cookies.Add (uri, new Cookie{ Name = cookie.Trim () });
|
||||
else
|
||||
cookies.Add (uri, new Cookie (w [0].Trim (), w [1].Trim ()));
|
||||
}
|
||||
}
|
||||
|
||||
public static JArray ToJson (this CookieContainer cookies, Uri baseUrl)
|
||||
{
|
||||
return new JArray ((
|
||||
from cookie in cookies.GetCookies (baseUrl).Cast<Cookie> ()
|
||||
select cookie.Name.Trim () + "=" + cookie.Value.Trim ()
|
||||
).ToArray ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user