mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Make APIAccess a component
This commit is contained in:
@ -8,15 +8,15 @@ using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API
|
||||
{
|
||||
public class APIAccess : IAPIProvider, IDisposable
|
||||
public class APIAccess : Component, IAPIProvider
|
||||
{
|
||||
private readonly OsuConfigManager config;
|
||||
private readonly OAuth authentication;
|
||||
@ -27,8 +27,6 @@ namespace osu.Game.Online.API
|
||||
|
||||
private ConcurrentQueue<APIRequest> queue = new ConcurrentQueue<APIRequest>();
|
||||
|
||||
public readonly Scheduler Scheduler = new Scheduler();
|
||||
|
||||
/// <summary>
|
||||
/// The username/email provided by the user when initiating a login.
|
||||
/// </summary>
|
||||
@ -306,27 +304,13 @@ namespace osu.Game.Online.API
|
||||
Id = 1,
|
||||
};
|
||||
|
||||
public void Update()
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
Scheduler.Update();
|
||||
}
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
private void dispose()
|
||||
{
|
||||
config.Set(OsuSetting.Token, config.Get<bool>(OsuSetting.SavePassword) ? Token : string.Empty);
|
||||
config.Save();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~APIAccess()
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public enum APIState
|
||||
|
Reference in New Issue
Block a user