2020-05-13 23:04:31 +08: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-13 04:04:39 +08:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2020-05-14 00:57:03 +08:00
|
|
|
|
using JetBrains.Annotations;
|
2020-05-13 04:04:39 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Extensions
|
|
|
|
|
{
|
|
|
|
|
public class Cursor
|
|
|
|
|
{
|
2020-05-14 00:57:03 +08:00
|
|
|
|
[UsedImplicitly]
|
2020-05-13 04:04:39 +08: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());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|