2020-05-13 15:04:31 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.IO.Network;
|
2020-05-12 20:04:39 +00:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2020-05-13 16:57:03 +00:00
|
|
|
|
using JetBrains.Annotations;
|
2020-05-12 20:04:39 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Extensions
|
|
|
|
|
{
|
|
|
|
|
public class Cursor
|
|
|
|
|
{
|
2020-05-13 16:57:03 +00:00
|
|
|
|
[UsedImplicitly]
|
2020-05-12 20:04:39 +00:00
|
|
|
|
[JsonExtensionData]
|
|
|
|
|
public IDictionary<string, JToken> Properties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class WebRequestExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void AddCursor(this WebRequest webRequest, Cursor cursor)
|
|
|
|
|
{
|
|
|
|
|
cursor?.Properties.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
webRequest.AddParameter("cursor[" + x.Key + "]", x.Value.ToString());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|